Skip to content

syscall.AllThreadsSyscall panics when using fakecgo #343

@qmuntal

Description

@qmuntal

PureGo Version

v0.9.0

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • NetBSD
  • Android
  • iOS

Go Version (go version)

go1.25.1

What steps will reproduce the problem?

Run the following code:

package main

import (
	"fmt"
	"syscall"
)

func main {
	_, _, err := syscall.AllThreadsSyscall(syscall.SYS_FCNTL, 0, 0, 0)
	fmt.Println("error:", err)
}

What is the expected result?

error: operation not supported

What happens instead?

panic: doAllThreadsSyscall not supported with cgo enabled

Anything else you feel useful to add?

syscall.AllThreadsSyscall returns ``syscall.ENOTSUPiscgo_libc_setegid` is defined in `runtime/cgo`. If it is not defined, it goes ahead with the operation but panicking if the `runtime/cgo` defines `iscgo`.

fakecgo does not define cgo_libc_setegid but defines iscgo, so syscall.AllThreadsSyscall panics.

Note that a similar failure mode is reproduced with syscall.Setegid, and friends.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions