[m-rev.] for review: avoid unistd.h reference in runtime headers

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Nov 8 19:06:29 AEDT 2002


On 08-Nov-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> runtime/mercury_trace_base.{c,h}:
> trace/mercury_trace_internal.c:
> 	Move the code to kill the xterm created for `mdb --window'
> 	into mercury_trace_internal.c to avoid references to the
> 	non-ISO header file unistd.h in the runtime headers.

Thanks for doing that one...

In the log message, it is IMHO better to spell the file names out in full,
rather than using abbreviations such as ".{c,h}",
so that they can be found by text search commands.

Apart from that, this change looks fine.

> +static void
> +MR_trace_internal_kill_mdb_window(void)
> +{
> +#if defined(MR_HAVE_KILL) && defined(MR_HAVE_WAIT) && defined(SIGTERM)
> +	if (MR_have_mdb_window) {
> +		int status;
> +		status = kill(MR_mdb_window_pid, SIGTERM);
> +		if (status != -1) {
> +			do {
> +				status = wait(NULL);
> +				if (status == -1 && errno != EINTR) {
> +					break;
> +				}
> +			} while (status != MR_mdb_window_pid);
> +		}
> +	}
> +#endif

EINTR is not part of ISO C, so it's use should be protected with
`#ifdef EINTR'.

However, this is an existing flaw in the code, not something introduced
by your change.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list