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 Serguei From: <golang-nuts@googlegroups.com> on behalf of "jake6...@gmail.com" <jake6...@gmail.com> Date: Friday, August 24, 2018 at 12:09 PM To: golang-nuts <golang-nuts@googlegroups.com> Subject: [go-nuts] Re: Ioctl Syscall with go and c Probably unrelated to your problem, but IIUC, the syscall package is "deprecated", or "frozen". According to the syscall documentation<https://golang.org/pkg/syscall/>: This package is locked down. Code outside the standard Go repository should be migrated to use the corresponding package in the golang.org/x/sys repository. That is also where updates required by new systems or versions should be applied. So, while unlikely, it is possible that is the problem. In any case, unless I misunderstand, the preferred package for you to use is golang.org/x/sys/unix. On Thursday, August 23, 2018 at 7:02:13 AM UTC-4, sbez...@cisco.com wrote: Hello, I am converting some C code to Go and hit an issue with one particular Syscall: In C: device = ioctl(group, 0x3b6a, path); where path is char[N] In Go: ioctlId := 0x3b6a device, _, errno := syscall.Syscall( syscall.SYS_IOCTL, uintptr(group), uintptr(unsafe.Pointer(&ioctlId)), uintptr(unsafe.Pointer(pciDevice)), ) Where pciDevice is *string with exactly the same value as path in C. When I run Go bits on the same h/w, same OS, same everything, it fails with "errno 22 (invalid argument)". It seems that the issue is how string gets passed to Syscall, but I could not find any examples how to do it correctly. Appreciate some advice here. Thank you Serguei -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com<mailto:golang-nuts+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.