Skip to content

Avoid calls to (*os.File).Fd() when calling ioctl#214

Closed
WeidiDeng wants to merge 13 commits intocreack:masterfrom
WeidiDeng:master
Closed

Avoid calls to (*os.File).Fd() when calling ioctl#214
WeidiDeng wants to merge 13 commits intocreack:masterfrom
WeidiDeng:master

Conversation

@WeidiDeng
Copy link
Contributor

In #167 (*os.File).SyscallConn() is used whenever possible, but it caused some operations to fail sometimes and had to be reverted.

The problem is not race condition, but incorrect usage of uintptr. In go, any pointer value should only be converted to uintptr when passed as arguments to syscall.Syscall.

According to test results, even the blocking version may rarely have this kind of problem.

Copilot was used to refactor the function signature and some manual editing to make sure it works.

Copilot AI and others added 13 commits March 11, 2026 02:39
Co-authored-by: WeidiDeng <28780594+WeidiDeng@users.noreply.github.com>
….Pointer

Co-authored-by: WeidiDeng <28780594+WeidiDeng@users.noreply.github.com>
Co-authored-by: WeidiDeng <28780594+WeidiDeng@users.noreply.github.com>
…r at syscall.Syscall site

Co-authored-by: WeidiDeng <28780594+WeidiDeng@users.noreply.github.com>
… at syscall call site; remove ptrToUintptr helper

Co-authored-by: WeidiDeng <28780594+WeidiDeng@users.noreply.github.com>
…tr).UnsafePointer()) inline at syscall call site

Co-authored-by: WeidiDeng <28780594+WeidiDeng@users.noreply.github.com>
refactor: ioctl ptr parameter from uintptr to any
@WeidiDeng
Copy link
Contributor Author

Superseded by #215

@WeidiDeng WeidiDeng closed this Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants