home *** CD-ROM | disk | FTP | other *** search
- Date: Fri, 20 Sep 85 11:53:29 EDT
- From: Doug Gwyn (VLD/VMB) <gwyn@BRL.ARPA>
- To: std-unix@ut-sally.ARPA
-
- I checked with X3J11 and the proposed change in the declaration of
- user signal-handling functions has a problem.
-
- The proposed change in the declared type of a signal handler was to:
- void func( int sig, ... );
- where the ", ..." was intended to allow provision of additional
- information (such as PC at time of fault) to the signal handler,
- in a "signal and implementation dependent" way.
-
- This is a nice idea, but according to X3J11 in order to guarantee
- portability one would have to define all signal handlers with the
- same ", ..." notation. The fundamental reason behind this
- requirement is that some C implementations will use a different
- function parameter passing mechanism for variable parameter lists
- than for regular lists.
-
- This means that existing code such as
- void
- onintr( sig ) /* SIGINT catcher */
- int sig;
- {
- do_something_with( sig );
- }
- would officially be broken. (Of course, many UNIX C implementations
- on "nice" architectures would continue to work anyway.)
-
- In order to avoid having to recode signal handlers to look like
- void
- onintr( int sig, ... ) /* SIGINT catcher */
- {
- do_something_with( sig );
- }
- I recommend that the "optional" extra signal handler function
- parameter(s) be removed from the proposed specification. I agree
- that a better signal interface would be desirable, and suggest
- that the "real time extensions" subcommittee should consider this
- issue (hopefully, they will use a different mechanism such as
- 4.2BSD's if they need to change the semantics).
-
- Incidentally, the reason that this variable parameter list issue
- is not a problem with open(), execl(), printf(), etc. is that the
- application developer ("user") sees those functions from the
- outside only, not from the inside (i.e., he uses their declarations
- but does not have to provide a definition). For brand-new
- facilities there is also no problem, since X3J11 provides a
- "stdargs" mechanism to provide a portable way to implement such
- function definitions. It is only when compatibility with past
- function definitions is involved that a problem can arise.
-
- Volume-Number: Volume 2, Number 5
-
-