pesos / grofer

A system and resource monitoring tool written in Golang!
Apache License 2.0
352 stars 52 forks source link

[FEATURE REQ] provide support for different signal types #80

Closed MadhavJivrajani closed 3 years ago

MadhavJivrajani commented 4 years ago

Is your feature request related to a problem? Please describe. gopsutil provides support for 4 different types of signals that can be sent to a process, signals other than these 4 need to be implemented such as SIGABRT. A list of signals can be obtained by running kill -l

Describe the solution you'd like Maybe the implementation of sending signals could be done using the Signal() function.

Samyak2 commented 4 years ago

Do these have to be implemented in separate functions (such as sendHup, sendInt) or a general function to send a given signal to a process?

MadhavJivrajani commented 4 years ago

Separate functions can be implemented to send individual signals, but only a single exposed interface for the signal-sending should preferably be available. We could have codes for each type of signal as consts and a map from these consts as keys and values as functions. Maybe we could get the function from the map and then call it, handle errors from it, etc.

anihm136 commented 3 years ago

I can try this. syscall already has aliases for all kinds of signals, which can be passed directly to Signal(). Do you think it's a good idea to forego gopsutil entirely for this functionality to maintain a uniform implementation?

MadhavJivrajani commented 3 years ago

Yep! That would be ideal. Go for it!

anihm136 commented 3 years ago

Quick update, I've started work on this. gopsutil has a SendSignal method that takes an arbitrary signal as defined by syscall and sends it to a process. I'm planning to use it for further work on this