.github,go.mod: latest tests and deps
This commit is contained in:
		
							parent
							
								
									1f89cdc69a
								
							
						
					
					
						commit
						5dbaf66868
					
				| 
						 | 
				
			
			@ -2,16 +2,13 @@ on: [push, pull_request]
 | 
			
		|||
name: Test
 | 
			
		||||
jobs:
 | 
			
		||||
  test:
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        go-version: [1.19.x]
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - name: Install Go
 | 
			
		||||
      uses: actions/setup-go@v3
 | 
			
		||||
      uses: actions/setup-go@main
 | 
			
		||||
      with:
 | 
			
		||||
        go-version: ${{ matrix.go-version }}
 | 
			
		||||
    - uses: actions/checkout@v3
 | 
			
		||||
        go-version: 1.21.x
 | 
			
		||||
    - uses: actions/checkout@main
 | 
			
		||||
      with:
 | 
			
		||||
         path: './src/github.com/kevinburke/chroma-markdown'
 | 
			
		||||
    # staticcheck needs this for GOPATH
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								go.mod
								
								
								
								
							
							
						
						
									
										2
									
								
								go.mod
								
								
								
								
							| 
						 | 
				
			
			@ -4,7 +4,7 @@ go 1.20
 | 
			
		|||
 | 
			
		||||
