Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-26 Thread jake6502
I was aware that your parameters would not fit the Ioctl functions. As Ian pointed out, you would need to use *golang.org/x/sys/unix/Syscall() *and friends. On Sunday, August 26, 2018 at 10:00:11 AM UTC-4, sbez...@cisco.com wrote: > > Hi Jake, > > > > Ioctl implementation in unix package

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-26 Thread Ian Lance Taylor
On Sun, Aug 26, 2018 at 6:59 AM, 'Serguei Bezverkhi (sbezverk)' via golang-nuts wrote: > > Ioctl implementation in unix package seems a bit limited, how do you pass > for example a required struct if “func IoctlSetInt(fd int, req uint, value > int)” allows only to accept int?? If this package had

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-26 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
Hi Jake, Ioctl implementation in unix package seems a bit limited, how do you pass for example a required struct if “func IoctlSetInt(fd int, req uint, value int)” allows only to accept int?? If this package had a func accepting uintptr as a parameter, then I guess that could work. Thank you S

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread Tamás Gulácsi
2018. augusztus 23., csütörtök 21:50:54 UTC+2 időpontban sbez...@cisco.com a következőt írta: > > I copied the whole thing to https://github.com/sbezverk/vfio > > Running it without actual vfio/iommu might be problematic though. > > Before this specific ioctl can be run 2 open calls must succe

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
I copied the whole thing to https://github.com/sbezverk/vfio Running it without actual vfio/iommu might be problematic though. Before this specific ioctl can be run 2 open calls must succeed. See func main. Thank you for looking into this problem Serguei Sent from my iPhone > On Aug 23, 2018,

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread Tamás Gulácsi
Cany you give a complete example? https://play.golang.org/p/ZQSf-PwMtd9 says "device=18446744073709551615 errno=inappropriate ioctl for device" -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receivi

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
lso addressed your suggestions without any success. It is latest Centos 7.5. Thank you Serguei From: on behalf of "jake6...@gmail.com" Date: Thursday, August 23, 2018 at 12:27 PM To: golang-nuts Subject: Re: [go-nuts] Re: Ioctl Syscall with go and c First off, I don't kno

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread jake6502
rrno: %+v", group, errno) > > } > > return int(device), nil > > } > > > > Any other suggestions? > > Thank you > > Serguei > > > > *From: *> on behalf of Max < > massimilia...@gmail.com > > *Date: *Thursday, Aug

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
st 23, 2018 at 10:46 AM To: golang-nuts Subject: Re: [go-nuts] Re: Ioctl Syscall with go and c Hi Serguei, a Go string or *string do not correspond to a C char * You must pass the address of the first byte of a sufficiently large buffer: func GetGroupFD(group int, pciDevice *string) (int, error)

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread Max
Hi Serguei, a Go string or *string do not correspond to a C char * You must pass the address of the first byte of a sufficiently large buffer: func GetGroupFD(group int, pciDevice *string) (int, error) { const N = 256 var buffer [N]byte device, _, errno := syscall.Syscall( syscall.S

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread 'Serguei Bezverkhi (sbezverk)' via golang-nuts
I changed code a little bit to be able to examine variables: func GetGroupFD(group int, pciDevice *string) (int, error) { ioctlId := 0x3b6a var buffer uintptr buffer = uintptr(unsafe.Pointer(pciDevice)) device, _, errno := syscall.Syscall( syscall.SYS_IOCTL, uintpt