www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/08/03/09:15:04

Date: Tue, 3 Aug 1999 10:36:30 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp-workers AT delorie DOT com
cc: DJ Delorie <dj AT delorie DOT com>
Subject: __stub_foo macros in header files
Message-ID: <Pine.SUN.3.91.990803103541.1847E-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

This issue was raised by the new feature in GNU `tail' (from
the upcoming Textutils), whereby you could say something like
"tail --forever --pid=PID" and have `tail' track changes to
the file until the process with the named PID exits (presumably,
that process was writing the file tracked by `tail').

The implementation calls "kill (pid, 0)" and looks at the value this
returned and at errno.  Since we don't support sending signals to
other processes, `tail' should print a message when invoked with
--pid, to the effect that the feature isn't supported.

The question is how does the configure script know to configure
Textutils for DJGPP so that this message is printed at run time.

The Textutils maintainer suggested to use the __stub_foo feature of
Autoconf-generated scripts.  To wit: if the <assert.h> header, or any
other header assert.h pulls in, defines a macro __stub_foo, this tells
the configure script that the function `foo', while it exists in the
library, is merely a stub that doesn't do anything useful.

Using this feature, we could define __stub_fork, which will make it
obvious that anything that depends on fork will not work, including
passing signals to other processes.  (We cannot define __stub_kill,
because `kill' actually works when the PID is the caller's pid or
zero.)

I've seen similar problems in other packages before, but I never
understood this __stub feature (it was invented for glibc), so until
now the solution was to use #ifdef __MSDOS__, which is not nice.

So, the question is: can we define __stub_fork (and maybe a few
others) in some <sys/stubs.h> and make <assert.h> include it?  Can we
add this to v2.03?  Can this break something?

Textutils are very close to release, so it would be nice if we could
resolve this now.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019