require (
 | 
			
		||||
	github.com/alecthomas/chroma v0.10.0
 | 
			
		||||
	golang.org/x/sys v0.4.0
 | 
			
		||||
	golang.org/x/sys v0.14.0
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
require github.com/dlclark/regexp2 v1.8.0 // indirect
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								go.sum
								
								
								
								
							
							
						
						
									
										4
									
								
								go.sum
								
								
								
								
							| 
						 | 
				
			
			@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
 | 
			
		|||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 | 
			
		||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
 | 
			
		||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 | 
			
		||||
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
 | 
			
		||||
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
			
		||||
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
 | 
			
		||||
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 | 
			
		||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 | 
			
		||||
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=
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build gc
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build (freebsd || netbsd || openbsd) && gc
 | 
			
		||||
// +build freebsd netbsd openbsd
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc
 | 
			
		||||
// +build darwin dragonfly freebsd netbsd openbsd
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build (freebsd || netbsd || openbsd) && gc
 | 
			
		||||
// +build freebsd netbsd openbsd
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build (darwin || freebsd || netbsd || openbsd) && gc
 | 
			
		||||
// +build darwin freebsd netbsd openbsd
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build (darwin || freebsd || netbsd || openbsd) && gc
 | 
			
		||||
// +build darwin freebsd netbsd openbsd
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build (darwin || freebsd || netbsd || openbsd) && gc
 | 
			
		||||
// +build darwin freebsd netbsd openbsd
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build gc
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build gc
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build gc
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,9 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && arm64 && gc
 | 
			
		||||
// +build linux
 | 
			
		||||
// +build arm64
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,9 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && loong64 && gc
 | 
			
		||||
// +build linux
 | 
			
		||||
// +build loong64
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,9 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && (mips64 || mips64le) && gc
 | 
			
		||||
// +build linux
 | 
			
		||||
// +build mips64 mips64le
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,9 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && (mips || mipsle) && gc
 | 
			
		||||
// +build linux
 | 
			
		||||
// +build mips mipsle
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,9 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && (ppc64 || ppc64le) && gc
 | 
			
		||||
// +build linux
 | 
			
		||||
// +build ppc64 ppc64le
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build riscv64 && gc
 | 
			
		||||
// +build riscv64
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,9 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && s390x && gc
 | 
			
		||||
// +build linux
 | 
			
		||||
// +build s390x
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build gc
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build gc
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,9 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build zos && s390x && gc
 | 
			
		||||
// +build zos
 | 
			
		||||
// +build s390x
 | 
			
		||||
// +build gc
 | 
			
		||||
 | 
			
		||||
#include "textflag.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build freebsd
 | 
			
		||||
// +build freebsd
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
 | 
			
		||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build aix && ppc
 | 
			
		||||
// +build aix,ppc
 | 
			
		||||
 | 
			
		||||
// Functions to access/create device major and minor numbers matching the
 | 
			
		||||
// encoding used by AIX.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build aix && ppc64
 | 
			
		||||
// +build aix,ppc64
 | 
			
		||||
 | 
			
		||||
// Functions to access/create device major and minor numbers matching the
 | 
			
		||||
// encoding used AIX.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// 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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
 | 
			
		||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
//
 | 
			
		||||
//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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
//
 | 
			
		||||
//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
 | 
			
		||||
// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
 | 
			
		||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
 | 
			
		||||
 | 
			
		||||
// Unix environment variables.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build zos && s390x
 | 
			
		||||
// +build zos,s390x
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build dragonfly || freebsd || linux || netbsd || openbsd
 | 
			
		||||
// +build dragonfly freebsd linux netbsd openbsd
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// 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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
 | 
			
		||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build zos && s390x
 | 
			
		||||
// +build zos,s390x
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build gccgo && !aix && !hurd
 | 
			
		||||
// +build gccgo,!aix,!hurd
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,8 +2,7 @@
 | 
			
		|||
// Use of this source code is governed by a BSD-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
// +build gccgo,!hurd
 | 
			
		||||
// +build !aix,!hurd
 | 
			
		||||
//go:build gccgo && !aix && !hurd
 | 
			
		||||
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build gccgo && linux && amd64
 | 
			
		||||
// +build gccgo,linux,amd64
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux
 | 
			
		||||
// +build linux
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
// 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.
 | 
			
		||||
 | 
			
		||||
//go:build aix || solaris
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"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 int, 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 int, value int) error {
 | 
			
		||||
	v := int32(value)
 | 
			
		||||
	return ioctlPtr(fd, req, 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.
 | 
			
		||||
func IoctlSetWinsize(fd int, req int, value *Winsize) error {
 | 
			
		||||
	// TODO: if we get the chance, remove the req parameter and
 | 
			
		||||
	// hardcode TIOCSWINSZ.
 | 
			
		||||
	return ioctlPtr(fd, req, unsafe.Pointer(value))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IoctlSetTermios performs an ioctl on fd with a *Termios.
 | 
			
		||||
//
 | 
			
		||||
// The req value will usually be TCSETA or TIOCSETA.
 | 
			
		||||
func IoctlSetTermios(fd int, req int, value *Termios) error {
 | 
			
		||||
	// TODO: if we get the chance, remove the req parameter.
 | 
			
		||||
	return ioctlPtr(fd, req, unsafe.Pointer(value))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 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 int) (int, error) {
 | 
			
		||||
	var value int
 | 
			
		||||
	err := ioctlPtr(fd, req, unsafe.Pointer(&value))
 | 
			
		||||
	return value, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func IoctlGetWinsize(fd int, req int) (*Winsize, error) {
 | 
			
		||||
	var value Winsize
 | 
			
		||||
	err := ioctlPtr(fd, req, unsafe.Pointer(&value))
 | 
			
		||||
	return &value, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func IoctlGetTermios(fd int, req int) (*Termios, error) {
 | 
			
		||||
	var value Termios
 | 
			
		||||
	err := ioctlPtr(fd, req, unsafe.Pointer(&value))
 | 
			
		||||
	return &value, err
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								vendor/golang.org/x/sys/unix/ioctl.go → vendor/golang.org/x/sys/unix/ioctl_unsigned.go
								
								
									generated
								
								
									vendored
								
								
							
							
						
						
									
										20
									
								
								vendor/golang.org/x/sys/unix/ioctl.go → vendor/golang.org/x/sys/unix/ioctl_unsigned.go
								
								
									generated
								
								
									vendored
								
								
							| 
						 | 
				
			
			@ -2,13 +2,11 @@
 | 
			
		|||
// 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 || hurd || linux || netbsd || openbsd || solaris
 | 
			
		||||
// +build aix darwin dragonfly freebsd hurd linux netbsd openbsd solaris
 | 
			
		||||
//go:build darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"unsafe"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -27,7 +25,7 @@ func IoctlSetInt(fd int, req uint, value int) error {
 | 
			
		|||
// 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)))
 | 
			
		||||
	return ioctlPtr(fd, req, unsafe.Pointer(&v))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
 | 
			
		||||
| 
						 | 
				
			
			@ -36,9 +34,7 @@ func IoctlSetPointerInt(fd int, req uint, value int) error {
 | 
			
		|||
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
 | 
			
		||||
	return ioctlPtr(fd, req, unsafe.Pointer(value))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IoctlSetTermios performs an ioctl on fd with a *Termios.
 | 
			
		||||
| 
						 | 
				
			
			@ -46,9 +42,7 @@ func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
 | 
			
		|||
// The req value will usually be TCSETA or TIOCSETA.
 | 
			
		||||
func IoctlSetTermios(fd int, req uint, value *Termios) error {
 | 
			
		||||
	// TODO: if we get the chance, remove the req parameter.
 | 
			
		||||
	err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
 | 
			
		||||
	runtime.KeepAlive(value)
 | 
			
		||||
	return err
 | 
			
		||||
	return ioctlPtr(fd, req, unsafe.Pointer(value))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IoctlGetInt performs an ioctl operation which gets an integer value
 | 
			
		||||
| 
						 | 
				
			
			@ -58,18 +52,18 @@ func IoctlSetTermios(fd int, req uint, value *Termios) error {
 | 
			
		|||
// 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)))
 | 
			
		||||
	err := ioctlPtr(fd, req, 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)))
 | 
			
		||||
	err := ioctlPtr(fd, req, unsafe.Pointer(&value))
 | 
			
		||||
	return &value, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
 | 
			
		||||
	var value Termios
 | 
			
		||||
	err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
 | 
			
		||||
	err := ioctlPtr(fd, req, unsafe.Pointer(&value))
 | 
			
		||||
	return &value, err
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build zos && s390x
 | 
			
		||||
// +build zos,s390x
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -17,25 +16,23 @@ import (
 | 
			
		|||
 | 
			
		||||
// 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 {
 | 
			
		||||
func IoctlSetInt(fd int, req int, 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 {
 | 
			
		||||
func IoctlSetWinsize(fd int, req int, 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
 | 
			
		||||
	return ioctlPtr(fd, req, unsafe.Pointer(value))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 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 {
 | 
			
		||||
func IoctlSetTermios(fd int, req int, value *Termios) error {
 | 
			
		||||
	if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) {
 | 
			
		||||
		return ENOSYS
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -49,22 +46,22 @@ func IoctlSetTermios(fd int, req uint, value *Termios) error {
 | 
			
		|||
//
 | 
			
		||||
// 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) {
 | 
			
		||||
func IoctlGetInt(fd int, req int) (int, error) {
 | 
			
		||||
	var value int
 | 
			
		||||
	err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
 | 
			
		||||
	err := ioctlPtr(fd, req, unsafe.Pointer(&value))
 | 
			
		||||
	return value, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
 | 
			
		||||
func IoctlGetWinsize(fd int, req int) (*Winsize, error) {
 | 
			
		||||
	var value Winsize
 | 
			
		||||
	err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
 | 
			
		||||
	err := ioctlPtr(fd, req, 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) {
 | 
			
		||||
func IoctlGetTermios(fd int, req int) (*Termios, error) {
 | 
			
		||||
	var value Termios
 | 
			
		||||
	if req != TCGETS {
 | 
			
		||||
		return &value, ENOSYS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,7 +50,7 @@ if [[ "$GOOS" = "linux" ]]; then
 | 
			
		|||
	# Use the Docker-based build system
 | 
			
		||||
	# Files generated through docker (use $cmd so you can Ctl-C the build or run)
 | 
			
		||||
	$cmd docker build --tag generate:$GOOS $GOOS
 | 
			
		||||
	$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && /bin/pwd):/build generate:$GOOS
 | 
			
		||||
	$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && pwd):/build generate:$GOOS
 | 
			
		||||
	exit
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -66,6 +66,7 @@ includes_Darwin='
 | 
			
		|||
#include <sys/ptrace.h>
 | 
			
		||||
#include <sys/select.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <sys/un.h>
 | 
			
		||||
#include <sys/sockio.h>
 | 
			
		||||
#include <sys/sys_domain.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -203,6 +204,7 @@ struct ltchars {
 | 
			
		|||
#include <sys/timerfd.h>
 | 
			
		||||
#include <sys/uio.h>
 | 
			
		||||
#include <sys/xattr.h>
 | 
			
		||||
#include <netinet/udp.h>
 | 
			
		||||
#include <linux/audit.h>
 | 
			
		||||
#include <linux/bpf.h>
 | 
			
		||||
#include <linux/can.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -517,10 +519,11 @@ ccflags="$@"
 | 
			
		|||
		$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|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT)_/ ||
 | 
			
		||||
		$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
 | 
			
		||||
		$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
 | 
			
		||||
		$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
 | 
			
		||||
		$2 ~ /^RAW_PAYLOAD_/ ||
 | 
			
		||||
		$2 ~ /^[US]F_/ ||
 | 
			
		||||
		$2 ~ /^TP_STATUS_/ ||
 | 
			
		||||
		$2 ~ /^FALLOC_/ ||
 | 
			
		||||
		$2 ~ /^ICMPV?6?_(FILTER|SEC)/ ||
 | 
			
		||||
| 
						 | 
				
			
			@ -580,6 +583,7 @@ ccflags="$@"
 | 
			
		|||
		$2 ~ /^PERF_/ ||
 | 
			
		||||
		$2 ~ /^SECCOMP_MODE_/ ||
 | 
			
		||||
		$2 ~ /^SEEK_/ ||
 | 
			
		||||
		$2 ~ /^SCHED_/ ||
 | 
			
		||||
		$2 ~ /^SPLICE_/ ||
 | 
			
		||||
		$2 ~ /^SYNC_FILE_RANGE_/ ||
 | 
			
		||||
		$2 !~ /IOC_MAGIC/ &&
 | 
			
		||||
| 
						 | 
				
			
			@ -621,7 +625,7 @@ ccflags="$@"
 | 
			
		|||
		$2 ~ /^MEM/ ||
 | 
			
		||||
		$2 ~ /^WG/ ||
 | 
			
		||||
		$2 ~ /^FIB_RULE_/ ||
 | 
			
		||||
		$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
 | 
			
		||||
		$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE|IOMIN$|IOOPT$|ALIGNOFF$|DISCARD|ROTATIONAL$|ZEROOUT$|GETDISKSEQ$)/ {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)}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -659,7 +663,6 @@ 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
 | 
			
		||||
cat _error.out | grep -vf _error.grep | grep -vf _signal.grep
 | 
			
		||||
| 
						 | 
				
			
			@ -738,7 +741,8 @@ main(void)
 | 
			
		|||
		e = errors[i].num;
 | 
			
		||||
		if(i > 0 && errors[i-1].num == e)
 | 
			
		||||
			continue;
 | 
			
		||||
		strcpy(buf, strerror(e));
 | 
			
		||||
		strncpy(buf, strerror(e), sizeof(buf) - 1);
 | 
			
		||||
		buf[sizeof(buf) - 1] = '\0';
 | 
			
		||||
		// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
 | 
			
		||||
		if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
 | 
			
		||||
			buf[0] += a - A;
 | 
			
		||||
| 
						 | 
				
			
			@ -757,7 +761,8 @@ main(void)
 | 
			
		|||
		e = signals[i].num;
 | 
			
		||||
		if(i > 0 && signals[i-1].num == e)
 | 
			
		||||
			continue;
 | 
			
		||||
		strcpy(buf, strsignal(e));
 | 
			
		||||
		strncpy(buf, strsignal(e), sizeof(buf) - 1);
 | 
			
		||||
		buf[sizeof(buf) - 1] = '\0';
 | 
			
		||||
		// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
 | 
			
		||||
		if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
 | 
			
		||||
			buf[0] += a - A;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
// Copyright 2023 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 aix || darwin || dragonfly || freebsd || openbsd || solaris
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
var mapper = &mmapper{
 | 
			
		||||
	active: make(map[*byte][]byte),
 | 
			
		||||
	mmap:   mmap,
 | 
			
		||||
	munmap: munmap,
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,52 @@
 | 
			
		|||
// Copyright 2023 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 || netbsd
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
import "unsafe"
 | 
			
		||||
 | 
			
		||||
type mremapMmapper struct {
 | 
			
		||||
	mmapper
 | 
			
		||||
	mremap func(oldaddr uintptr, oldlength uintptr, newlength uintptr, flags int, newaddr uintptr) (xaddr uintptr, err error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var mapper = &mremapMmapper{
 | 
			
		||||
	mmapper: mmapper{
 | 
			
		||||
		active: make(map[*byte][]byte),
 | 
			
		||||
		mmap:   mmap,
 | 
			
		||||
		munmap: munmap,
 | 
			
		||||
	},
 | 
			
		||||
	mremap: mremap,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *mremapMmapper) Mremap(oldData []byte, newLength int, flags int) (data []byte, err error) {
 | 
			
		||||
	if newLength <= 0 || len(oldData) == 0 || len(oldData) != cap(oldData) || flags&mremapFixed != 0 {
 | 
			
		||||
		return nil, EINVAL
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pOld := &oldData[cap(oldData)-1]
 | 
			
		||||
	m.Lock()
 | 
			
		||||
	defer m.Unlock()
 | 
			
		||||
	bOld := m.active[pOld]
 | 
			
		||||
	if bOld == nil || &bOld[0] != &oldData[0] {
 | 
			
		||||
		return nil, EINVAL
 | 
			
		||||
	}
 | 
			
		||||
	newAddr, errno := m.mremap(uintptr(unsafe.Pointer(&bOld[0])), uintptr(len(bOld)), uintptr(newLength), flags, 0)
 | 
			
		||||
	if errno != nil {
 | 
			
		||||
		return nil, errno
 | 
			
		||||
	}
 | 
			
		||||
	bNew := unsafe.Slice((*byte)(unsafe.Pointer(newAddr)), newLength)
 | 
			
		||||
	pNew := &bNew[cap(bNew)-1]
 | 
			
		||||
	if flags&mremapDontunmap == 0 {
 | 
			
		||||
		delete(m.active, pOld)
 | 
			
		||||
	}
 | 
			
		||||
	m.active[pNew] = bNew
 | 
			
		||||
	return bNew, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Mremap(oldData []byte, newLength int, flags int) (data []byte, err error) {
 | 
			
		||||
	return mapper.Mremap(oldData, newLength, flags)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// 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.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,54 +8,31 @@ import (
 | 
			
		|||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"syscall"
 | 
			
		||||
	"unsafe"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Pledge implements the pledge syscall.
 | 
			
		||||
//
 | 
			
		||||
// The pledge syscall does not accept execpromises on OpenBSD releases
 | 
			
		||||
// before 6.3.
 | 
			
		||||
//
 | 
			
		||||
// execpromises must be empty when Pledge is called on OpenBSD
 | 
			
		||||
// releases predating 6.3, otherwise an error will be returned.
 | 
			
		||||
// This changes both the promises and execpromises; use PledgePromises or
 | 
			
		||||
// PledgeExecpromises to only change the promises or execpromises
 | 
			
		||||
// respectively.
 | 
			
		||||
//
 | 
			
		||||
// For more information see pledge(2).
 | 
			
		||||
func Pledge(promises, execpromises string) error {
 | 
			
		||||
	maj, min, err := majmin()
 | 
			
		||||
	if err := pledgeAvailable(); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pptr, err := BytePtrFromString(promises)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err = pledgeAvailable(maj, min, execpromises)
 | 
			
		||||
	exptr, err := BytePtrFromString(execpromises)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pptr, err := syscall.BytePtrFromString(promises)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// This variable will hold either a nil unsafe.Pointer or
 | 
			
		||||
	// an unsafe.Pointer to a string (execpromises).
 | 
			
		||||
	var expr unsafe.Pointer
 | 
			
		||||
 | 
			
		||||
	// If we're running on OpenBSD > 6.2, pass execpromises to the syscall.
 | 
			
		||||
	if maj > 6 || (maj == 6 && min > 2) {
 | 
			
		||||
		exptr, err := syscall.BytePtrFromString(execpromises)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		expr = unsafe.Pointer(exptr)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
 | 
			
		||||
	if e != 0 {
 | 
			
		||||
		return e
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
	return pledge(pptr, exptr)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PledgePromises implements the pledge syscall.
 | 
			
		||||
| 
						 | 
				
			
			@ -64,30 +41,16 @@ func Pledge(promises, execpromises string) error {
 | 
			
		|||
//
 | 
			
		||||
// For more information see pledge(2).
 | 
			
		||||
func PledgePromises(promises string) error {
 | 
			
		||||
	maj, min, err := majmin()
 | 
			
		||||
	if err := pledgeAvailable(); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pptr, err := BytePtrFromString(promises)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err = pledgeAvailable(maj, min, "")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// This variable holds the execpromises and is always nil.
 | 
			
		||||
	var expr unsafe.Pointer
 | 
			
		||||
 | 
			
		||||
	pptr, err := syscall.BytePtrFromString(promises)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
 | 
			
		||||
	if e != 0 {
 | 
			
		||||
		return e
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
	return pledge(pptr, nil)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PledgeExecpromises implements the pledge syscall.
 | 
			
		||||
| 
						 | 
				
			
			@ -96,30 +59,16 @@ func PledgePromises(promises string) error {
 | 
			
		|||
//
 | 
			
		||||
// For more information see pledge(2).
 | 
			
		||||
func PledgeExecpromises(execpromises string) error {
 | 
			
		||||
	maj, min, err := majmin()
 | 
			
		||||
	if err := pledgeAvailable(); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	exptr, err := BytePtrFromString(execpromises)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err = pledgeAvailable(maj, min, execpromises)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// This variable holds the promises and is always nil.
 | 
			
		||||
	var pptr unsafe.Pointer
 | 
			
		||||
 | 
			
		||||
	exptr, err := syscall.BytePtrFromString(execpromises)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(pptr), uintptr(unsafe.Pointer(exptr)), 0)
 | 
			
		||||
	if e != 0 {
 | 
			
		||||
		return e
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
	return pledge(nil, exptr)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// majmin returns major and minor version number for an OpenBSD system.
 | 
			
		||||
| 
						 | 
				
			
			@ -147,16 +96,15 @@ func majmin() (major int, minor int, err error) {
 | 
			
		|||
 | 
			
		||||
// pledgeAvailable checks for availability of the pledge(2) syscall
 | 
			
		||||
// based on the running OpenBSD version.
 | 
			
		||||
func pledgeAvailable(maj, min int, execpromises string) error {
 | 
			
		||||
	// If OpenBSD <= 5.9, pledge is not available.
 | 
			
		||||
	if (maj == 5 && min != 9) || maj < 5 {
 | 
			
		||||
		return fmt.Errorf("pledge syscall is not available on OpenBSD %d.%d", maj, min)
 | 
			
		||||
func pledgeAvailable() error {
 | 
			
		||||
	maj, min, err := majmin()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// If OpenBSD <= 6.2 and execpromises is not empty,
 | 
			
		||||
	// return an error - execpromises is not available before 6.3
 | 
			
		||||
	if (maj < 6 || (maj == 6 && min <= 2)) && execpromises != "" {
 | 
			
		||||
		return fmt.Errorf("cannot use execpromises on OpenBSD %d.%d", maj, min)
 | 
			
		||||
	// Require OpenBSD 6.4 as a minimum.
 | 
			
		||||
	if maj < 6 || (maj == 6 && min <= 3) {
 | 
			
		||||
		return fmt.Errorf("cannot call Pledge on OpenBSD %d.%d", maj, min)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build darwin && !ios
 | 
			
		||||
// +build darwin,!ios
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build ios
 | 
			
		||||
// +build ios
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// 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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// 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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build darwin
 | 
			
		||||
// +build darwin
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
 | 
			
		||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
 | 
			
		||||
 | 
			
		||||
// Socket control messages
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos
 | 
			
		||||
// +build aix darwin freebsd linux netbsd openbsd solaris zos
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build aix
 | 
			
		||||
// +build aix
 | 
			
		||||
 | 
			
		||||
// Aix system calls.
 | 
			
		||||
// This file is compiled as ordinary Go code,
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +106,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
 | 
			
		|||
	if n > 0 {
 | 
			
		||||
		sl += _Socklen(n) + 1
 | 
			
		||||
	}
 | 
			
		||||
	if sa.raw.Path[0] == '@' {
 | 
			
		||||
	if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) {
 | 
			
		||||
		// Check sl > 3 so we don't change unnamed socket behavior.
 | 
			
		||||
		sa.raw.Path[0] = 0
 | 
			
		||||
		// Don't count trailing NUL for abstract address.
 | 
			
		||||
		sl--
 | 
			
		||||
| 
						 | 
				
			
			@ -292,9 +292,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
 | 
			
		|||
				break
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
 | 
			
		||||
		sa.Name = string(bytes)
 | 
			
		||||
		sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n))
 | 
			
		||||
		return sa, nil
 | 
			
		||||
 | 
			
		||||
	case AF_INET:
 | 
			
		||||
| 
						 | 
				
			
			@ -410,7 +408,8 @@ func (w WaitStatus) CoreDump() bool { return w&0x80 == 0x80 }
 | 
			
		|||
 | 
			
		||||
func (w WaitStatus) TrapCause() int { return -1 }
 | 
			
		||||
 | 
			
		||||
//sys	ioctl(fd int, req uint, arg uintptr) (err error)
 | 
			
		||||
//sys	ioctl(fd int, req int, arg uintptr) (err error)
 | 
			
		||||
//sys	ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) = ioctl
 | 
			
		||||
 | 
			
		||||
// fcntl must never be called with cmd=F_DUP2FD because it doesn't work on AIX
 | 
			
		||||
// There is no way to create a custom fcntl and to keep //sys fcntl easily,
 | 
			
		||||
| 
						 | 
				
			
			@ -488,8 +487,6 @@ func Fsync(fd int) 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
 | 
			
		||||
//sys	writelen(fd int, p *byte, np int) (n int, err error) = write
 | 
			
		||||
 | 
			
		||||
//sys	Dup2(oldfd int, newfd int) (err error)
 | 
			
		||||
//sys	Fadvise(fd int, offset int64, length int64, advice int) (err error) = posix_fadvise64
 | 
			
		||||
| 
						 | 
				
			
			@ -536,21 +533,6 @@ func Fsync(fd int) error {
 | 
			
		|||
//sys	sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = nsendmsg
 | 
			
		||||
 | 
			
		||||
//sys	munmap(addr uintptr, length uintptr) (err error)
 | 
			
		||||
 | 
			
		||||
var mapper = &mmapper{
 | 
			
		||||
	active: make(map[*byte][]byte),
 | 
			
		||||
	mmap:   mmap,
 | 
			
		||||
	munmap: munmap,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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	Madvise(b []byte, advice int) (err error)
 | 
			
		||||
//sys	Mprotect(b []byte, prot int) (err error)
 | 
			
		||||
//sys	Mlock(b []byte) (err error)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,12 +3,10 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build aix && ppc
 | 
			
		||||
// +build aix,ppc
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
//sysnb	Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64
 | 
			
		||||
//sysnb	Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64
 | 
			
		||||
//sys	Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64
 | 
			
		||||
 | 
			
		||||
//sys	mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,12 +3,10 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build aix && ppc64
 | 
			
		||||
// +build aix,ppc64
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
//sysnb	Getrlimit(resource int, rlim *Rlimit) (err error)
 | 
			
		||||
//sysnb	Setrlimit(resource int, rlim *Rlimit) (err error)
 | 
			
		||||
//sys	Seek(fd int, offset int64, whence int) (off int64, err error) = lseek
 | 
			
		||||
 | 
			
		||||
//sys	mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// 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
 | 
			
		||||
// including OS X (Darwin) and FreeBSD.  Like the other
 | 
			
		||||
| 
						 | 
				
			
			@ -245,8 +244,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
 | 
			
		|||
				break
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
 | 
			
		||||
		sa.Name = string(bytes)
 | 
			
		||||
		sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n))
 | 
			
		||||
		return sa, nil
 | 
			
		||||
 | 
			
		||||
	case AF_INET:
 | 
			
		||||
| 
						 | 
				
			
			@ -602,20 +600,6 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
 | 
			
		|||
//	Gethostuuid(uuid *byte, timeout *Timespec) (err error)
 | 
			
		||||
//	Ptrace(req int, pid int, addr uintptr, data int) (ret uintptr, err error)
 | 
			
		||||
 | 
			
		||||
var mapper = &mmapper{
 | 
			
		||||
	active: make(map[*byte][]byte),
 | 
			
		||||
	mmap:   mmap,
 | 
			
		||||
	munmap: munmap,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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	Madvise(b []byte, behav int) (err error)
 | 
			
		||||
//sys	Mlock(b []byte) (err error)
 | 
			
		||||
//sys	Mlockall(flags int) (err error)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,6 @@ package unix
 | 
			
		|||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"syscall"
 | 
			
		||||
	"unsafe"
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -230,6 +229,7 @@ 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) }
 | 
			
		||||
func PtraceDenyAttach() (err error)    { return ptrace(PT_DENY_ATTACH, 0, 0, 0) }
 | 
			
		||||
 | 
			
		||||
//sysnb	pipe(p *[2]int32) (err error)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -375,11 +375,10 @@ func Flistxattr(fd int, dest []byte) (sz int, err error) {
 | 
			
		|||
func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(signum), 1) }
 | 
			
		||||
 | 
			
		||||
//sys	ioctl(fd int, req uint, arg uintptr) (err error)
 | 
			
		||||
//sys	ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
 | 
			
		||||
 | 
			
		||||
func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error {
 | 
			
		||||
	err := ioctl(fd, CTLIOCGINFO, uintptr(unsafe.Pointer(ctlInfo)))
 | 
			
		||||
	runtime.KeepAlive(ctlInfo)
 | 
			
		||||
	return err
 | 
			
		||||
	return ioctlPtr(fd, CTLIOCGINFO, unsafe.Pointer(ctlInfo))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IfreqMTU is struct ifreq used to get or set a network device's MTU.
 | 
			
		||||
| 
						 | 
				
			
			@ -393,16 +392,14 @@ type IfreqMTU struct {
 | 
			
		|||
func IoctlGetIfreqMTU(fd int, ifname string) (*IfreqMTU, error) {
 | 
			
		||||
	var ifreq IfreqMTU
 | 
			
		||||
	copy(ifreq.Name[:], ifname)
 | 
			
		||||
	err := ioctl(fd, SIOCGIFMTU, uintptr(unsafe.Pointer(&ifreq)))
 | 
			
		||||
	err := ioctlPtr(fd, SIOCGIFMTU, 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
 | 
			
		||||
	return ioctlPtr(fd, SIOCSIFMTU, unsafe.Pointer(ifreq))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL
 | 
			
		||||
| 
						 | 
				
			
			@ -513,6 +510,7 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
 | 
			
		|||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for {
 | 
			
		||||
		// Find size.
 | 
			
		||||
		n := uintptr(0)
 | 
			
		||||
		if err := sysctl(mib, nil, &n, nil, 0); err != nil {
 | 
			
		||||
| 
						 | 
				
			
			@ -528,6 +526,10 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
 | 
			
		|||
		// 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 {
 | 
			
		||||
			if err == ENOMEM {
 | 
			
		||||
				// Process table grew. Try again.
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
		if n%SizeofKinfoProc != 0 {
 | 
			
		||||
| 
						 | 
				
			
			@ -538,6 +540,7 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
 | 
			
		|||
		// 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)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -616,6 +619,7 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
 | 
			
		|||
//sys	Rmdir(path string) (err error)
 | 
			
		||||
//sys	Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
 | 
			
		||||
//sys	Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
 | 
			
		||||
//sys	Setattrlist(path string, attrlist *Attrlist, attrBuf []byte, options int) (err error)
 | 
			
		||||
//sys	Setegid(egid int) (err error)
 | 
			
		||||
//sysnb	Seteuid(euid int) (err error)
 | 
			
		||||
//sysnb	Setgid(gid int) (err error)
 | 
			
		||||
| 
						 | 
				
			
			@ -625,7 +629,6 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
 | 
			
		|||
//sys	Setprivexec(flag int) (err error)
 | 
			
		||||
//sysnb	Setregid(rgid int, egid int) (err error)
 | 
			
		||||
//sysnb	Setreuid(ruid int, euid int) (err error)
 | 
			
		||||
//sysnb	Setrlimit(which int, lim *Rlimit) (err error)
 | 
			
		||||
//sysnb	Setsid() (pid int, err error)
 | 
			
		||||
//sysnb	Settimeofday(tp *Timeval) (err error)
 | 
			
		||||
//sysnb	Setuid(uid int) (err error)
 | 
			
		||||
| 
						 | 
				
			
			@ -641,190 +644,3 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, 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	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
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Unimplemented
 | 
			
		||||
 */
 | 
			
		||||
// Profil
 | 
			
		||||
// Sigaction
 | 
			
		||||
// Sigprocmask
 | 
			
		||||
// Getlogin
 | 
			
		||||
// Sigpending
 | 
			
		||||
// Sigaltstack
 | 
			
		||||
// Ioctl
 | 
			
		||||
// Reboot
 | 
			
		||||
// Execve
 | 
			
		||||
// Vfork
 | 
			
		||||
// Sbrk
 | 
			
		||||
// Sstk
 | 
			
		||||
// Ovadvise
 | 
			
		||||
// Mincore
 | 
			
		||||
// Setitimer
 | 
			
		||||
// Swapon
 | 
			
		||||
// Select
 | 
			
		||||
// Sigsuspend
 | 
			
		||||
// Readv
 | 
			
		||||
// Writev
 | 
			
		||||
// Nfssvc
 | 
			
		||||
// Getfh
 | 
			
		||||
// Quotactl
 | 
			
		||||
// Csops
 | 
			
		||||
// Waitid
 | 
			
		||||
// Add_profil
 | 
			
		||||
// Kdebug_trace
 | 
			
		||||
// Sigreturn
 | 
			
		||||
// Atsocket
 | 
			
		||||
// Kqueue_from_portset_np
 | 
			
		||||
// Kqueue_portset
 | 
			
		||||
// Getattrlist
 | 
			
		||||
// Setattrlist
 | 
			
		||||
// Getdirentriesattr
 | 
			
		||||
// Searchfs
 | 
			
		||||
// Delete
 | 
			
		||||
// Copyfile
 | 
			
		||||
// Watchevent
 | 
			
		||||
// Waitevent
 | 
			
		||||
// Modwatch
 | 
			
		||||
// Fsctl
 | 
			
		||||
// Initgroups
 | 
			
		||||
// Posix_spawn
 | 
			
		||||
// Nfsclnt
 | 
			
		||||
// Fhopen
 | 
			
		||||
// Minherit
 | 
			
		||||
// Semsys
 | 
			
		||||
// Msgsys
 | 
			
		||||
// Shmsys
 | 
			
		||||
// Semctl
 | 
			
		||||
// Semget
 | 
			
		||||
// Semop
 | 
			
		||||
// Msgctl
 | 
			
		||||
// Msgget
 | 
			
		||||
// Msgsnd
 | 
			
		||||
// Msgrcv
 | 
			
		||||
// Shm_open
 | 
			
		||||
// Shm_unlink
 | 
			
		||||
// Sem_open
 | 
			
		||||
// Sem_close
 | 
			
		||||
// Sem_unlink
 | 
			
		||||
// Sem_wait
 | 
			
		||||
// Sem_trywait
 | 
			
		||||
// Sem_post
 | 
			
		||||
// Sem_getvalue
 | 
			
		||||
// Sem_init
 | 
			
		||||
// Sem_destroy
 | 
			
		||||
// Open_extended
 | 
			
		||||
// Umask_extended
 | 
			
		||||
// Stat_extended
 | 
			
		||||
// Lstat_extended
 | 
			
		||||
// Fstat_extended
 | 
			
		||||
// Chmod_extended
 | 
			
		||||
// Fchmod_extended
 | 
			
		||||
// Access_extended
 | 
			
		||||
// Settid
 | 
			
		||||
// Gettid
 | 
			
		||||
// Setsgroups
 | 
			
		||||
// Getsgroups
 | 
			
		||||
// Setwgroups
 | 
			
		||||
// Getwgroups
 | 
			
		||||
// Mkfifo_extended
 | 
			
		||||
// Mkdir_extended
 | 
			
		||||
// Identitysvc
 | 
			
		||||
// Shared_region_check_np
 | 
			
		||||
// Shared_region_map_np
 | 
			
		||||
// __pthread_mutex_destroy
 | 
			
		||||
// __pthread_mutex_init
 | 
			
		||||
// __pthread_mutex_lock
 | 
			
		||||
// __pthread_mutex_trylock
 | 
			
		||||
// __pthread_mutex_unlock
 | 
			
		||||
// __pthread_cond_init
 | 
			
		||||
// __pthread_cond_destroy
 | 
			
		||||
// __pthread_cond_broadcast
 | 
			
		||||
// __pthread_cond_signal
 | 
			
		||||
// Setsid_with_pid
 | 
			
		||||
// __pthread_cond_timedwait
 | 
			
		||||
// Aio_fsync
 | 
			
		||||
// Aio_return
 | 
			
		||||
// Aio_suspend
 | 
			
		||||
// Aio_cancel
 | 
			
		||||
// Aio_error
 | 
			
		||||
// Aio_read
 | 
			
		||||
// Aio_write
 | 
			
		||||
// Lio_listio
 | 
			
		||||
// __pthread_cond_wait
 | 
			
		||||
// Iopolicysys
 | 
			
		||||
// __pthread_kill
 | 
			
		||||
// __pthread_sigmask
 | 
			
		||||
// __sigwait
 | 
			
		||||
// __disable_threadsignal
 | 
			
		||||
// __pthread_markcancel
 | 
			
		||||
// __pthread_canceled
 | 
			
		||||
// __semwait_signal
 | 
			
		||||
// Proc_info
 | 
			
		||||
// sendfile
 | 
			
		||||
// Stat64_extended
 | 
			
		||||
// Lstat64_extended
 | 
			
		||||
// Fstat64_extended
 | 
			
		||||
// __pthread_chdir
 | 
			
		||||
// __pthread_fchdir
 | 
			
		||||
// Audit
 | 
			
		||||
// Auditon
 | 
			
		||||
// Getauid
 | 
			
		||||
// Setauid
 | 
			
		||||
// Getaudit
 | 
			
		||||
// Setaudit
 | 
			
		||||
// Getaudit_addr
 | 
			
		||||
// Setaudit_addr
 | 
			
		||||
// Auditctl
 | 
			
		||||
// Bsdthread_create
 | 
			
		||||
// Bsdthread_terminate
 | 
			
		||||
// Stack_snapshot
 | 
			
		||||
// Bsdthread_register
 | 
			
		||||
// Workq_open
 | 
			
		||||
// Workq_ops
 | 
			
		||||
// __mac_execve
 | 
			
		||||
// __mac_syscall
 | 
			
		||||
// __mac_get_file
 | 
			
		||||
// __mac_set_file
 | 
			
		||||
// __mac_get_link
 | 
			
		||||
// __mac_set_link
 | 
			
		||||
// __mac_get_proc
 | 
			
		||||
// __mac_set_proc
 | 
			
		||||
// __mac_get_fd
 | 
			
		||||
// __mac_set_fd
 | 
			
		||||
// __mac_get_pid
 | 
			
		||||
// __mac_get_lcid
 | 
			
		||||
// __mac_get_lctx
 | 
			
		||||
// __mac_set_lctx
 | 
			
		||||
// Setlcid
 | 
			
		||||
// Read_nocancel
 | 
			
		||||
// Write_nocancel
 | 
			
		||||
// Open_nocancel
 | 
			
		||||
// Close_nocancel
 | 
			
		||||
// Wait4_nocancel
 | 
			
		||||
// Recvmsg_nocancel
 | 
			
		||||
// Sendmsg_nocancel
 | 
			
		||||
// Recvfrom_nocancel
 | 
			
		||||
// Accept_nocancel
 | 
			
		||||
// Fcntl_nocancel
 | 
			
		||||
// Select_nocancel
 | 
			
		||||
// Fsync_nocancel
 | 
			
		||||
// Connect_nocancel
 | 
			
		||||
// Sigsuspend_nocancel
 | 
			
		||||
// Readv_nocancel
 | 
			
		||||
// Writev_nocancel
 | 
			
		||||
// Sendto_nocancel
 | 
			
		||||
// Pread_nocancel
 | 
			
		||||
// Pwrite_nocancel
 | 
			
		||||
// Waitid_nocancel
 | 
			
		||||
// Poll_nocancel
 | 
			
		||||
// Msgsnd_nocancel
 | 
			
		||||
// Msgrcv_nocancel
 | 
			
		||||
// Sem_wait_nocancel
 | 
			
		||||
// Aio_suspend_nocancel
 | 
			
		||||
// __sigwait_nocancel
 | 
			
		||||
// __semwait_signal_nocancel
 | 
			
		||||
// __mac_mount
 | 
			
		||||
// __mac_get_mount
 | 
			
		||||
// __mac_getfsstat
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build amd64 && darwin
 | 
			
		||||
// +build amd64,darwin
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build arm64 && darwin
 | 
			
		||||
// +build arm64,darwin
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build darwin && go1.12
 | 
			
		||||
// +build darwin,go1.12
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -172,6 +172,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
//sys	ioctl(fd int, req uint, arg uintptr) (err error)
 | 
			
		||||
//sys	ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
 | 
			
		||||
 | 
			
		||||
//sys	sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -325,7 +326,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 | 
			
		|||
//sysnb	Setreuid(ruid int, euid int) (err error)
 | 
			
		||||
//sysnb	Setresgid(rgid int, egid int, sgid int) (err error)
 | 
			
		||||
//sysnb	Setresuid(ruid int, euid int, suid int) (err error)
 | 
			
		||||
//sysnb	Setrlimit(which int, lim *Rlimit) (err error)
 | 
			
		||||
//sysnb	Setsid() (pid int, err error)
 | 
			
		||||
//sysnb	Settimeofday(tp *Timeval) (err error)
 | 
			
		||||
//sysnb	Setuid(uid int) (err error)
 | 
			
		||||
| 
						 | 
				
			
			@ -343,203 +343,5 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 | 
			
		|||
//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	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)
 | 
			
		||||
//sys	utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Unimplemented
 | 
			
		||||
 * TODO(jsing): Update this list for DragonFly.
 | 
			
		||||
 */
 | 
			
		||||
// Profil
 | 
			
		||||
// Sigaction
 | 
			
		||||
// Sigprocmask
 | 
			
		||||
// Getlogin
 | 
			
		||||
// Sigpending
 | 
			
		||||
// Sigaltstack
 | 
			
		||||
// Reboot
 | 
			
		||||
// Execve
 | 
			
		||||
// Vfork
 | 
			
		||||
// Sbrk
 | 
			
		||||
// Sstk
 | 
			
		||||
// Ovadvise
 | 
			
		||||
// Mincore
 | 
			
		||||
// Setitimer
 | 
			
		||||
// Swapon
 | 
			
		||||
// Select
 | 
			
		||||
// Sigsuspend
 | 
			
		||||
// Readv
 | 
			
		||||
// Writev
 | 
			
		||||
// Nfssvc
 | 
			
		||||
// Getfh
 | 
			
		||||
// Quotactl
 | 
			
		||||
// Mount
 | 
			
		||||
// Csops
 | 
			
		||||
// Waitid
 | 
			
		||||
// Add_profil
 | 
			
		||||
// Kdebug_trace
 | 
			
		||||
// Sigreturn
 | 
			
		||||
// Atsocket
 | 
			
		||||
// Kqueue_from_portset_np
 | 
			
		||||
// Kqueue_portset
 | 
			
		||||
// Getattrlist
 | 
			
		||||
// Setattrlist
 | 
			
		||||
// Getdirentriesattr
 | 
			
		||||
// Searchfs
 | 
			
		||||
// Delete
 | 
			
		||||
// Copyfile
 | 
			
		||||
// Watchevent
 | 
			
		||||
// Waitevent
 | 
			
		||||
// Modwatch
 | 
			
		||||
// Getxattr
 | 
			
		||||
// Fgetxattr
 | 
			
		||||
// Setxattr
 | 
			
		||||
// Fsetxattr
 | 
			
		||||
// Removexattr
 | 
			
		||||
// Fremovexattr
 | 
			
		||||
// Listxattr
 | 
			
		||||
// Flistxattr
 | 
			
		||||
// Fsctl
 | 
			
		||||
// Initgroups
 | 
			
		||||
// Posix_spawn
 | 
			
		||||
// Nfsclnt
 | 
			
		||||
// Fhopen
 | 
			
		||||
// Minherit
 | 
			
		||||
// Semsys
 | 
			
		||||
// Msgsys
 | 
			
		||||
// Shmsys
 | 
			
		||||
// Semctl
 | 
			
		||||
// Semget
 | 
			
		||||
// Semop
 | 
			
		||||
// Msgctl
 | 
			
		||||
// Msgget
 | 
			
		||||
// Msgsnd
 | 
			
		||||
// Msgrcv
 | 
			
		||||
// Shmat
 | 
			
		||||
// Shmctl
 | 
			
		||||
// Shmdt
 | 
			
		||||
// Shmget
 | 
			
		||||
// Shm_open
 | 
			
		||||
// Shm_unlink
 | 
			
		||||
// Sem_open
 | 
			
		||||
// Sem_close
 | 
			
		||||
// Sem_unlink
 | 
			
		||||
// Sem_wait
 | 
			
		||||
// Sem_trywait
 | 
			
		||||
// Sem_post
 | 
			
		||||
// Sem_getvalue
 | 
			
		||||
// Sem_init
 | 
			
		||||
// Sem_destroy
 | 
			
		||||
// Open_extended
 | 
			
		||||
// Umask_extended
 | 
			
		||||
// Stat_extended
 | 
			
		||||
// Lstat_extended
 | 
			
		||||
// Fstat_extended
 | 
			
		||||
// Chmod_extended
 | 
			
		||||
// Fchmod_extended
 | 
			
		||||
// Access_extended
 | 
			
		||||
// Settid
 | 
			
		||||
// Gettid
 | 
			
		||||
// Setsgroups
 | 
			
		||||
// Getsgroups
 | 
			
		||||
// Setwgroups
 | 
			
		||||
// Getwgroups
 | 
			
		||||
// Mkfifo_extended
 | 
			
		||||
// Mkdir_extended
 | 
			
		||||
// Identitysvc
 | 
			
		||||
// Shared_region_check_np
 | 
			
		||||
// Shared_region_map_np
 | 
			
		||||
// __pthread_mutex_destroy
 | 
			
		||||
// __pthread_mutex_init
 | 
			
		||||
// __pthread_mutex_lock
 | 
			
		||||
// __pthread_mutex_trylock
 | 
			
		||||
// __pthread_mutex_unlock
 | 
			
		||||
// __pthread_cond_init
 | 
			
		||||
// __pthread_cond_destroy
 | 
			
		||||
// __pthread_cond_broadcast
 | 
			
		||||
// __pthread_cond_signal
 | 
			
		||||
// Setsid_with_pid
 | 
			
		||||
// __pthread_cond_timedwait
 | 
			
		||||
// Aio_fsync
 | 
			
		||||
// Aio_return
 | 
			
		||||
// Aio_suspend
 | 
			
		||||
// Aio_cancel
 | 
			
		||||
// Aio_error
 | 
			
		||||
// Aio_read
 | 
			
		||||
// Aio_write
 | 
			
		||||
// Lio_listio
 | 
			
		||||
// __pthread_cond_wait
 | 
			
		||||
// Iopolicysys
 | 
			
		||||
// __pthread_kill
 | 
			
		||||
// __pthread_sigmask
 | 
			
		||||
// __sigwait
 | 
			
		||||
// __disable_threadsignal
 | 
			
		||||
// __pthread_markcancel
 | 
			
		||||
// __pthread_canceled
 | 
			
		||||
// __semwait_signal
 | 
			
		||||
// Proc_info
 | 
			
		||||
// Stat64_extended
 | 
			
		||||
// Lstat64_extended
 | 
			
		||||
// Fstat64_extended
 | 
			
		||||
// __pthread_chdir
 | 
			
		||||
// __pthread_fchdir
 | 
			
		||||
// Audit
 | 
			
		||||
// Auditon
 | 
			
		||||
// Getauid
 | 
			
		||||
// Setauid
 | 
			
		||||
// Getaudit
 | 
			
		||||
// Setaudit
 | 
			
		||||
// Getaudit_addr
 | 
			
		||||
// Setaudit_addr
 | 
			
		||||
// Auditctl
 | 
			
		||||
// Bsdthread_create
 | 
			
		||||
// Bsdthread_terminate
 | 
			
		||||
// Stack_snapshot
 | 
			
		||||
// Bsdthread_register
 | 
			
		||||
// Workq_open
 | 
			
		||||
// Workq_ops
 | 
			
		||||
// __mac_execve
 | 
			
		||||
// __mac_syscall
 | 
			
		||||
// __mac_get_file
 | 
			
		||||
// __mac_set_file
 | 
			
		||||
// __mac_get_link
 | 
			
		||||
// __mac_set_link
 | 
			
		||||
// __mac_get_proc
 | 
			
		||||
// __mac_set_proc
 | 
			
		||||
// __mac_get_fd
 | 
			
		||||
// __mac_set_fd
 | 
			
		||||
// __mac_get_pid
 | 
			
		||||
// __mac_get_lcid
 | 
			
		||||
// __mac_get_lctx
 | 
			
		||||
// __mac_set_lctx
 | 
			
		||||
// Setlcid
 | 
			
		||||
// Read_nocancel
 | 
			
		||||
// Write_nocancel
 | 
			
		||||
// Open_nocancel
 | 
			
		||||
// Close_nocancel
 | 
			
		||||
// Wait4_nocancel
 | 
			
		||||
// Recvmsg_nocancel
 | 
			
		||||
// Sendmsg_nocancel
 | 
			
		||||
// Recvfrom_nocancel
 | 
			
		||||
// Accept_nocancel
 | 
			
		||||
// Fcntl_nocancel
 | 
			
		||||
// Select_nocancel
 | 
			
		||||
// Fsync_nocancel
 | 
			
		||||
// Connect_nocancel
 | 
			
		||||
// Sigsuspend_nocancel
 | 
			
		||||
// Readv_nocancel
 | 
			
		||||
// Writev_nocancel
 | 
			
		||||
// Sendto_nocancel
 | 
			
		||||
// Pread_nocancel
 | 
			
		||||
// Pwrite_nocancel
 | 
			
		||||
// Waitid_nocancel
 | 
			
		||||
// Msgsnd_nocancel
 | 
			
		||||
// Msgrcv_nocancel
 | 
			
		||||
// Sem_wait_nocancel
 | 
			
		||||
// Aio_suspend_nocancel
 | 
			
		||||
// __sigwait_nocancel
 | 
			
		||||
// __semwait_signal_nocancel
 | 
			
		||||
// __mac_mount
 | 
			
		||||
// __mac_get_mount
 | 
			
		||||
// __mac_getfsstat
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build amd64 && dragonfly
 | 
			
		||||
// +build amd64,dragonfly
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -161,7 +161,8 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
 | 
			
		|||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	ioctl(fd int, req uint, arg uintptr) (err error)
 | 
			
		||||
//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
 | 
			
		||||
 | 
			
		||||
//sys	sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -253,6 +254,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
//sys	ptrace(request int, pid int, addr uintptr, data int) (err error)
 | 
			
		||||
//sys	ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) = SYS_PTRACE
 | 
			
		||||
 | 
			
		||||
func PtraceAttach(pid int) (err error) {
 | 
			
		||||
	return ptrace(PT_ATTACH, pid, 0, 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -267,19 +269,36 @@ func PtraceDetach(pid int) (err error) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func PtraceGetFpRegs(pid int, fpregsout *FpReg) (err error) {
 | 
			
		||||
	return ptrace(PT_GETFPREGS, pid, uintptr(unsafe.Pointer(fpregsout)), 0)
 | 
			
		||||
	return ptracePtr(PT_GETFPREGS, pid, unsafe.Pointer(fpregsout), 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func PtraceGetRegs(pid int, regsout *Reg) (err error) {
 | 
			
		||||
	return ptrace(PT_GETREGS, pid, uintptr(unsafe.Pointer(regsout)), 0)
 | 
			
		||||
	return ptracePtr(PT_GETREGS, pid, unsafe.Pointer(regsout), 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) {
 | 
			
		||||
	ioDesc := PtraceIoDesc{
 | 
			
		||||
		Op:   int32(req),
 | 
			
		||||
		Offs: offs,
 | 
			
		||||
	}
 | 
			
		||||
	if countin > 0 {
 | 
			
		||||
		_ = out[:countin] // check bounds
 | 
			
		||||
		ioDesc.Addr = &out[0]
 | 
			
		||||
	} else if out != nil {
 | 
			
		||||
		ioDesc.Addr = (*byte)(unsafe.Pointer(&_zero))
 | 
			
		||||
	}
 | 
			
		||||
	ioDesc.SetLen(countin)
 | 
			
		||||
 | 
			
		||||
	err = ptracePtr(PT_IO, pid, unsafe.Pointer(&ioDesc), 0)
 | 
			
		||||
	return int(ioDesc.Len), err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func PtraceLwpEvents(pid int, enable int) (err error) {
 | 
			
		||||
	return ptrace(PT_LWP_EVENTS, pid, 0, enable)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func PtraceLwpInfo(pid int, info uintptr) (err error) {
 | 
			
		||||
	return ptrace(PT_LWPINFO, pid, info, int(unsafe.Sizeof(PtraceLwpInfoStruct{})))
 | 
			
		||||
func PtraceLwpInfo(pid int, info *PtraceLwpInfoStruct) (err error) {
 | 
			
		||||
	return ptracePtr(PT_LWPINFO, pid, unsafe.Pointer(info), int(unsafe.Sizeof(*info)))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) {
 | 
			
		||||
| 
						 | 
				
			
			@ -299,13 +318,25 @@ func PtracePokeText(pid int, addr uintptr, data []byte) (count int, err error) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func PtraceSetRegs(pid int, regs *Reg) (err error) {
 | 
			
		||||
	return ptrace(PT_SETREGS, pid, uintptr(unsafe.Pointer(regs)), 0)
 | 
			
		||||
	return ptracePtr(PT_SETREGS, pid, unsafe.Pointer(regs), 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func PtraceSingleStep(pid int) (err error) {
 | 
			
		||||
	return ptrace(PT_STEP, pid, 1, 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Dup3(oldfd, newfd, flags int) error {
 | 
			
		||||
	if oldfd == newfd || flags&^O_CLOEXEC != 0 {
 | 
			
		||||
		return EINVAL
 | 
			
		||||
	}
 | 
			
		||||
	how := F_DUP2FD
 | 
			
		||||
	if flags&O_CLOEXEC != 0 {
 | 
			
		||||
		how = F_DUP2FD_CLOEXEC
 | 
			
		||||
	}
 | 
			
		||||
	_, err := fcntl(oldfd, how, newfd)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Exposed directly
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			@ -402,7 +433,6 @@ func PtraceSingleStep(pid int) (err error) {
 | 
			
		|||
//sysnb	Setreuid(ruid int, euid int) (err error)
 | 
			
		||||
//sysnb	Setresgid(rgid int, egid int, sgid int) (err error)
 | 
			
		||||
//sysnb	Setresuid(ruid int, euid int, suid int) (err error)
 | 
			
		||||
//sysnb	Setrlimit(which int, lim *Rlimit) (err error)
 | 
			
		||||
//sysnb	Setsid() (pid int, err error)
 | 
			
		||||
//sysnb	Settimeofday(tp *Timeval) (err error)
 | 
			
		||||
//sysnb	Setuid(uid int) (err error)
 | 
			
		||||
| 
						 | 
				
			
			@ -419,197 +449,5 @@ func PtraceSingleStep(pid 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	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)
 | 
			
		||||
//sys	utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Unimplemented
 | 
			
		||||
 */
 | 
			
		||||
// Profil
 | 
			
		||||
// Sigaction
 | 
			
		||||
// Sigprocmask
 | 
			
		||||
// Getlogin
 | 
			
		||||
// Sigpending
 | 
			
		||||
// Sigaltstack
 | 
			
		||||
// Ioctl
 | 
			
		||||
// Reboot
 | 
			
		||||
// Execve
 | 
			
		||||
// Vfork
 | 
			
		||||
// Sbrk
 | 
			
		||||
// Sstk
 | 
			
		||||
// Ovadvise
 | 
			
		||||
// Mincore
 | 
			
		||||
// Setitimer
 | 
			
		||||
// Swapon
 | 
			
		||||
// Select
 | 
			
		||||
// Sigsuspend
 | 
			
		||||
// Readv
 | 
			
		||||
// Writev
 | 
			
		||||
// Nfssvc
 | 
			
		||||
// Getfh
 | 
			
		||||
// Quotactl
 | 
			
		||||
// Mount
 | 
			
		||||
// Csops
 | 
			
		||||
// Waitid
 | 
			
		||||
// Add_profil
 | 
			
		||||
// Kdebug_trace
 | 
			
		||||
// Sigreturn
 | 
			
		||||
// Atsocket
 | 
			
		||||
// Kqueue_from_portset_np
 | 
			
		||||
// Kqueue_portset
 | 
			
		||||
// Getattrlist
 | 
			
		||||
// Setattrlist
 | 
			
		||||
// Getdents
 | 
			
		||||
// Getdirentriesattr
 | 
			
		||||
// Searchfs
 | 
			
		||||
// Delete
 | 
			
		||||
// Copyfile
 | 
			
		||||
// Watchevent
 | 
			
		||||
// Waitevent
 | 
			
		||||
// Modwatch
 | 
			
		||||
// Fsctl
 | 
			
		||||
// Initgroups
 | 
			
		||||
// Posix_spawn
 | 
			
		||||
// Nfsclnt
 | 
			
		||||
// Fhopen
 | 
			
		||||
// Minherit
 | 
			
		||||
// Semsys
 | 
			
		||||
// Msgsys
 | 
			
		||||
// Shmsys
 | 
			
		||||
// Semctl
 | 
			
		||||
// Semget
 | 
			
		||||
// Semop
 | 
			
		||||
// Msgctl
 | 
			
		||||
// Msgget
 | 
			
		||||
// Msgsnd
 | 
			
		||||
// Msgrcv
 | 
			
		||||
// Shmat
 | 
			
		||||
// Shmctl
 | 
			
		||||
// Shmdt
 | 
			
		||||
// Shmget
 | 
			
		||||
// Shm_open
 | 
			
		||||
// Shm_unlink
 | 
			
		||||
// Sem_open
 | 
			
		||||
// Sem_close
 | 
			
		||||
// Sem_unlink
 | 
			
		||||
// Sem_wait
 | 
			
		||||
// Sem_trywait
 | 
			
		||||
// Sem_post
 | 
			
		||||
// Sem_getvalue
 | 
			
		||||
// Sem_init
 | 
			
		||||
// Sem_destroy
 | 
			
		||||
// Open_extended
 | 
			
		||||
// Umask_extended
 | 
			
		||||
// Stat_extended
 | 
			
		||||
// Lstat_extended
 | 
			
		||||
// Fstat_extended
 | 
			
		||||
// Chmod_extended
 | 
			
		||||
// Fchmod_extended
 | 
			
		||||
// Access_extended
 | 
			
		||||
// Settid
 | 
			
		||||
// Gettid
 | 
			
		||||
// Setsgroups
 | 
			
		||||
// Getsgroups
 | 
			
		||||
// Setwgroups
 | 
			
		||||
// Getwgroups
 | 
			
		||||
// Mkfifo_extended
 | 
			
		||||
// Mkdir_extended
 | 
			
		||||
// Identitysvc
 | 
			
		||||
// Shared_region_check_np
 | 
			
		||||
// Shared_region_map_np
 | 
			
		||||
// __pthread_mutex_destroy
 | 
			
		||||
// __pthread_mutex_init
 | 
			
		||||
// __pthread_mutex_lock
 | 
			
		||||
// __pthread_mutex_trylock
 | 
			
		||||
// __pthread_mutex_unlock
 | 
			
		||||
// __pthread_cond_init
 | 
			
		||||
// __pthread_cond_destroy
 | 
			
		||||
// __pthread_cond_broadcast
 | 
			
		||||
// __pthread_cond_signal
 | 
			
		||||
// Setsid_with_pid
 | 
			
		||||
// __pthread_cond_timedwait
 | 
			
		||||
// Aio_fsync
 | 
			
		||||
// Aio_return
 | 
			
		||||
// Aio_suspend
 | 
			
		||||
// Aio_cancel
 | 
			
		||||
// Aio_error
 | 
			
		||||
// Aio_read
 | 
			
		||||
// Aio_write
 | 
			
		||||
// Lio_listio
 | 
			
		||||
// __pthread_cond_wait
 | 
			
		||||
// Iopolicysys
 | 
			
		||||
// __pthread_kill
 | 
			
		||||
// __pthread_sigmask
 | 
			
		||||
// __sigwait
 | 
			
		||||
// __disable_threadsignal
 | 
			
		||||
// __pthread_markcancel
 | 
			
		||||
// __pthread_canceled
 | 
			
		||||
// __semwait_signal
 | 
			
		||||
// Proc_info
 | 
			
		||||
// Stat64_extended
 | 
			
		||||
// Lstat64_extended
 | 
			
		||||
// Fstat64_extended
 | 
			
		||||
// __pthread_chdir
 | 
			
		||||
// __pthread_fchdir
 | 
			
		||||
// Audit
 | 
			
		||||
// Auditon
 | 
			
		||||
// Getauid
 | 
			
		||||
// Setauid
 | 
			
		||||
// Getaudit
 | 
			
		||||
// Setaudit
 | 
			
		||||
// Getaudit_addr
 | 
			
		||||
// Setaudit_addr
 | 
			
		||||
// Auditctl
 | 
			
		||||
// Bsdthread_create
 | 
			
		||||
// Bsdthread_terminate
 | 
			
		||||
// Stack_snapshot
 | 
			
		||||
// Bsdthread_register
 | 
			
		||||
// Workq_open
 | 
			
		||||
// Workq_ops
 | 
			
		||||
// __mac_execve
 | 
			
		||||
// __mac_syscall
 | 
			
		||||
// __mac_get_file
 | 
			
		||||
// __mac_set_file
 | 
			
		||||
// __mac_get_link
 | 
			
		||||
// __mac_set_link
 | 
			
		||||
// __mac_get_proc
 | 
			
		||||
// __mac_set_proc
 | 
			
		||||
// __mac_get_fd
 | 
			
		||||
// __mac_set_fd
 | 
			
		||||
// __mac_get_pid
 | 
			
		||||
// __mac_get_lcid
 | 
			
		||||
// __mac_get_lctx
 | 
			
		||||
// __mac_set_lctx
 | 
			
		||||
// Setlcid
 | 
			
		||||
// Read_nocancel
 | 
			
		||||
// Write_nocancel
 | 
			
		||||
// Open_nocancel
 | 
			
		||||
// Close_nocancel
 | 
			
		||||
// Wait4_nocancel
 | 
			
		||||
// Recvmsg_nocancel
 | 
			
		||||
// Sendmsg_nocancel
 | 
			
		||||
// Recvfrom_nocancel
 | 
			
		||||
// Accept_nocancel
 | 
			
		||||
// Fcntl_nocancel
 | 
			
		||||
// Select_nocancel
 | 
			
		||||
// Fsync_nocancel
 | 
			
		||||
// Connect_nocancel
 | 
			
		||||
// Sigsuspend_nocancel
 | 
			
		||||
// Readv_nocancel
 | 
			
		||||
// Writev_nocancel
 | 
			
		||||
// Sendto_nocancel
 | 
			
		||||
// Pread_nocancel
 | 
			
		||||
// Pwrite_nocancel
 | 
			
		||||
// Waitid_nocancel
 | 
			
		||||
// Poll_nocancel
 | 
			
		||||
// Msgsnd_nocancel
 | 
			
		||||
// Msgrcv_nocancel
 | 
			
		||||
// Sem_wait_nocancel
 | 
			
		||||
// Aio_suspend_nocancel
 | 
			
		||||
// __sigwait_nocancel
 | 
			
		||||
// __semwait_signal_nocancel
 | 
			
		||||
// __mac_mount
 | 
			
		||||
// __mac_get_mount
 | 
			
		||||
// __mac_getfsstat
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build 386 && freebsd
 | 
			
		||||
// +build 386,freebsd
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -42,6 +41,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 | 
			
		|||
	cmsg.Len = uint32(length)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (d *PtraceIoDesc) SetLen(length int) {
 | 
			
		||||
	d.Len = uint32(length)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 | 
			
		||||
	var writtenOut uint64 = 0
 | 
			
		||||
	_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -57,11 +60,5 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 | 
			
		|||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 | 
			
		||||
 | 
			
		||||
func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
 | 
			
		||||
	return ptrace(PT_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
 | 
			
		||||
	ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint32(countin)}
 | 
			
		||||
	err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
 | 
			
		||||
	return int(ioDesc.Len), err
 | 
			
		||||
	return ptracePtr(PT_GETFSBASE, pid, unsafe.Pointer(fsbase), 0)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build amd64 && freebsd
 | 
			
		||||
// +build amd64,freebsd
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -42,6 +41,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 | 
			
		|||
	cmsg.Len = uint32(length)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (d *PtraceIoDesc) SetLen(length int) {
 | 
			
		||||
	d.Len = uint64(length)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 | 
			
		||||
	var writtenOut uint64 = 0
 | 
			
		||||
	_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -57,11 +60,5 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 | 
			
		|||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 | 
			
		||||
 | 
			
		||||
func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
 | 
			
		||||
	return ptrace(PT_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
 | 
			
		||||
	ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint64(countin)}
 | 
			
		||||
	err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
 | 
			
		||||
	return int(ioDesc.Len), err
 | 
			
		||||
	return ptracePtr(PT_GETFSBASE, pid, unsafe.Pointer(fsbase), 0)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build arm && freebsd
 | 
			
		||||
// +build arm,freebsd
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -42,6 +41,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 | 
			
		|||
	cmsg.Len = uint32(length)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (d *PtraceIoDesc) SetLen(length int) {
 | 
			
		||||
	d.Len = uint32(length)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 | 
			
		||||
	var writtenOut uint64 = 0
 | 
			
		||||
	_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -55,9 +58,3 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 | 
			
		||||
 | 
			
		||||
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
 | 
			
		||||
	ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint32(countin)}
 | 
			
		||||
	err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
 | 
			
		||||
	return int(ioDesc.Len), err
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build arm64 && freebsd
 | 
			
		||||
// +build arm64,freebsd
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -42,6 +41,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 | 
			
		|||
	cmsg.Len = uint32(length)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (d *PtraceIoDesc) SetLen(length int) {
 | 
			
		||||
	d.Len = uint64(length)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 | 
			
		||||
	var writtenOut uint64 = 0
 | 
			
		||||
	_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -55,9 +58,3 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 | 
			
		||||
 | 
			
		||||
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
 | 
			
		||||
	ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint64(countin)}
 | 
			
		||||
	err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
 | 
			
		||||
	return int(ioDesc.Len), err
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build riscv64 && freebsd
 | 
			
		||||
// +build riscv64,freebsd
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -42,6 +41,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 | 
			
		|||
	cmsg.Len = uint32(length)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (d *PtraceIoDesc) SetLen(length int) {
 | 
			
		||||
	d.Len = uint64(length)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 | 
			
		||||
	var writtenOut uint64 = 0
 | 
			
		||||
	_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -55,9 +58,3 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 | 
			
		||||
 | 
			
		||||
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
 | 
			
		||||
	ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint64(countin)}
 | 
			
		||||
	err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
 | 
			
		||||
	return int(ioDesc.Len), err
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build hurd
 | 
			
		||||
// +build hurd
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -20,3 +19,11 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
 | 
			
		|||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
 | 
			
		||||
	r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(uintptr(arg)))
 | 
			
		||||
	if r0 == -1 && er != nil {
 | 
			
		||||
		err = er
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build 386 && hurd
 | 
			
		||||
// +build 386,hurd
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,6 @@
 | 
			
		|||
// illumos system calls not present on Solaris.
 | 
			
		||||
 | 
			
		||||
//go:build amd64 && illumos
 | 
			
		||||
// +build amd64,illumos
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -417,7 +417,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
 | 
			
		|||
	if n > 0 {
 | 
			
		||||
		sl += _Socklen(n) + 1
 | 
			
		||||
	}
 | 
			
		||||
	if sa.raw.Path[0] == '@' {
 | 
			
		||||
	if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) {
 | 
			
		||||
		// Check sl > 3 so we don't change unnamed socket behavior.
 | 
			
		||||
		sa.raw.Path[0] = 0
 | 
			
		||||
		// Don't count trailing NUL for abstract address.
 | 
			
		||||
		sl--
 | 
			
		||||
| 
						 | 
				
			
			@ -693,10 +694,10 @@ type SockaddrALG struct {
 | 
			
		|||
 | 
			
		||||
func (sa *SockaddrALG) sockaddr() (unsafe.Pointer, _Socklen, error) {
 | 
			
		||||
	// Leave room for NUL byte terminator.
 | 
			
		||||
	if len(sa.Type) > 13 {
 | 
			
		||||
	if len(sa.Type) > len(sa.raw.Type)-1 {
 | 
			
		||||
		return nil, 0, EINVAL
 | 
			
		||||
	}
 | 
			
		||||
	if len(sa.Name) > 63 {
 | 
			
		||||
	if len(sa.Name) > len(sa.raw.Name)-1 {
 | 
			
		||||
		return nil, 0, EINVAL
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -704,17 +705,8 @@ func (sa *SockaddrALG) sockaddr() (unsafe.Pointer, _Socklen, error) {
 | 
			
		|||
	sa.raw.Feat = sa.Feature
 | 
			
		||||
	sa.raw.Mask = sa.Mask
 | 
			
		||||
 | 
			
		||||
	typ, err := ByteSliceFromString(sa.Type)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, 0, err
 | 
			
		||||
	}
 | 
			
		||||
	name, err := ByteSliceFromString(sa.Name)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, 0, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	copy(sa.raw.Type[:], typ)
 | 
			
		||||
	copy(sa.raw.Name[:], name)
 | 
			
		||||
	copy(sa.raw.Type[:], sa.Type)
 | 
			
		||||
	copy(sa.raw.Name[:], sa.Name)
 | 
			
		||||
 | 
			
		||||
	return unsafe.Pointer(&sa.raw), SizeofSockaddrALG, nil
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1015,8 +1007,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
 | 
			
		|||
		for n < len(pp.Path) && pp.Path[n] != 0 {
 | 
			
		||||
			n++
 | 
			
		||||
		}
 | 
			
		||||
		bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
 | 
			
		||||
		sa.Name = string(bytes)
 | 
			
		||||
		sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n))
 | 
			
		||||
		return sa, nil
 | 
			
		||||
 | 
			
		||||
	case AF_INET:
 | 
			
		||||
| 
						 | 
				
			
			@ -1365,6 +1356,10 @@ func SetsockoptTCPRepairOpt(fd, level, opt int, o []TCPRepairOpt) (err error) {
 | 
			
		|||
	return setsockopt(fd, level, opt, unsafe.Pointer(&o[0]), uintptr(SizeofTCPRepairOpt*len(o)))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func SetsockoptTCPMD5Sig(fd, level, opt int, s *TCPMD5Sig) error {
 | 
			
		||||
	return setsockopt(fd, level, opt, unsafe.Pointer(s), unsafe.Sizeof(*s))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
 | 
			
		||||
 | 
			
		||||
// KeyctlInt calls keyctl commands in which each argument is an int.
 | 
			
		||||
| 
						 | 
				
			
			@ -1579,6 +1574,7 @@ func BindToDevice(fd int, device string) (err error) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
//sys	ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
 | 
			
		||||
//sys	ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) = SYS_PTRACE
 | 
			
		||||
 | 
			
		||||
func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err error) {
 | 
			
		||||
	// The peek requests are machine-size oriented, so we wrap it
 | 
			
		||||
| 
						 | 
				
			
			@ -1596,7 +1592,7 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro
 | 
			
		|||
	// boundary.
 | 
			
		||||
	n := 0
 | 
			
		||||
	if addr%SizeofPtr != 0 {
 | 
			
		||||
		err = ptrace(req, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
 | 
			
		||||
		err = ptracePtr(req, pid, addr-addr%SizeofPtr, unsafe.Pointer(&buf[0]))
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return 0, err
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -1608,7 +1604,7 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro
 | 
			
		|||
	for len(out) > 0 {
 | 
			
		||||
		// We use an internal buffer to guarantee alignment.
 | 
			
		||||
		// It's not documented if this is necessary, but we're paranoid.
 | 
			
		||||
		err = ptrace(req, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0])))
 | 
			
		||||
		err = ptracePtr(req, pid, addr+uintptr(n), unsafe.Pointer(&buf[0]))
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return n, err
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -1640,7 +1636,7 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c
 | 
			
		|||
	n := 0
 | 
			
		||||
	if addr%SizeofPtr != 0 {
 | 
			
		||||
		var buf [SizeofPtr]byte
 | 
			
		||||
		err = ptrace(peekReq, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
 | 
			
		||||
		err = ptracePtr(peekReq, pid, addr-addr%SizeofPtr, unsafe.Pointer(&buf[0]))
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return 0, err
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -1667,7 +1663,7 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c
 | 
			
		|||
	// Trailing edge.
 | 
			
		||||
	if len(data) > 0 {
 | 
			
		||||
		var buf [SizeofPtr]byte
 | 
			
		||||
		err = ptrace(peekReq, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0])))
 | 
			
		||||
		err = ptracePtr(peekReq, pid, addr+uintptr(n), unsafe.Pointer(&buf[0]))
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return n, err
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -1695,12 +1691,23 @@ func PtracePokeUser(pid int, addr uintptr, data []byte) (count int, err error) {
 | 
			
		|||
	return ptracePoke(PTRACE_POKEUSR, PTRACE_PEEKUSR, pid, addr, data)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// elfNT_PRSTATUS is a copy of the debug/elf.NT_PRSTATUS constant so
 | 
			
		||||
// x/sys/unix doesn't need to depend on debug/elf and thus
 | 
			
		||||
// compress/zlib, debug/dwarf, and other packages.
 | 
			
		||||
const elfNT_PRSTATUS = 1
 | 
			
		||||
 | 
			
		||||
func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
 | 
			
		||||
	return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
 | 
			
		||||
	var iov Iovec
 | 
			
		||||
	iov.Base = (*byte)(unsafe.Pointer(regsout))
 | 
			
		||||
	iov.SetLen(int(unsafe.Sizeof(*regsout)))
 | 
			
		||||
	return ptracePtr(PTRACE_GETREGSET, pid, uintptr(elfNT_PRSTATUS), unsafe.Pointer(&iov))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
 | 
			
		||||
	return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
 | 
			
		||||
	var iov Iovec
 | 
			
		||||
	iov.Base = (*byte)(unsafe.Pointer(regs))
 | 
			
		||||
	iov.SetLen(int(unsafe.Sizeof(*regs)))
 | 
			
		||||
	return ptracePtr(PTRACE_SETREGSET, pid, uintptr(elfNT_PRSTATUS), unsafe.Pointer(&iov))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func PtraceSetOptions(pid int, options int) (err error) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1709,7 +1716,7 @@ func PtraceSetOptions(pid int, options int) (err error) {
 | 
			
		|||
 | 
			
		||||
func PtraceGetEventMsg(pid int) (msg uint, err error) {
 | 
			
		||||
	var data _C_long
 | 
			
		||||
	err = ptrace(PTRACE_GETEVENTMSG, pid, 0, uintptr(unsafe.Pointer(&data)))
 | 
			
		||||
	err = ptracePtr(PTRACE_GETEVENTMSG, pid, 0, unsafe.Pointer(&data))
 | 
			
		||||
	msg = uint(data)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1800,6 +1807,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 | 
			
		|||
//sysnb	Capset(hdr *CapUserHeader, data *CapUserData) (err error)
 | 
			
		||||
//sys	Chdir(path string) (err error)
 | 
			
		||||
//sys	Chroot(path string) (err error)
 | 
			
		||||
//sys	ClockAdjtime(clockid int32, buf *Timex) (state int, err error)
 | 
			
		||||
//sys	ClockGetres(clockid int32, res *Timespec) (err error)
 | 
			
		||||
//sys	ClockGettime(clockid int32, time *Timespec) (err error)
 | 
			
		||||
//sys	ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
 | 
			
		||||
| 
						 | 
				
			
			@ -1868,9 +1876,8 @@ func Getpgrp() (pid int) {
 | 
			
		|||
//sys	OpenTree(dfd int, fileName string, flags uint) (r int, 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)
 | 
			
		||||
//sys	Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6
 | 
			
		||||
//sys	pselect6(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *sigset_argpack) (n int, err error)
 | 
			
		||||
//sys	read(fd int, p []byte) (n int, err error)
 | 
			
		||||
//sys	Removexattr(path string, attr string) (err error)
 | 
			
		||||
//sys	Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error)
 | 
			
		||||
| 
						 | 
				
			
			@ -1882,6 +1889,15 @@ func Getpgrp() (pid int) {
 | 
			
		|||
//sysnb	Settimeofday(tv *Timeval) (err error)
 | 
			
		||||
//sys	Setns(fd int, nstype int) (err error)
 | 
			
		||||
 | 
			
		||||
//go:linkname syscall_prlimit syscall.prlimit
 | 
			
		||||
func syscall_prlimit(pid, resource int, newlimit, old *syscall.Rlimit) error
 | 
			
		||||
 | 
			
		||||
func Prlimit(pid, resource int, newlimit, old *Rlimit) error {
 | 
			
		||||
	// Just call the syscall version, because as of Go 1.21
 | 
			
		||||
	// it will affect starting a new process.
 | 
			
		||||
	return syscall_prlimit(pid, resource, (*syscall.Rlimit)(newlimit), (*syscall.Rlimit)(old))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PrctlRetInt performs a prctl operation specified by option and further
 | 
			
		||||
// optional arguments arg2 through arg5 depending on option. It returns a
 | 
			
		||||
// non-negative integer that is returned by the prctl syscall.
 | 
			
		||||
| 
						 | 
				
			
			@ -1964,8 +1980,6 @@ func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) {
 | 
			
		|||
//sys	Unshare(flags int) (err error)
 | 
			
		||||
//sys	write(fd int, p []byte) (n int, err error)
 | 
			
		||||
//sys	exitThread(code int) (err error) = SYS_EXIT
 | 
			
		||||
//sys	readlen(fd int, p *byte, np int) (n int, err error) = SYS_READ
 | 
			
		||||
//sys	writelen(fd int, p *byte, np int) (n int, err error) = SYS_WRITE
 | 
			
		||||
//sys	readv(fd int, iovs []Iovec) (n int, err error) = SYS_READV
 | 
			
		||||
//sys	writev(fd int, iovs []Iovec) (n int, err error) = SYS_WRITEV
 | 
			
		||||
//sys	preadv(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr) (n int, err error) = SYS_PREADV
 | 
			
		||||
| 
						 | 
				
			
			@ -1999,7 +2013,7 @@ func appendBytes(vecs []Iovec, bs [][]byte) []Iovec {
 | 
			
		|||
// offs2lohi splits offs into its low and high order bits.
 | 
			
		||||
func offs2lohi(offs int64) (lo, hi uintptr) {
 | 
			
		||||
	const longBits = SizeofLong * 8
 | 
			
		||||
	return uintptr(offs), uintptr(uint64(offs) >> longBits)
 | 
			
		||||
	return uintptr(offs), uintptr(uint64(offs) >> (longBits - 1) >> 1) // two shifts to avoid false positive in vet
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Readv(fd int, iovs [][]byte) (n int, err error) {
 | 
			
		||||
| 
						 | 
				
			
			@ -2100,21 +2114,7 @@ func writevRacedetect(iovecs []Iovec, n int) {
 | 
			
		|||
 | 
			
		||||
// mmap varies by architecture; see syscall_linux_*.go.
 | 
			
		||||
//sys	munmap(addr uintptr, length uintptr) (err error)
 | 
			
		||||
 | 
			
		||||
var mapper = &mmapper{
 | 
			
		||||
	active: make(map[*byte][]byte),
 | 
			
		||||
	mmap:   mmap,
 | 
			
		||||
	munmap: munmap,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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	mremap(oldaddr uintptr, oldlength uintptr, newlength uintptr, flags int, newaddr uintptr) (xaddr uintptr, err error)
 | 
			
		||||
//sys	Madvise(b []byte, advice int) (err error)
 | 
			
		||||
//sys	Mprotect(b []byte, prot int) (err error)
 | 
			
		||||
//sys	Mlock(b []byte) (err error)
 | 
			
		||||
| 
						 | 
				
			
			@ -2123,6 +2123,12 @@ func Munmap(b []byte) (err error) {
 | 
			
		|||
//sys	Munlock(b []byte) (err error)
 | 
			
		||||
//sys	Munlockall() (err error)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	mremapFixed     = MREMAP_FIXED
 | 
			
		||||
	mremapDontunmap = MREMAP_DONTUNMAP
 | 
			
		||||
	mremapMaymove   = MREMAP_MAYMOVE
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Vmsplice splices user pages from a slice of Iovecs into a pipe specified by fd,
 | 
			
		||||
// using the specified flags.
 | 
			
		||||
func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
 | 
			
		||||
| 
						 | 
				
			
			@ -2153,6 +2159,14 @@ func isGroupMember(gid int) bool {
 | 
			
		|||
	return false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func isCapDacOverrideSet() bool {
 | 
			
		||||
	hdr := CapUserHeader{Version: LINUX_CAPABILITY_VERSION_3}
 | 
			
		||||
	data := [2]CapUserData{}
 | 
			
		||||
	err := Capget(&hdr, &data[0])
 | 
			
		||||
 | 
			
		||||
	return err == nil && data[0].Effective&(1<<CAP_DAC_OVERRIDE) != 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	faccessat(dirfd int, path string, mode uint32) (err error)
 | 
			
		||||
//sys	Faccessat2(dirfd int, path string, mode uint32, flags int) (err error)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2188,6 +2202,12 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
 | 
			
		|||
	var uid int
 | 
			
		||||
	if flags&AT_EACCESS != 0 {
 | 
			
		||||
		uid = Geteuid()
 | 
			
		||||
		if uid != 0 && isCapDacOverrideSet() {
 | 
			
		||||
			// If CAP_DAC_OVERRIDE is set, file access check is
 | 
			
		||||
			// done by the kernel in the same way as for root
 | 
			
		||||
			// (see generic_permission() in the Linux sources).
 | 
			
		||||
			uid = 0
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		uid = Getuid()
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -2393,99 +2413,75 @@ func PthreadSigmask(how int, set, oldset *Sigset_t) error {
 | 
			
		|||
	return rtSigprocmask(how, set, oldset, _C__NSIG/8)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Unimplemented
 | 
			
		||||
 */
 | 
			
		||||
// AfsSyscall
 | 
			
		||||
// ArchPrctl
 | 
			
		||||
// Brk
 | 
			
		||||
// ClockNanosleep
 | 
			
		||||
// ClockSettime
 | 
			
		||||
// Clone
 | 
			
		||||
// EpollCtlOld
 | 
			
		||||
// EpollPwait
 | 
			
		||||
// EpollWaitOld
 | 
			
		||||
// Execve
 | 
			
		||||
// Fork
 | 
			
		||||
// Futex
 | 
			
		||||
// GetKernelSyms
 | 
			
		||||
// GetMempolicy
 | 
			
		||||
// GetRobustList
 | 
			
		||||
// GetThreadArea
 | 
			
		||||
// Getpmsg
 | 
			
		||||
// IoCancel
 | 
			
		||||
// IoDestroy
 | 
			
		||||
// IoGetevents
 | 
			
		||||
// IoSetup
 | 
			
		||||
// IoSubmit
 | 
			
		||||
// IoprioGet
 | 
			
		||||
// IoprioSet
 | 
			
		||||
// KexecLoad
 | 
			
		||||
// LookupDcookie
 | 
			
		||||
// Mbind
 | 
			
		||||
// MigratePages
 | 
			
		||||
// Mincore
 | 
			
		||||
// ModifyLdt
 | 
			
		||||
// Mount
 | 
			
		||||
// MovePages
 | 
			
		||||
// MqGetsetattr
 | 
			
		||||
// MqNotify
 | 
			
		||||
// MqOpen
 | 
			
		||||
// MqTimedreceive
 | 
			
		||||
// MqTimedsend
 | 
			
		||||
// MqUnlink
 | 
			
		||||
// Mremap
 | 
			
		||||
// Msgctl
 | 
			
		||||
// Msgget
 | 
			
		||||
// Msgrcv
 | 
			
		||||
// Msgsnd
 | 
			
		||||
// Nfsservctl
 | 
			
		||||
// Personality
 | 
			
		||||
// Pselect6
 | 
			
		||||
// Ptrace
 | 
			
		||||
// Putpmsg
 | 
			
		||||
// Quotactl
 | 
			
		||||
// Readahead
 | 
			
		||||
// Readv
 | 
			
		||||
// RemapFilePages
 | 
			
		||||
// RestartSyscall
 | 
			
		||||
// RtSigaction
 | 
			
		||||
// RtSigpending
 | 
			
		||||
// RtSigqueueinfo
 | 
			
		||||
// RtSigreturn
 | 
			
		||||
// RtSigsuspend
 | 
			
		||||
// RtSigtimedwait
 | 
			
		||||
// SchedGetPriorityMax
 | 
			
		||||
// SchedGetPriorityMin
 | 
			
		||||
// SchedGetparam
 | 
			
		||||
// SchedGetscheduler
 | 
			
		||||
// SchedRrGetInterval
 | 
			
		||||
// SchedSetparam
 | 
			
		||||
// SchedYield
 | 
			
		||||
// Security
 | 
			
		||||
// Semctl
 | 
			
		||||
// Semget
 | 
			
		||||
// Semop
 | 
			
		||||
// Semtimedop
 | 
			
		||||
// SetMempolicy
 | 
			
		||||
// SetRobustList
 | 
			
		||||
// SetThreadArea
 | 
			
		||||
// SetTidAddress
 | 
			
		||||
// Sigaltstack
 | 
			
		||||
// Swapoff
 | 
			
		||||
// Swapon
 | 
			
		||||
// Sysfs
 | 
			
		||||
// TimerCreate
 | 
			
		||||
// TimerDelete
 | 
			
		||||
// TimerGetoverrun
 | 
			
		||||
// TimerGettime
 | 
			
		||||
// TimerSettime
 | 
			
		||||
// Tkill (obsolete)
 | 
			
		||||
// Tuxcall
 | 
			
		||||
// Umount2
 | 
			
		||||
// Uselib
 | 
			
		||||
// Utimensat
 | 
			
		||||
// Vfork
 | 
			
		||||
// Vhangup
 | 
			
		||||
// Vserver
 | 
			
		||||
// _Sysctl
 | 
			
		||||
//sysnb	getresuid(ruid *_C_int, euid *_C_int, suid *_C_int)
 | 
			
		||||
//sysnb	getresgid(rgid *_C_int, egid *_C_int, sgid *_C_int)
 | 
			
		||||
 | 
			
		||||
func Getresuid() (ruid, euid, suid int) {
 | 
			
		||||
	var r, e, s _C_int
 | 
			
		||||
	getresuid(&r, &e, &s)
 | 
			
		||||
	return int(r), int(e), int(s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Getresgid() (rgid, egid, sgid int) {
 | 
			
		||||
	var r, e, s _C_int
 | 
			
		||||
	getresgid(&r, &e, &s)
 | 
			
		||||
	return int(r), int(e), int(s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Pselect is a wrapper around the Linux pselect6 system call.
 | 
			
		||||
// This version does not modify the timeout argument.
 | 
			
		||||
func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
 | 
			
		||||
	// Per https://man7.org/linux/man-pages/man2/select.2.html#NOTES,
 | 
			
		||||
	// The Linux pselect6() system call modifies its timeout argument.
 | 
			
		||||
	// [Not modifying the argument] is the behavior required by POSIX.1-2001.
 | 
			
		||||
	var mutableTimeout *Timespec
 | 
			
		||||
	if timeout != nil {
 | 
			
		||||
		mutableTimeout = new(Timespec)
 | 
			
		||||
		*mutableTimeout = *timeout
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// The final argument of the pselect6() system call is not a
 | 
			
		||||
	// sigset_t * pointer, but is instead a structure
 | 
			
		||||
	var kernelMask *sigset_argpack
 | 
			
		||||
	if sigmask != nil {
 | 
			
		||||
		wordBits := 32 << (^uintptr(0) >> 63) // see math.intSize
 | 
			
		||||
 | 
			
		||||
		// A sigset stores one bit per signal,
 | 
			
		||||
		// offset by 1 (because signal 0 does not exist).
 | 
			
		||||
		// So the number of words needed is ⌈__C_NSIG - 1 / wordBits⌉.
 | 
			
		||||
		sigsetWords := (_C__NSIG - 1 + wordBits - 1) / (wordBits)
 | 
			
		||||
 | 
			
		||||
		sigsetBytes := uintptr(sigsetWords * (wordBits / 8))
 | 
			
		||||
		kernelMask = &sigset_argpack{
 | 
			
		||||
			ss:    sigmask,
 | 
			
		||||
			ssLen: sigsetBytes,
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return pselect6(nfd, r, w, e, mutableTimeout, kernelMask)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	schedSetattr(pid int, attr *SchedAttr, flags uint) (err error)
 | 
			
		||||
//sys	schedGetattr(pid int, attr *SchedAttr, size uint, flags uint) (err error)
 | 
			
		||||
 | 
			
		||||
// SchedSetAttr is a wrapper for sched_setattr(2) syscall.
 | 
			
		||||
// https://man7.org/linux/man-pages/man2/sched_setattr.2.html
 | 
			
		||||
func SchedSetAttr(pid int, attr *SchedAttr, flags uint) error {
 | 
			
		||||
	if attr == nil {
 | 
			
		||||
		return EINVAL
 | 
			
		||||
	}
 | 
			
		||||
	attr.Size = SizeofSchedAttr
 | 
			
		||||
	return schedSetattr(pid, attr, flags)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SchedGetAttr is a wrapper for sched_getattr(2) syscall.
 | 
			
		||||
// https://man7.org/linux/man-pages/man2/sched_getattr.2.html
 | 
			
		||||
func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) {
 | 
			
		||||
	attr := &SchedAttr{}
 | 
			
		||||
	if err := schedGetattr(pid, attr, SizeofSchedAttr, flags); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return attr, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build 386 && linux
 | 
			
		||||
// +build 386,linux
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -97,33 +96,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
 | 
			
		|||
	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 Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
 | 
			
		||||
	newoffset, errno := seek(fd, offset, whence)
 | 
			
		||||
	if errno != 0 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && (386 || amd64 || mips || mipsle || mips64 || mipsle || ppc64 || ppc64le || ppc || s390x || sparc64)
 | 
			
		||||
// +build linux
 | 
			
		||||
// +build 386 amd64 mips mipsle mips64 mipsle ppc64 ppc64le ppc s390x sparc64
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build amd64 && linux
 | 
			
		||||
// +build amd64,linux
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -40,13 +39,12 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
 | 
			
		|||
	if timeout != nil {
 | 
			
		||||
		ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
 | 
			
		||||
	}
 | 
			
		||||
	return Pselect(nfd, r, w, e, ts, nil)
 | 
			
		||||
	return pselect6(nfd, r, w, e, ts, nil)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
 | 
			
		||||
//sys	setfsgid(gid int) (prev int, err error)
 | 
			
		||||
//sys	setfsuid(uid int) (prev int, err error)
 | 
			
		||||
//sysnb	Setrlimit(resource int, rlim *Rlimit) (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 int64, err error)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build amd64 && linux && gc
 | 
			
		||||
// +build amd64,linux,gc
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build arm && linux
 | 
			
		||||
// +build arm,linux
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -171,33 +170,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
 | 
			
		|||
	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() uint64 { return uint64(r.Uregs[15]) }
 | 
			
		||||
 | 
			
		||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Uregs[15] = uint32(pc) }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build arm64 && linux
 | 
			
		||||
// +build arm64,linux
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -33,13 +32,12 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
 | 
			
		|||
	if timeout != nil {
 | 
			
		||||
		ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
 | 
			
		||||
	}
 | 
			
		||||
	return Pselect(nfd, r, w, e, ts, nil)
 | 
			
		||||
	return pselect6(nfd, r, w, e, ts, nil)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
 | 
			
		||||
//sys	setfsgid(gid int) (prev int, err error)
 | 
			
		||||
//sys	setfsuid(uid int) (prev int, err error)
 | 
			
		||||
//sysnb	setrlimit(resource int, rlim *Rlimit) (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 int64, err error)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -143,15 +141,6 @@ func Getrlimit(resource int, rlim *Rlimit) error {
 | 
			
		|||
	return getrlimit(resource, rlim)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Setrlimit prefers the prlimit64 system call. See issue 38604.
 | 
			
		||||
func Setrlimit(resource int, rlim *Rlimit) error {
 | 
			
		||||
	err := Prlimit(0, resource, rlim, nil)
 | 
			
		||||
	if err != ENOSYS {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return setrlimit(resource, rlim)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *PtraceRegs) PC() uint64 { return r.Pc }
 | 
			
		||||
 | 
			
		||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && gc
 | 
			
		||||
// +build linux,gc
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && gc && 386
 | 
			
		||||
// +build linux,gc,386
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build arm && gc && linux
 | 
			
		||||
// +build arm,gc,linux
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && gccgo && 386
 | 
			
		||||
// +build linux,gccgo,386
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && gccgo && arm
 | 
			
		||||
// +build linux,gccgo,arm
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build loong64 && linux
 | 
			
		||||
// +build loong64,linux
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +27,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
 | 
			
		|||
	if timeout != nil {
 | 
			
		||||
		ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
 | 
			
		||||
	}
 | 
			
		||||
	return Pselect(nfd, r, w, e, ts, nil)
 | 
			
		||||
	return pselect6(nfd, r, w, e, ts, nil)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
 | 
			
		||||
| 
						 | 
				
			
			@ -126,11 +125,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
 | 
			
		|||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
 | 
			
		||||
	err = Prlimit(0, resource, rlim, nil)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) {
 | 
			
		||||
	if tv == nil {
 | 
			
		||||
		return utimensat(dirfd, path, nil, 0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && (mips64 || mips64le)
 | 
			
		||||
// +build linux
 | 
			
		||||
// +build mips64 mips64le
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -31,13 +29,12 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
 | 
			
		|||
	if timeout != nil {
 | 
			
		||||
		ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
 | 
			
		||||
	}
 | 
			
		||||
	return Pselect(nfd, r, w, e, ts, nil)
 | 
			
		||||
	return pselect6(nfd, r, w, e, ts, nil)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
 | 
			
		||||
//sys	setfsgid(gid int) (prev int, err error)
 | 
			
		||||
//sys	setfsuid(uid int) (prev int, err error)
 | 
			
		||||
//sysnb	Setrlimit(resource int, rlim *Rlimit) (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 int64, err error)
 | 
			
		||||
//sys	Statfs(path string, buf *Statfs_t) (err error)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && (mips || mipsle)
 | 
			
		||||
// +build linux
 | 
			
		||||
// +build mips mipsle
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -151,33 +149,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
 | 
			
		|||
	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() uint64 { return r.Epc }
 | 
			
		||||
 | 
			
		||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && ppc
 | 
			
		||||
// +build linux,ppc
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -159,33 +158,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
 | 
			
		|||
	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 }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,8 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build linux && (ppc64 || ppc64le)
 | 
			
		||||
// +build linux
 | 
			
		||||
// +build ppc64 ppc64le
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +32,6 @@ package unix
 | 
			
		|||
//sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
 | 
			
		||||
//sys	setfsgid(gid int) (prev int, err error)
 | 
			
		||||
//sys	setfsuid(uid int) (prev int, err error)
 | 
			
		||||
//sysnb	Setrlimit(resource int, rlim *Rlimit) (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 int64, err error)
 | 
			
		||||
//sys	Stat(path string, stat *Stat_t) (err error)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build riscv64 && linux
 | 
			
		||||
// +build riscv64,linux
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -32,13 +31,12 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
 | 
			
		|||
	if timeout != nil {
 | 
			
		||||
		ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
 | 
			
		||||
	}
 | 
			
		||||
	return Pselect(nfd, r, w, e, ts, nil)
 | 
			
		||||
	return pselect6(nfd, r, w, e, ts, nil)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
 | 
			
		||||
//sys	setfsgid(gid int) (prev int, err error)
 | 
			
		||||
//sys	setfsuid(uid int) (prev int, err error)
 | 
			
		||||
//sysnb	Setrlimit(resource int, rlim *Rlimit) (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 int64, err error)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -178,3 +176,14 @@ func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error
 | 
			
		|||
	}
 | 
			
		||||
	return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	riscvHWProbe(pairs []RISCVHWProbePairs, cpuCount uintptr, cpus *CPUSet, flags uint) (err error)
 | 
			
		||||
 | 
			
		||||
func RISCVHWProbe(pairs []RISCVHWProbePairs, set *CPUSet, flags uint) (err error) {
 | 
			
		||||
	var setSize uintptr
 | 
			
		||||
 | 
			
		||||
	if set != nil {
 | 
			
		||||
		setSize = uintptr(unsafe.Sizeof(*set))
 | 
			
		||||
	}
 | 
			
		||||
	return riscvHWProbe(pairs, setSize, set, flags)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build s390x && linux
 | 
			
		||||
// +build s390x,linux
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +33,6 @@ import (
 | 
			
		|||
//sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
 | 
			
		||||
//sys	setfsgid(gid int) (prev int, err error)
 | 
			
		||||
//sys	setfsuid(uid int) (prev int, err error)
 | 
			
		||||
//sysnb	Setrlimit(resource int, rlim *Rlimit) (err error)
 | 
			
		||||
//sys	Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
 | 
			
		||||
//sys	Stat(path string, stat *Stat_t) (err error)
 | 
			
		||||
//sys	Statfs(path string, buf *Statfs_t) (err error)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
//go:build sparc64 && linux
 | 
			
		||||
// +build sparc64,linux
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -31,7 +30,6 @@ package unix
 | 
			
		|||
//sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
 | 
			
		||||
//sys	setfsgid(gid int) (prev int, err error)
 | 
			
		||||
//sys	setfsuid(uid int) (prev int, err error)
 | 
			
		||||
//sysnb	Setrlimit(resource int, rlim *Rlimit) (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 int64, err error)
 | 
			
		||||
//sys	Stat(path string, stat *Stat_t) (err error)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,6 @@
 | 
			
		|||
package unix
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"syscall"
 | 
			
		||||
	"unsafe"
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -178,13 +177,13 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
//sys	ioctl(fd int, req uint, arg uintptr) (err error)
 | 
			
		||||
//sys	ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
 | 
			
		||||
 | 
			
		||||
//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
 | 
			
		||||
	err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
 | 
			
		||||
	runtime.KeepAlive(value)
 | 
			
		||||
	err := ioctlPtr(fd, req, unsafe.Pointer(&value))
 | 
			
		||||
	return &value, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -341,7 +340,6 @@ func Statvfs(path string, buf *Statvfs_t) (err error) {
 | 
			
		|||
//sys	Setpriority(which int, who int, prio int) (err error)
 | 
			
		||||
//sysnb	Setregid(rgid int, egid int) (err error)
 | 
			
		||||
//sysnb	Setreuid(ruid int, euid int) (err error)
 | 
			
		||||
//sysnb	Setrlimit(which int, lim *Rlimit) (err error)
 | 
			
		||||
//sysnb	Setsid() (pid int, err error)
 | 
			
		||||
//sysnb	Settimeofday(tp *Timeval) (err error)
 | 
			
		||||
//sysnb	Setuid(uid int) (err error)
 | 
			
		||||
| 
						 | 
				
			
			@ -358,267 +356,16 @@ func Statvfs(path string, buf *Statvfs_t) (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	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	utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Unimplemented
 | 
			
		||||
 */
 | 
			
		||||
// ____semctl13
 | 
			
		||||
// __clone
 | 
			
		||||
// __fhopen40
 | 
			
		||||
// __fhstat40
 | 
			
		||||
// __fhstatvfs140
 | 
			
		||||
// __fstat30
 | 
			
		||||
// __getcwd
 | 
			
		||||
// __getfh30
 | 
			
		||||
// __getlogin
 | 
			
		||||
// __lstat30
 | 
			
		||||
// __mount50
 | 
			
		||||
// __msgctl13
 | 
			
		||||
// __msync13
 | 
			
		||||
// __ntp_gettime30
 | 
			
		||||
// __posix_chown
 | 
			
		||||
// __posix_fchown
 | 
			
		||||
// __posix_lchown
 | 
			
		||||
// __posix_rename
 | 
			
		||||
// __setlogin
 | 
			
		||||
// __shmctl13
 | 
			
		||||
// __sigaction_sigtramp
 | 
			
		||||
// __sigaltstack14
 | 
			
		||||
// __sigpending14
 | 
			
		||||
// __sigprocmask14
 | 
			
		||||
// __sigsuspend14
 | 
			
		||||
// __sigtimedwait
 | 
			
		||||
// __stat30
 | 
			
		||||
// __syscall
 | 
			
		||||
// __vfork14
 | 
			
		||||
// _ksem_close
 | 
			
		||||
// _ksem_destroy
 | 
			
		||||
// _ksem_getvalue
 | 
			
		||||
// _ksem_init
 | 
			
		||||
// _ksem_open
 | 
			
		||||
// _ksem_post
 | 
			
		||||
// _ksem_trywait
 | 
			
		||||
// _ksem_unlink
 | 
			
		||||
// _ksem_wait
 | 
			
		||||
// _lwp_continue
 | 
			
		||||
// _lwp_create
 | 
			
		||||
// _lwp_ctl
 | 
			
		||||
// _lwp_detach
 | 
			
		||||
// _lwp_exit
 | 
			
		||||
// _lwp_getname
 | 
			
		||||
// _lwp_getprivate
 | 
			
		||||
// _lwp_kill
 | 
			
		||||
// _lwp_park
 | 
			
		||||
// _lwp_self
 | 
			
		||||
// _lwp_setname
 | 
			
		||||
// _lwp_setprivate
 | 
			
		||||
// _lwp_suspend
 | 
			
		||||
// _lwp_unpark
 | 
			
		||||
// _lwp_unpark_all
 | 
			
		||||
// _lwp_wait
 | 
			
		||||
// _lwp_wakeup
 | 
			
		||||
// _pset_bind
 | 
			
		||||
// _sched_getaffinity
 | 
			
		||||
// _sched_getparam
 | 
			
		||||
// _sched_setaffinity
 | 
			
		||||
// _sched_setparam
 | 
			
		||||
// acct
 | 
			
		||||
// aio_cancel
 | 
			
		||||
// aio_error
 | 
			
		||||
// aio_fsync
 | 
			
		||||
// aio_read
 | 
			
		||||
// aio_return
 | 
			
		||||
// aio_suspend
 | 
			
		||||
// aio_write
 | 
			
		||||
// break
 | 
			
		||||
// clock_getres
 | 
			
		||||
// clock_gettime
 | 
			
		||||
// clock_settime
 | 
			
		||||
// compat_09_ogetdomainname
 | 
			
		||||
// compat_09_osetdomainname
 | 
			
		||||
// compat_09_ouname
 | 
			
		||||
// compat_10_omsgsys
 | 
			
		||||
// compat_10_osemsys
 | 
			
		||||
// compat_10_oshmsys
 | 
			
		||||
// compat_12_fstat12
 | 
			
		||||
// compat_12_getdirentries
 | 
			
		||||
// compat_12_lstat12
 | 
			
		||||
// compat_12_msync
 | 
			
		||||
// compat_12_oreboot
 | 
			
		||||
// compat_12_oswapon
 | 
			
		||||
// compat_12_stat12
 | 
			
		||||
// compat_13_sigaction13
 | 
			
		||||
// compat_13_sigaltstack13
 | 
			
		||||
// compat_13_sigpending13
 | 
			
		||||
// compat_13_sigprocmask13
 | 
			
		||||
// compat_13_sigreturn13
 | 
			
		||||
// compat_13_sigsuspend13
 | 
			
		||||
// compat_14___semctl
 | 
			
		||||
// compat_14_msgctl
 | 
			
		||||
// compat_14_shmctl
 | 
			
		||||
// compat_16___sigaction14
 | 
			
		||||
// compat_16___sigreturn14
 | 
			
		||||
// compat_20_fhstatfs
 | 
			
		||||
// compat_20_fstatfs
 | 
			
		||||
// compat_20_getfsstat
 | 
			
		||||
// compat_20_statfs
 | 
			
		||||
// compat_30___fhstat30
 | 
			
		||||
// compat_30___fstat13
 | 
			
		||||
// compat_30___lstat13
 | 
			
		||||
// compat_30___stat13
 | 
			
		||||
// compat_30_fhopen
 | 
			
		||||
// compat_30_fhstat
 | 
			
		||||
// compat_30_fhstatvfs1
 | 
			
		||||
// compat_30_getdents
 | 
			
		||||
// compat_30_getfh
 | 
			
		||||
// compat_30_ntp_gettime
 | 
			
		||||
// compat_30_socket
 | 
			
		||||
// compat_40_mount
 | 
			
		||||
// compat_43_fstat43
 | 
			
		||||
// compat_43_lstat43
 | 
			
		||||
// compat_43_oaccept
 | 
			
		||||
// compat_43_ocreat
 | 
			
		||||
// compat_43_oftruncate
 | 
			
		||||
// compat_43_ogetdirentries
 | 
			
		||||
// compat_43_ogetdtablesize
 | 
			
		||||
// compat_43_ogethostid
 | 
			
		||||
// compat_43_ogethostname
 | 
			
		||||
// compat_43_ogetkerninfo
 | 
			
		||||
// compat_43_ogetpagesize
 | 
			
		||||
// compat_43_ogetpeername
 | 
			
		||||
// compat_43_ogetrlimit
 | 
			
		||||
// compat_43_ogetsockname
 | 
			
		||||
// compat_43_okillpg
 | 
			
		||||
// compat_43_olseek
 | 
			
		||||
// compat_43_ommap
 | 
			
		||||
// compat_43_oquota
 | 
			
		||||
// compat_43_orecv
 | 
			
		||||
// compat_43_orecvfrom
 | 
			
		||||
// compat_43_orecvmsg
 | 
			
		||||
// compat_43_osend
 | 
			
		||||
// compat_43_osendmsg
 | 
			
		||||
// compat_43_osethostid
 | 
			
		||||
// compat_43_osethostname
 | 
			
		||||
// compat_43_osetrlimit
 | 
			
		||||
// compat_43_osigblock
 | 
			
		||||
// compat_43_osigsetmask
 | 
			
		||||
// compat_43_osigstack
 | 
			
		||||
// compat_43_osigvec
 | 
			
		||||
// compat_43_otruncate
 | 
			
		||||
// compat_43_owait
 | 
			
		||||
// compat_43_stat43
 | 
			
		||||
// execve
 | 
			
		||||
// extattr_delete_fd
 | 
			
		||||
// extattr_delete_file
 | 
			
		||||
// extattr_delete_link
 | 
			
		||||
// extattr_get_fd
 | 
			
		||||
// extattr_get_file
 | 
			
		||||
// extattr_get_link
 | 
			
		||||
// extattr_list_fd
 | 
			
		||||
// extattr_list_file
 | 
			
		||||
// extattr_list_link
 | 
			
		||||
// extattr_set_fd
 | 
			
		||||
// extattr_set_file
 | 
			
		||||
// extattr_set_link
 | 
			
		||||
// extattrctl
 | 
			
		||||
// fchroot
 | 
			
		||||
// fdatasync
 | 
			
		||||
// fgetxattr
 | 
			
		||||
// fktrace
 | 
			
		||||
// flistxattr
 | 
			
		||||
// fork
 | 
			
		||||
// fremovexattr
 | 
			
		||||
// fsetxattr
 | 
			
		||||
// fstatvfs1
 | 
			
		||||
// fsync_range
 | 
			
		||||
// getcontext
 | 
			
		||||
// getitimer
 | 
			
		||||
// getvfsstat
 | 
			
		||||
// getxattr
 | 
			
		||||
// ktrace
 | 
			
		||||
// lchflags
 | 
			
		||||
// lchmod
 | 
			
		||||
// lfs_bmapv
 | 
			
		||||
// lfs_markv
 | 
			
		||||
// lfs_segclean
 | 
			
		||||
// lfs_segwait
 | 
			
		||||
// lgetxattr
 | 
			
		||||
// lio_listio
 | 
			
		||||
// listxattr
 | 
			
		||||
// llistxattr
 | 
			
		||||
// lremovexattr
 | 
			
		||||
// lseek
 | 
			
		||||
// lsetxattr
 | 
			
		||||
// lutimes
 | 
			
		||||
// madvise
 | 
			
		||||
// mincore
 | 
			
		||||
// minherit
 | 
			
		||||
// modctl
 | 
			
		||||
// mq_close
 | 
			
		||||
// mq_getattr
 | 
			
		||||
// mq_notify
 | 
			
		||||
// mq_open
 | 
			
		||||
// mq_receive
 | 
			
		||||
// mq_send
 | 
			
		||||
// mq_setattr
 | 
			
		||||
// mq_timedreceive
 | 
			
		||||
// mq_timedsend
 | 
			
		||||
// mq_unlink
 | 
			
		||||
// mremap
 | 
			
		||||
// msgget
 | 
			
		||||
// msgrcv
 | 
			
		||||
// msgsnd
 | 
			
		||||
// nfssvc
 | 
			
		||||
// ntp_adjtime
 | 
			
		||||
// pmc_control
 | 
			
		||||
// pmc_get_info
 | 
			
		||||
// pollts
 | 
			
		||||
// preadv
 | 
			
		||||
// profil
 | 
			
		||||
// pselect
 | 
			
		||||
// pset_assign
 | 
			
		||||
// pset_create
 | 
			
		||||
// pset_destroy
 | 
			
		||||
// ptrace
 | 
			
		||||
// pwritev
 | 
			
		||||
// quotactl
 | 
			
		||||
// rasctl
 | 
			
		||||
// readv
 | 
			
		||||
// reboot
 | 
			
		||||
// removexattr
 | 
			
		||||
// sa_enable
 | 
			
		||||
// sa_preempt
 | 
			
		||||
// sa_register
 | 
			
		||||
// sa_setconcurrency
 | 
			
		||||
// sa_stacks
 | 
			
		||||
// sa_yield
 | 
			
		||||
// sbrk
 | 
			
		||||
// sched_yield
 | 
			
		||||
// semconfig
 | 
			
		||||
// semget
 | 
			
		||||
// semop
 | 
			
		||||
// setcontext
 | 
			
		||||
// setitimer
 | 
			
		||||
// setxattr
 | 
			
		||||
// shmat
 | 
			
		||||
// shmdt
 | 
			
		||||
// shmget
 | 
			
		||||
// sstk
 | 
			
		||||
// statvfs1
 | 
			
		||||
// swapctl
 | 
			
		||||
// sysarch
 | 
			
		||||
// syscall
 | 
			
		||||
// timer_create
 | 
			
		||||
// timer_delete
 | 
			
		||||
// timer_getoverrun
 | 
			
		||||
// timer_gettime
 | 
			
		||||
// timer_settime
 | 
			
		||||
// undelete
 | 
			
		||||
// utrace
 | 
			
		||||
// uuidgen
 | 
			
		||||
// vadvise
 | 
			
		||||
// vfork
 | 
			
		||||
// writev
 | 
			
		||||
const (
 | 
			
		||||
	mremapFixed     = MAP_FIXED
 | 
			
		||||
	mremapDontunmap = 0
 | 
			
		||||
	mremapMaymove   = 0
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
//sys	mremapNetBSD(oldp uintptr, oldsize uintptr, newp uintptr, newsize uintptr, flags int) (xaddr uintptr, err error) = SYS_MREMAP
 | 
			
		||||
 | 
			
		||||
func mremap(oldaddr uintptr, oldlength uintptr, newlength uintptr, flags int, newaddr uintptr) (uintptr, error) {
 | 
			
		||||
	return mremapNetBSD(oldaddr, oldlength, newaddr, newlength, flags)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
		Reference in New Issue