Skip to content

x/sys/unix: Pselect does not call pselect6 properly on Linux #61251

@rittneje

Description

@rittneje

unix.Pselect is implemented via the pselect6 syscall. The Linux man page says the following:

The final argument of the pselect6() system call is not a sigset_t * pointer, but is instead a structure of the form:

   struct {
       const sigset_t *ss;     /* Pointer to signal set */
       size_t          ss_len; /* Size (in bytes) of object pointed
                                  to by 'ss' */
   };

However, the unix package does not follow this.

func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
	r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)))
	n = int(r0)
	if e1 != 0 {
		err = errnoErr(e1)
	}
	return
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions