[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Devel] Close on exec for font files
From: |
Keith Packard |
Subject: |
Re: [Devel] Close on exec for font files |
Date: |
Thu, 03 Jan 2002 08:15:40 -0800 |
Around 18 o'clock on Jan 3, David Turner wrote:
> I'm ready to add such code to the FreeType sources, however I'd like
> to know wether these calls are Linux specific, available on all Unices,
> and if they require specific Autoconf voodoo to properly nest them
> in #if .. #endif controls ??
On almost all systems that XFree86 builds on, the following suffices:
#include <fcntl.h>
#include <unistd.h>
#ifdef F_SETFD
#ifdef FD_CLOEXEC
ret = fcntl (fd, F_SETFD, FD_CLOEXEC);
#else
ret = fcntl (fd, F_SETFD, 1);
#endif /* FD_CLOEXEC */
#endif /* F_SETFD */
You must have fcntl.h to use this; you should probably include unistd.h if
it exists.
I'd add:
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(unistd.h)
to configure.in and then
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
to the file and then use the litle code snippet above.
Keith Packard XFree86 Core Team Compaq Cambridge Research Lab