Skip to content

x/sys/unix: add IoctlSetIntPtr #46060

@lhl2617

Description

@lhl2617

What did you expect to see?

Original discussion: #46058

Some ioctl calls, such as https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html#setting-and-getting-the-timeout, modify the value in the ioctl call after the value is passed into the operation. Such ioctl calls are of the IOWR (IO write read) variant, as opposed to the IOR and IOW variants.

IoctlSetPointerInt is not able to return the modified value.

Proposed fix:

// IoctlSetModifiablePointerInt performs an ioctl operation which sets a
// pointer to an integer value on fd, using the specified request number.
//
// Use this if the ioctl operation may modify the value.
func IoctlSetModifiablePointerInt(fd int, req uint, value *int) error {
	return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Triage Backlog

    Status

    Accepted

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions