On a recent thread on request-sponsor (http://www.opensolaris.org/jive/thread.jspa?threadID=27721&tstart=0), an RFE was made to add status support to dd(1), using the USR1 signal. It was noted that the original functionality to provide this was via the VSTATUS character (ctrl-t by default), from BSD, and originally appearing in SunOS 4.x, too.

James Carlson pointed to a CR that he filed a while ago (6310532) to bring back SIGINFO support, and Richard Hamilton looked into what was needed to implement it.

I took ownership of 6310532.

The original BSD (4.3BSD Reno) implementation, which is in *BSD today, looks like this:

* if the IEXTEN (POSIX extensions allowed) flag in cc_lflag (line discipline flags) of the controlling terminal's
  termios isn't set, nothing happens
* termios(7) has a VSTATUS member of the c_cc array, defining the control character triggering the event * typing the status character (ctrl-t by default) prints the system load and status information for the current process to the controlling terminal of the process, *unless* the NOKERNINFO flag is set in the
  line discipline flag for the controlling terminal (c_lflag in termios)
* additionally, if a handler for SIGINFO is defined (the signal is ignored by default), that signal is sent
  to the process

Implementing this is not hard, and is not really the issue. My issue: I've never really liked the info, printed from the kernel, that ctrl-t triggers by default. It is not that useful, and there are many other tools to look at that info in a less intrusive way. Also, implementing it this way changes the default behavior for the ctrl-t keystroke. This is perhaps not a major issue, since applications that do not want any surprises from keystrokes can only have that guarantee by disabling IEXTEN, and there might not be any applications at all that have a controlling terminal and that use ctrl-t for anything.

These are the options. For the sake of simplifying this list, I will not consider applications that do not to tcgetattr(cttyfd, &defaults); new = defaults ; modify new; tcsetattr(cttyfd, &new), but for example construct a termios structure by hand. These applications are broken, and I do not know of any that do this.

1. VSTATUS is set to ctrl-t by default. The kernel will print load + process info. The signal is sent.
   Pro: Fully BSD compatible
Con: The information is not that useful, andt the behavior for unmodified applications changes.

2. VSTATUS is set to ctrl-t by default. The NOKERNINFO flag is set by default. The signal is sent.
   Pro: fully BSD source compatible.
           Default behavior not changed.
   Con: Default behavior not BSD compatible.

3. VSTATUS is not set by default. The kernel will print load + process info. The signal is sent.
    Pro: Default behavior not changed, yet full functionality available
Con: Not quite BSD source compatible: applications wanting SIGINFO must set VSTATUS
            explicitly.

4. VSTATUS is set by default. load + process info is never printed. The signal is sent.
   Pro: Default behavior not changed.
Con: Not BSD behavior compatible, nor fully BSD source compatible (no NOKERNINFO)

I have read that OS X originally did something like 3, but on my 10.4.x system, it seems to have the full BSD behavior.

I'm leaning towards 4 myself. It is the simplest, and optionally, NOKERNINFO could be defined as a dummy flag. 2 is my second choice.

Thoughts?

- Frank

_______________________________________________
opensolaris-code mailing list
[EMAIL PROTECTED]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to