|  |  15.2.1 Cross-Unix Function Calls 
Functions not mentioned in POSIX.1 may not be available on all systems.
If you want to use one of these functions, you should normally check for
its presence by using `AC_CHECK_FUNCS' in your `configure.in'
script, and adapt to its absence if possible.  Here is a list of some
popular functions which are available on many, but not all, modern Unix
systems:
 
allocaThere are several portability issues with alloca.  See the
description ofAC_FUNC_ALLOCAin the autoconf manual.  Although
this function can be very convenient, it is normally best to avoid it in
highly portable code.dlopenGNU libtool provides a portable alternate interface to
dlopen.  See section 17. Dynamic Loading.getlineIn some cases fgetsmay be used as a fallback.  In others, you
will need to provide your own version of this function.getpagesizeOn some systems, the page size is available as the macro
PAGE_SIZEin the header file `sys/param.h'.  On others, the
page size is available via thesysconffunction.  If none of
those work, you must generally simply guess a value such as4096.gettimeofdayWhen this is not available, fall back to a less precise function such as
timeorftime(which itself is not available on all
systems).mmapIn some cases you can use either mmapor ordinary file I/O.  In
others, a program which usesmmapwill simply not be portable to
all Unix systems.  Note thatmmapis an optional part of the 1996
version of POSIX.1, so it is likely to be added to all Unix systems over
time.ptraceUnix systems without ptracegenerally provide some other
mechanism for debugging subprocesses, such as `/proc'.  However,
there is no widely portable method for controlling subprocesses, as
evidenced by the source code to the GNU debugger,gdb.setuidDifferent Unix systems handle this differently.  On some systems, any
program can switch between the effective user ID of the executable and
the real user ID.  On others, switching to the real user ID is final;
some of those systems provide the setreuidfunction instead to
switch the effective and real user ID.  The effect when a program run by
the superuser callssetuidvaries among systems.snprintfIf this is not available, then in some cases it will be reasonable to
simply use sprintf, and in others you will need to write a little
routine to estimate the required length and allocate an appropriate
buffer before callingsprintf.strcasecmpstrdupstrncasecmpYou can normally provide your own version of these simple functions.
vallocWhen this is not available, just use mallocinstead.vforkWhen this is not available, just use forkinstead. 
 |