Hi,

I have some questions about OS specific ways to find out the name of a
running programme outside function main. The following section verbosely
introduces the problem and what information I found so far. You may just
skip down to "Questions". I hope someone can fill in the blanks.

The new configuration infrastructure will make it possible to specify
different configurations for different applications, based on the
executable name. Usually this name is only available as argv[0] in
function main which is out of reach for a library such as libGL and the
Mesa drivers. Different Unix flavours offer different ways of getting
the program name outside main. On GNU systems there is the global
variable program_invocation_short_name. On some BSD versions there is a
function getprogname. Now my problem is to know which version (if any)
is available at compile time.

This is the information I found:

GLIBC (don't know which versions): program_invocation_short_name
FreeBSD (>= 4.4): getprogname
NetBSD (>= 1.6): getprogname

In the BSD DRM source code I found out that there are macros
__OpenBSD__, __NetBSD__ and __FreeBSD__ to distinguish different BSD
flavours. But I don't know how the check the exact version. The GLIBC
version can be checked with the macros __GLIBC__ and __GLIBC_MINOR__ or
__GNU_LIBRARY__ for older versions.

Questions:

1) Are there similar mechanisms on other relevant OSes, specifically OpenBSD
   and maybe Solaris?

2) (How) can one check for specific *BSD versions via #if ?

3) Are there old GLIBC versions that don't have program_invocation_short_name?

References:

features.h in glibc
http://www.gnu.org/manual/glibc-2.2.5/html_node/Error-Messages.html
http://www.freebsd.org/cgi/man.cgi?query=getprogname&apropos=0&sektion=0&manpath=FreeBSD+4.8-stable&format=html

Regards,
  Felix

------------    __\|/__    ___     ___       -------------------------
 Felix       ___\_e -_/___/ __\___/ __\_____   You can do anything,
   Kühling  (_____\Ä/____/ /_____/ /________)  just not everything
 [EMAIL PROTECTED]       \___/   \___/   U        at the same time.


-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to