_, _, ep := syscall.Syscall(syscall.SYS_IOCTL, uintptr(e.fd), SIOCETHTOOL, uintptr(unsafe.Pointer(&ifreq)))ifep !=0{returnsyscall.Errno(ep) } 和调度的交互 这里只列出Syscall和RawSyscall的源码: //SyscallTEXT ·Syscall(SB),NOSPLIT,$0-56CALLruntime·entersyscall(SB)MOVQ a1+8(FP), DI ...
SYS_SENDFILE = 40 SYS_SOCKET = 41 SYS_CONNECT = 42 SYS_ACCEPT = 43 SYS_SENDTO = 44 SYS_RECVFROM = 45 SYS_SENDMSG = 46 SYS_RECVMSG = 47 SYS_SHUTDOWN = 48 SYS_BIND = 49 SYS_LISTEN = 50 SYS_GETSOCKNAME = 51 SYS_GETPEERNAME = 52 SYS_SOCKETPAIR = 53 SYS_SETSOCKOPT = 54 SYS...
SYS_WRITE = 1 SYS_OPEN = 2 SYS_CLOSE = 3 SYS_STAT = 4 SYS_FSTAT = 5 SYS_LSTAT = 6 SYS_POLL = 7 SYS_LSEEK = 8 SYS_MMAP = 9 SYS_MPROTECT = 10 SYS_MUNMAP = 11 SYS_BRK = 12 SYS_RT_SIGACTION = 13 SYS_RT_SIGPROCMASK = 14 SYS_RT_SIGRETURN = 15 SYS_IOCTL = 16 SYS_PRE...
nodeper1楼•4 个月前
但从易用性和简单出发,最好直接调用unix.IoctlGetWinsize,注意GetWinsizeAPi在windows上不好使 package main import ( "fmt" "strings" "syscall" "time" "golang.org/x/sys/unix" ) var wscol = 30 func init() { ws, err := unix.IoctlGetWinsize(syscall.Stdout, unix.TIOCGWINSZ) ...
trap中断类型传入syscall.SYS_IOCTL,SYS_IOCTL中断号表示调用linux底层ioctl函数 Syscall函数中剩下三个参数a1,a2,a3分别对应ioctl的三个参数。可以man命令查看linux ioctl函数参数,如下 int ioctl(int d, int request, ...); 1. 第一个参数d指定一个由open/socket创建的文件描述符,即socket套接字 ...
2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build linux 6 // +build linux 7 8 package main 9 10 import ( 11 "syscall" 12 "unsafe" 13 ) 14 15 const ioctlReadTermios = syscall.TCGETS 16 17 // is...
= 0 { fmt.Printf("Fail to execute ioctl, the errno is %+v", errno) return errors.New("failed execute ioctl") } return nil } // sendFCtlMessage fcntl system call func sendFCtlMessage(fd int, cmd int, arg int) error { _, _, err := syscall.Syscall(syscall.SYS_FCNTL, uintptr(...
//sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL 80 //sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL 81 82 // ioctl itself should not be exposed directly, but additional get/set functions 83 ...
Compilinggokrazyfails when newerx/sysis used: golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 # github.com/gokrazy/tools/cmd/gokr-packer cmd/gokr-packer/parttable_darwin.go:21:33: undefined: unix.SYS_IOCTL cmd/gokr-packer/parttable_darwin.go:24:33: undefined: unix.SYS_IOCTL ...