Andrew G. Morgan | 876ac71 | 2020-07-02 21:36:16 -0700 | [diff] [blame] | 1 | package cap |
| 2 | |
Andrew G. Morgan | 90192cd | 2020-12-11 23:27:50 -0800 | [diff] [blame] | 3 | import ( |
| 4 | "syscall" |
| 5 | |
| 6 | "kernel.org/pub/linux/libs/security/libcap/psx" |
| 7 | ) |
Andrew G. Morgan | 876ac71 | 2020-07-02 21:36:16 -0700 | [diff] [blame] | 8 | |
| 9 | // multisc provides syscalls overridable for testing purposes that |
| 10 | // support a single kernel security state for all OS threads. |
Andrew G. Morgan | 90192cd | 2020-12-11 23:27:50 -0800 | [diff] [blame] | 11 | // We use this version when we are cgo compiling because |
| 12 | // we need to manage the native C pthreads too. |
Andrew G. Morgan | 876ac71 | 2020-07-02 21:36:16 -0700 | [diff] [blame] | 13 | var multisc = &syscaller{ |
Andrew G. Morgan | 90192cd | 2020-12-11 23:27:50 -0800 | [diff] [blame] | 14 | w3: psx.Syscall3, |
| 15 | w6: psx.Syscall6, |
Andrew G. Morgan | 876ac71 | 2020-07-02 21:36:16 -0700 | [diff] [blame] | 16 | r3: syscall.RawSyscall, |
| 17 | r6: syscall.RawSyscall6, |
| 18 | } |
| 19 | |
| 20 | // singlesc provides a single threaded implementation. Users should |
| 21 | // take care to ensure the thread is locked and marked nogc. |
| 22 | var singlesc = &syscaller{ |
| 23 | w3: syscall.RawSyscall, |
| 24 | w6: syscall.RawSyscall6, |
| 25 | r3: syscall.RawSyscall, |
| 26 | r6: syscall.RawSyscall6, |
| 27 | } |