Opened 2 months ago

Last modified 2 months ago

#19026 new enhancement

Implement SIGINFO

Reported by: nephele Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/libroot.so Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

SIGINFO is a signal that can be triggered with ctrl-t in the Terminal, When the signal is delivered the programm is supposed to print some info about what it is currently doing. On some unices the kernel also prints a line about the programm.

Examples

  • cp reports how much it has already copied
  • find reports where it is searches
  • rm reports which file it is deleting currently (for -r)

Change History (4)

comment:1 by pulkomandy, 2 months ago

I don't know what you want to implement exactly here, this is justa signal and there is nothing special about it to do in libroot.

Have you tried sending it using the kill command? Is it not just missing a keybinding in Terminal or some handling in pty/tty to send it?

in reply to:  1 comment:2 by nephele, 2 months ago

Replying to pulkomandy:

I don't know what you want to implement exactly here, this is justa signal and there is nothing special about it to do in libroot.

Have you tried sending it using the kill command? Is it not just missing a keybinding in Terminal or some handling in pty/tty to send it?

I have not tried sending it, because we do not implement it.

kill -s SIGINFO                                                                                                                                     
/bin/mksh: kill: bad signal 'SIGINFO'

I don't know what is involved in implementing this (The components might be set wrongly), I assume adding a number for this signal, defining that somewhere, hooking it up to kill, to gnu coreutils, potentially implementing this signal handeling where it makes sense to do so etc.

comment:3 by pulkomandy, 2 months ago

I'm a bit confused by SIGINFO, because that signal on Linux seems to exist only for the DEC Alpha architecture. And it seems to not be part of any standard. It exists in FreeBSD, however. So I guess your description of the behavior is from FreeBSD or some derivative. And so the implementation doesn't seem to exist in GNU coreutils.

I know that the dd command does something similar, but it uses the SIGUSR1 signal (which we already have).

Anyway, notes on how to do this:

Add an extra signal definition in headers/posix/signal.h, and you have your new signal. For good measure, add it to system/libroot/posix/signal/strsignal.cpp so it can be converted to a string for debugging. you may need to adjust some other places to set its default behavior to be ignored by applications.

Then implement sending it in Terminal: this is mostly done in tty_input_putc_locked in src/add-ons/kernel/generic/tty/tty.cpp.

You may also have to extend the termios structure to add a new entry to c_cc (this may be a problem, as it makes the structure larger and these fields are accessed directly by applications). You may need to use symbol versioning here to

And then have Terminal fill that structure so that Ctrl+T sends that signal. If extending termios is not possible, this will instead be done by hardcoding it in the tty code.

Then you have to implement handling the signal in coreutils. I don't know how to do that. Or alternatively you could use the version of the utilities from BSD instead.

comment:4 by nephele, 2 months ago

You are right, Linux only supports this on alpha. iirc coreutils has some support for it, maybe because of alpha or because of other ports. Though I could be mistaken of course.

I think most BSD have this.

The advantage over SIGUSR1 for dd is that SIGINFO normally is not fatal if not handeled, and SIGUSR1 may kill the application if not handeled. (though that may be OS specific, I'm not sure)

From a simple UI perspective however I'm quite used to "just" beeing able to use ctrl t in the terminal to see what my programm is doing :)

Note: See TracTickets for help on using tickets.