Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/signal: No access to the siginfo_t struct #9764

Open
quentinmit opened this issue Feb 3, 2015 · 8 comments
Open

os/signal: No access to the siginfo_t struct #9764

quentinmit opened this issue Feb 3, 2015 · 8 comments

Comments

@quentinmit
Copy link
Contributor

@quentinmit quentinmit commented Feb 3, 2015

The siginfo_t struct that is delivered with signals contains various useful information about the signal. In some cases, this information is necessary to implement the kernel API of various features. For example, fcntl(F_SETLEASE) requires that your process receive a SIGIO when the lock is broken, and the si_fd field in the siginfo_t struct tells you what filehandle the kernel is notifying your process about.

Please provide an interface that will allow Go code to access the information in the siginfo_t struct.

@rsc
Copy link
Contributor

@rsc rsc commented Apr 10, 2015

We'd need to figure out a nice, portable API to do this.

@dothebart
Copy link

@dothebart dothebart commented May 27, 2021

https://man7.org/linux/man-pages/man2/sigaction.2.html is the referenced Structure.
Since its quiet usefull for debugging to log i.e. which process sent you a signal, it would be really great to see support for this.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented May 27, 2021

The stress here is on portable. The man page you cite is Linux-specific.

@LordRusk
Copy link

@LordRusk LordRusk commented Feb 18, 2022

Rather than needing a super portable way to do this, could we simply add access to it through /x/sys/unix because of its specificity? It's really dragging down a project of mine to not have access to this struct in any way.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Feb 18, 2022

We still need a nice, portable API. I don't see how using x/sys/unix helps. I don't have any ideas for an API.

@LordRusk
Copy link

@LordRusk LordRusk commented Feb 18, 2022

Please correct me if I'm mistaken, but it seems the SignalfdSigInfo struct is equivalent to siginfo_t - only missing a few fields, including si_sigval which is what I need. Syscall is deprecated in favor of /x/sys for OS specificity, that is why I bring it up. Not sure why si_sigval wasn't included, or what it would take to add it, but with this in mind I'm not sure why we'd need a 'portable API' for this.

/x/sys/unix/.SignalfdInfo & siginfo_t comparison

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Feb 18, 2022

I agree what we don't need a portable API for the exact definition of siginfo_t. We can do something similar to how fs.FileInfo has a Sys method that returns a system-specific data structure.

What we need is a portable API for how to access that system-specific information.

@LordRusk
Copy link

@LordRusk LordRusk commented Feb 18, 2022

SignalfdSiginfo is not an equivalent of siginfo_t and isn't supposed to be, that's my bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants