...
 
Commits (18)
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
config/aux/
config/m4/libtool.m4
config/m4/lt*.m4
build/
.build-aux/
config.*
configure
libtool
m4/l*.m4
src/.*
*.lo
*.o
*.la
src/signalfd_test
.deps/
.dirstamp
.libs/
src/lib/libfixposix.h
src/tests/signalfd_test
src/tests/spawn_test
config.h.in*
Makefile.in
branches:
only:
- master
os:
- linux
- osx
language: c
compiler:
- gcc
- clang
matrix:
allow_failures:
- os: osx
notifications:
email:
on_success: change
on_failure: always
irc:
channels:
- "chat.freenode.net#iolib"
on_success: change
on_failure: always
use_notice: true
skip_join: true
before_install:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install -qq check; fi
env:
global:
# Coverity Scan token
secure: "jJirBkZOyJ8KuYXMbjUpKem2FGaCsLBq7roP9oHs5mz8wIKENGB3i7pBe5USVLCwVAuqJ+TPjbfSo4nSnCIf5mLdJoNnyrq8FAYhSRzA/zl4COW6eN0Of9dgCOzcOriPY9rXUVbIapWoMogntnAS6MpmbiSxQCsq99VsIHq3TYk="
script:
- autoreconf -f -i
- ./configure --enable-tests
- make -j2
- make check
addons:
coverity_scan:
project:
name: sionescu/libfixposix
build_command_prepend: autoreconf -f -i && ./configure --enable-tests
build_command: make -j4
branch_pattern: coverity
notification_email: sionescu@cddr.org
......@@ -6,13 +6,22 @@
# #
########################################################################
ACLOCAL_AMFLAGS = -I m4
ACLOCAL_AMFLAGS = -I config/m4
AM_CPPFLAGS = $(LFP_CPPFLAGS)
AM_CFLAGS = $(LFP_CFLAGS) -fvisibility=hidden
AM_CFLAGS = $(LFP_CFLAGS)
AM_CPPFLAGS = -include $(top_builddir)/config.h \
-include $(top_srcdir)/src/lib/aux/macros.h \
-I$(top_srcdir)/src/include \
-I$(top_builddir)/src/include
INCLUDES = -I$(top_builddir)/src/include -I$(top_srcdir)/src/include
EXTRA_DIST = \
LICENCE \
VERSION \
libfixposix.spec \
debian \
src/tests/lib \
$(wildcard $(top_srcdir)/src/tests/*.in)
......@@ -23,7 +32,7 @@ INCLUDES = -I$(top_builddir)/src/include -I$(top_srcdir)/src/include
########################################################################
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libfixposix.pc
pkgconfig_DATA = src/libfixposix.pc
......@@ -38,7 +47,11 @@ lib_LTLIBRARIES = src/lib/libfixposix.la
# Private headers, used only for internal definitions
# The only purpose of this definition it to ensure that
# «make dist» knows about them
noinst_HEADERS = src/lib/utils.h src/lib/spawn.h
noinst_HEADERS = \
src/lib/aux/inlines.h \
src/lib/aux/macros.h \
src/lib/bitset.h \
src/lib/spawn.h
include_HEADERS = src/include/lfp.h
......@@ -47,10 +60,12 @@ include_lfp_HEADERS = \
src/include/lfp/aux.h \
src/include/lfp/stdlib.h \
src/include/lfp/string.h \
src/include/lfp/strerror.h \
src/include/lfp/errno.h \
src/include/lfp/fcntl.h \
src/include/lfp/stat.h \
src/include/lfp/unistd.h \
src/include/lfp/ioctl.h \
src/include/lfp/mman.h \
src/include/lfp/select.h \
src/include/lfp/socket.h \
......@@ -58,35 +73,47 @@ include_lfp_HEADERS = \
src/include/lfp/signal.h \
src/include/lfp/spawn.h \
src/include/lfp/dirent.h \
src/include/lfp/time.h \
$(top_builddir)/src/include/lfp/time.h \
src/include/lfp/resource.h \
src/include/lfp/sendfile.h \
src/include/lfp/syslog.h
src/include/lfp/syslog.h \
src/include/lfp/buildinfo.h
# src/include/lfp/signalfd.h
src_lib_libfixposix_la_SOURCES = \
src/libfixposix.libtool \
src/lib/stdlib.c \
src/lib/string.c \
src/lib/strerror.c \
src/lib/errno.c \
src/lib/fcntl.c \
src/lib/stat.c \
src/lib/unistd.c \
src/lib/ioctl.c \
src/lib/mman.c \
src/lib/select.c \
src/lib/socket.c \
src/lib/wait.c \
src/lib/signal.c \
src/lib/spawnattr.c \
src/lib/bitset.c \
src/lib/spawn_file_actions.c \
src/lib/spawn.c \
src/lib/dirent.c \
src/lib/time.c \
src/lib/resource.c \
src/lib/sendfile.c \
src/lib/syslog.c
src/lib/syslog.c \
src/lib/buildinfo.c
# src/lib/install_signalfd.c
src_lib_libfixposix_la_LIBADD = $(LFP_LDFLAGS)
src_lib_libfixposix_la_DEPENDENCIES = \
src/libfixposix.libtool
src_lib_libfixposix_la_LIBADD = $(LFP_LIBS)
src_lib_libfixposix_la_LDFLAGS = $(LFP_LDFLAGS) -no-undefined \
-version-info `@AWK@ '/^Version:/ { print $$2 }' $(top_srcdir)/src/libfixposix.libtool`
......@@ -96,22 +123,50 @@ src_lib_libfixposix_la_LIBADD = $(LFP_LDFLAGS)
# #
########################################################################
check_PROGRAMS = src/tests/spawn src/tests/select
if TESTS
check_SCRIPTS =
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' \
TOP_SRCDIR=$(top_srcdir) \
TOP_BUILDDIR=$(top_builddir) \
$(SHELL) $(top_srcdir)/config/aux/tap-driver.sh
TESTS = ${check_PROGRAMS} ${check_SCRIPTS}
XFAIL_TESTS =
compile_tests = \
src/tests/buildinfo
run_tests = \
src/tests/spawn \
src/tests/select \
src/tests/mkstemp
# src_tests_signalfd_SOURCES = src/tests/signalfd.c
check_PROGRAMS = $(compile_tests) $(run_tests)
# src_tests_signalfd_LDADD = src/lib/libfixposix.la
check_SCRIPTS = \
src/tests/buildinfo.bats
src_tests_spawn_SOURCES = src/tests/spawn.c
# Bats tests must be created by /.configure to get the correct path of
# the Bats interpreter, but the configure script fails to preserve the
# execute bit, so we restore it here.
%.bats: %.bats.in $(top_builddir)/Makefile
sed 's:\@BATSPATH\@:$(BATSPATH):' < $< > $@
chmod +x $@
src_tests_spawn_LDADD = src/lib/libfixposix.la
TESTS = ${run_tests} ${check_SCRIPTS}
XFAIL_TESTS =
src_tests_buildinfo_SOURCES = src/tests/buildinfo.c
src_tests_buildinfo_CFLAGS = @CHECK_CFLAGS@
src_tests_buildinfo_LDADD = @CHECK_LIBS@ $(top_builddir)/src/lib/libfixposix.la
src_tests_spawn_SOURCES = src/tests/spawn.c
src_tests_spawn_CFLAGS = @CHECK_CFLAGS@
src_tests_spawn_LDADD = @CHECK_LIBS@ $(top_builddir)/src/lib/libfixposix.la
src_tests_select_SOURCES = src/tests/select.c
src_tests_select_CFLAGS = @CHECK_CFLAGS@
src_tests_select_LDADD = @CHECK_LIBS@ $(top_builddir)/src/lib/libfixposix.la
src_tests_mkstemp_SOURCES = src/tests/mkstemp.c
src_tests_mkstemp_CFLAGS = @CHECK_CFLAGS@
src_tests_mkstemp_LDADD = @CHECK_LIBS@ $(top_builddir)/src/lib/libfixposix.la
src_tests_select_LDADD = src/lib/libfixposix.la
endif
-*- outline -*-
-*- markdown -*-
The purpose of libfixposix is to offer replacements for parts of POSIX
whose behaviour is inconsistent across *NIX flavours.
......@@ -7,9 +7,10 @@ whose behaviour is inconsistent across *NIX flavours.
If you've downloaded this library through git, you'll first need to
generate the ./configure script; in order to do that you need to have
at least autoconf-2.67, automake-1.10 and libtool-2.2.6b and run
this inside the top directory:
> autoreconf -i
at least autoconf-2.67, automake-1.10, libtool-2.2.6b, pkg-config and check (for
the test suite: see http://check.sf.net) then run this inside the top
directory:
> autoreconf -i -f
For best results use a dedicated build directory instead of running
the configure script directly in the source tree:
......@@ -20,3 +21,14 @@ the configure script directly in the source tree:
On Linux, you might need to run «ldconfig» as superuser after
installing, otherwise the *nix linker won't be able to find the library
* Installation through distro repositories
For a certain number of Linux distributions, there are officially
supported repositories.
You can find the instructions to configure the binary repository at
https://software.opensuse.org/download.html?project=home:sionescu&package=libfixposix.
Just click on your distribution, if present.
http://article.gmane.org/gmane.lisp.iolib.devel/422 also has a set of
older instructions about installing on Debian-based distros.
# -*- Autoconf -*-
AC_DEFUN([LFP_TESTS_CHECK], [
AC_ARG_ENABLE([tests],
[AS_HELP_STRING([--enable-tests],
[enable test suite using CHECK @<:@default=no@:>@])],
[],
[enable_tests=no])
AS_CASE($enable_tests,
[yes], [PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
AC_SUBST([CHECK_CFLAGS])
AC_SUBST([CHECK_LIBS])],
[no], [],
AC_MSG_ERROR(
[--enable-tests was given an illegal value: "$enable_tests"])
)
AM_CONDITIONAL(TESTS, test x$enable_tests = xyes)
])
AC_DEFUN([LFP_INIT], [
# Build flags
LFP_CFLAGS=""
AC_SUBST(LFP_CFLAGS)
LFP_LDFLAGS=""
AC_SUBST(LFP_LDFLAGS)
LFP_LIBS=""
AC_SUBST(LFP_LIBS)
# Version Info
major=`echo $1 | cut -d . -f 1`
AC_SUBST(LFP_MAJOR_VERSION, $major)
minor=`echo $1 | cut -d . -f 2`
AC_SUBST(LFP_MINOR_VERSION, $minor)
micro=`echo $1 | cut -d . -f 3`
AC_SUBST(LFP_MICRO_VERSION, $micro)
AC_CHECK_PROG([GIT], [git], [yes])
if test "x$ac_cv_prog_GIT" = xyes
then
vcsid=`git rev-parse --short HEAD`
fi
AC_SUBST(LFP_VCSID, $vcsid)
])
AC_DEFUN([LFP_SYS_PLATFORM_SPECIFIC_DEFINITIONS], [
case "$host_os" in
linux*)
LFP_CFLAGS="$LFP_CFLAGS -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1"
;;
freebsd*)
LFP_CFLAGS="$LFP_CFLAGS -D_XOPEN_SOURCE=600 -D__BSD_VISIBLE"
;;
netbsd*)
LFP_CFLAGS="$LFP_CFLAGS -D_XOPEN_SOURCE=600 -D_NETBSD_SOURCE"
;;
openbsd*)
LFP_CFLAGS="$LFP_CFLAGS -D__BSD_VISIBLE"
;;
darwin*)
LFP_CFLAGS="$LFP_CFLAGS -D_DARWIN_C_SOURCE"
;;
sunos* | solaris*)
LFP_CFLAGS="$LFP_CFLAGS -D_XOPEN_SOURCE=600 -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS"
;;
esac
])
AC_DEFUN([LFP_SYS_LARGEFILE], [
LFP_GETCONF_UNDEF([LFS_CFLAGS], [LFS_CFLAGS])
LFP_GETCONF_UNDEF([LFS_LDFLAGS], [LFS_LDFLAGS])
LFP_GETCONF_UNDEF([LFS_LIBS], [LFS_LIBS])
])
AC_DEFUN([LFP_CHECK_POSIX_REALTIME_CLOCK_TYPES], [
LFP_REQUIRE_TYPE([clockid_t], [sys/time.h time.h])
AC_SUBST([HAVE_CLOCKID_T], [1])
LFP_REQUIRE_DECL([CLOCK_REALTIME], [sys/time.h time.h])
LFP_REQUIRE_DECL([CLOCK_MONOTONIC], [sys/time.h time.h])
])
AC_DEFUN([LFP_CHECK_POSIX_REALTIME_CLOCK_ALTERNATIVES], [
case "$host_os" in
darwin*)
LFP_REQUIRE_HEADERS([mach/mach.h mach/clock.h])
LFP_REQUIRE_FUNCS([host_get_clock_service clock_get_attributes])
dnl LFP_REQUIRE_DECL([CLOCK_GET_TIME_RES], [mach/mach.h mach/clock.h])
dnl LFP_REQUIRE_DECL([CALENDAR_CLOCK], [mach/mach.h mach/clock.h])
dnl LFP_REQUIRE_DECL([REALTIME_CLOCK], [mach/mach.h mach/clock.h])
;;
*)
AC_MSG_ERROR([clock_gettime not found and no workaround available])
;;
esac
])
AC_DEFUN([LFP_REQUIRE_MONOTONIC_CLOCK], [
LFP_SEARCH_LIBS([clock_gettime], [rt], [
AC_SUBST([HAVE_CLOCK_GETTIME], [1])
LFP_CHECK_POSIX_REALTIME_CLOCK_TYPES
AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
[We have the function clock_gettime()])],
[AC_SUBST([HAVE_CLOCK_GETTIME], [0])
AC_SUBST([HAVE_CLOCKID_T], [0])
LFP_CHECK_POSIX_REALTIME_CLOCK_ALTERNATIVES])
])
AC_DEFUN([LFP_REQUIRE_GETPEEREID], [
AC_CHECK_FUNCS([getpeereid],
[AC_DEFINE([HAVE_GETPEEREID], [1], [We have the function getpeereid()])],
AC_CHECK_FUNCS([getpeerucred],
[LFP_REQUIRE_HEADERS([ucred.h])
AC_DEFINE([HAVE_GETPEERUCRED], [1], [We have the function getpeerucred()])],
[LFP_REQUIRE_DECL([SO_PEERCRED], [sys/types.h sys/socket.h])]))
])
AC_DEFUN([LFP_ARG_ENABLE_EMULATED_SIGNALFD], [
AC_ARG_ENABLE([emulated-signalfd],
[AS_HELP_STRING([--enable-emulated-signalfd={yes|no|check}],
[Use emulated signalfd @<:@default=check@:>@])],
[],
[enable_emulated_signalfd=check])
AS_CASE($enable_emulated_signalfd,
[yes], [AC_DEFINE(HAVE_EMULATED_SIGNALFD, 1, [Whether to use signalfd emulation])
AC_SUBST(HAVE_EMULATED_SIGNALFD, 1)
],
[check], [if test x"$ac_cv_header_sys_signalfd_h" = xyes ; then
AC_DEFINE(HAVE_EMULATED_SIGNALFD, 0, [Whether to use signalfd emulation])
AC_SUBST(HAVE_EMULATED_SIGNALFD, 0)
else
AC_DEFINE(HAVE_EMULATED_SIGNALFD, 1, [Whether to use signalfd emulation])
AC_SUBST(HAVE_EMULATED_SIGNALFD, 1)
fi],
[no], [if test x"$ac_cv_header_sys_signalfd_h" = xyes ; then
AC_DEFINE(HAVE_EMULATED_SIGNALFD, 0, [Whether to use signalfd emulation])
AC_SUBST(HAVE_EMULATED_SIGNALFD, 0)
else
AC_MSG_FAILURE([signalfd emulation was disabled although <sys/signalfd.h> is absent])
fi],
[AC_MSG_FAILURE(
[--enable-emulated-signalfd was given an illegal value: "$enable_emulated_signalfd"])])
])
# -*- Autoconf -*-
AC_DEFUN([LFP_SAVE_FLAGS], [
_lfp_saved_cppflags_$1=$CPPFLAGS
_lfp_saved_cflags_$1=$CFLAGS
_lfp_saved_ldflags_$1=$LDFLAGS
_lfp_saved_libs_$1=$LIBS
CPPFLAGS="$LFP_CPPFLAGS"
CFLAGS="$LFP_CFLAGS"
LDFLAGS="$LFP_LDFLAGS"
LIBS="$LFP_LIBS"
])
AC_DEFUN([LFP_RESTORE_FLAGS], [
CPPFLAGS="$_lfp_saved_cppflags_$1"
CFLAGS="$_lfp_saved_cflags_$1"
LDFLAGS="$_lfp_saved_ldflags_$1"
LIBS="$_lfp_saved_libs_$1"
])
# Check for some headers and print an error if not found
AC_DEFUN([LFP_REQUIRE_HEADERS], [
LFP_SAVE_FLAGS(AS_TR_CPP($1))
AC_CHECK_HEADERS($1,,AC_MSG_FAILURE([Cannot find header $ac_header]))
LFP_RESTORE_FLAGS(AS_TR_CPP($1))
])
# Check for a function and print an error if not found
AC_DEFUN([LFP_REQUIRE_FUNCS], [
LFP_SAVE_FLAGS(AS_TR_CPP($1))
AC_CHECK_FUNCS($1,,AC_MSG_FAILURE([Cannot find function $ac_func]))
LFP_RESTORE_FLAGS(AS_TR_CPP($1))
])
# Check for a type and print an error if not found
AC_DEFUN([LFP_REQUIRE_TYPE], [
LFP_SAVE_FLAGS(AS_TR_CPP($1))
AC_CHECK_TYPES($1,,AC_MSG_FAILURE([Cannot find type $1 in $2]),
[m4_foreach_w([header], [$2], [[#]include [<]header[>]
])])
LFP_RESTORE_FLAGS(AS_TR_CPP($1))
])
# Check for a declaration and print an error if not found
AC_DEFUN([LFP_REQUIRE_DECL], [
LFP_SAVE_FLAGS(AS_TR_CPP($1))
AC_CHECK_DECL($1,,AC_MSG_FAILURE([Cannot find $1 in <$2>]),
[m4_foreach_w([header], [$2], [[#]include [<]header[>]
])])
LFP_RESTORE_FLAGS(AS_TR_CPP($1))
])
# Check for a library and print an error if not found
AC_DEFUN([LFP_SEARCH_LIBS], [
LFP_SAVE_FLAGS(AS_TR_CPP($1))
AC_SEARCH_LIBS($1,$2,$3
[if test -n "$LIBS"; then LFP_LIBS="$LFP_LIBS $LIBS"; fi],
m4_default_nblank_quoted([$4],AC_MSG_FAILURE([Cannot find $1 in <$2>])))
LFP_RESTORE_FLAGS(AS_TR_CPP($1))
])
AC_DEFUN([LFP_REQUIRE_PROG], [
AC_CHECK_PROG($1, $2, [yes])
if test "x$ac_cv_prog_$1" != xyes
then
AC_MSG_FAILURE([Program $2 not found])
fi
])
# Check for a declaration and print an error if not found
# Syntax: LFP_GETCONF(VARIABLE, SYSTEM_VAR,
# ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
AC_DEFUN([LFP_GETCONF], [
$1=`(getconf $2) 2>/dev/null`
AC_SUBST($1)
if test $? -eq 0 ; then
: ; $3
else
: ; $4
fi
])
# Check for a declaration and print an error if not found or is undefined
# Syntax: LFP_GETCONF(VARIABLE, SYSTEM_VAR,
# ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
AC_DEFUN([LFP_GETCONF_UNDEF], [
$1=`(getconf $2) 2>/dev/null`
AC_SUBST($1)
if test $? -eq 0 && test x"$$1" != xundefined ; then
: ; $3
else
: ; $4
fi
])
......@@ -9,19 +9,33 @@ dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dnl Minimum Autoconf version required.
AC_INIT([LibFixPOSIX], [0.1], [iolib-devel@common-lisp.net],
[libfixposix], [http://common-lisp.net/project/iolib/])
AC_PREREQ([2.67])
AC_INIT([LibFixPOSIX], m4_esyscmd_s([cat VERSION]),
[iolib-devel@common-lisp.net],
[libfixposix], [https://github.com/sionescu/libfixposix])
AC_COPYRIGHT([Copyright © 2010-2018 Stelian Ionescu <sionescu@cddr.org>])
AC_MSG_NOTICE([srcdir: $srcdir])
AC_MSG_NOTICE([builddir: $builddir])
AC_MSG_NOTICE([CPPFLAGS: $CPPFLAGS])
AC_MSG_NOTICE([CFLAGS: $CFLAGS])
AC_MSG_NOTICE([LDFLAGS: $LDFLAGS])
AS_IF([test "`/bin/pwd`" = "`cd $srcdir; /bin/pwd`"], [
AC_MSG_WARN([you should configure in a separate build directory])
])
AC_CONFIG_HEADERS([config.h])
dnl Where to generate output; srcdir location.
AC_CONFIG_SRCDIR([src/lib/spawn.c])
dnl Auxiliary M4 macros
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_MACRO_DIR([config/m4])
dnl Must come before AM_INIT_AUTOMAKE.
AC_CONFIG_AUX_DIR([.build-aux])
AC_CONFIG_AUX_DIR([config/aux])
AM_INIT_AUTOMAKE([1.10 foreign silent-rules subdir-objects
color-tests parallel-tests])
......@@ -31,49 +45,68 @@ AM_SILENT_RULES([yes])
dnl Contains replacement functions
# AC_CONFIG_LIBOBJ_DIR([lib])
AC_LANG([C])
dnl Checks for programs.
# We need a C compiler.
AC_PROG_CC_C99
AC_PROG_AWK
# And we need libtool for building the shared library
LT_INIT
LT_INIT([pic-only disable-static disable-fast-install])
LT_PREREQ([2.2.6])
LFP_FLAGS_INIT
AC_SUBST([PACKAGE_VERSION])
LFP_INIT($PACKAGE_VERSION)
dnl Checks for programs
AC_CHECK_PROG([GETCONF], [getconf], [yes])
if test "x$ac_cv_prog_GETCONF" != xyes
then
AC_MSG_FAILURE([Program getconf not found])
fi
LFP_REQUIRE_PROG([GETCONF], [getconf])
dnl Set compiler & linker flags
LFP_SYS_PLATFORM_SPECIFIC_DEFINITIONS
AX_PTHREAD
LFP_SYS_LARGEFILE
LFP_CPPFLAGS+=" $LFS_CFLAGS"
LFP_CFLAGS+=" $PTHREAD_CFLAGS"
LFP_LDFLAGS+=" $PTHREAD_LIBS $LFS_LDFLAGS $LFS_LIBS"
dnl Checks for C99 & POSIX headers
AC_HEADER_ASSERT
AC_HEADER_STDBOOL
LFP_REQUIRE_HEADERS([stdlib.h stdio.h string.h errno.h time.h])
LFP_REQUIRE_HEADERS([sys/types.h unistd.h fcntl.h signal.h])
AC_CHECK_HEADER([sys/signalfd.h])
LFP_REQUIRE_HEADERS([sys/types.h unistd.h fcntl.h sys/signal.h signal.h])
LFP_CFLAGS="$LFP_CFLAGS $LFS_CFLAGS $PTHREAD_CFLAGS"
LFP_LDFLAGS="$LFP_LDFLAGS $LFS_LDFLAGS"
LFP_LIBS="$LFP_LIBS $PTHREAD_LIBS $LFS_LIBS"
dnl Checks for declarations
LFP_REQUIRE_DECLS([NSIG], [signal.h])
LFP_REQUIRE_DECL([TIOCSCTTY], [sys/ioctl.h])
LFP_REQUIRE_DECL([NSIG], [sys/types.h sys/signal.h signal.h])
LFP_REQUIRE_DECL([IP_HDRINCL], [sys/types.h sys/socket.h netinet/in.h])
dnl Checks for non-standard headers
AC_CHECK_HEADER([sys/signalfd.h])
dnl Checks for functions
AC_CHECK_FUNCS([__xpg_strerror_r strnlen strndup])
AC_CHECK_FUNCS([accept4 pipe2 sendfile])
LFP_REQUIRE_FUNCS([pselect vsyslog])
LFP_CHECK_POSIX_MONOTONIC_CLOCK
AC_CHECK_FUNCS([__xpg_strerror_r strnlen strndup clearenv])
LFP_REQUIRE_FUNCS([strtok_r])
LFP_SEARCH_LIBS([socket], [socket nsl])
AC_CHECK_FUNCS([accept4 pipe2 sendfile pselect ptsname_r])
LFP_REQUIRE_FUNCS([vsyslog ptsname posix_openpt])
LFP_REQUIRE_MONOTONIC_CLOCK
LFP_REQUIRE_GETPEEREID
dnl Checks for types
dnl Configuration switches
# LFP_ARG_ENABLE_EMULATED_SIGNALFD
AC_CONFIG_FILES([Makefile libfixposix.pc])
# Test suite.
LFP_TESTS_CHECK
AC_SUBST([BATSPATH], [$srcdir/src/tests/lib])
AC_CONFIG_FILES([Makefile
libfixposix.spec
src/libfixposix.pc
src/lib/buildinfo.c
src/include/lfp/time.h])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AC_OUTPUT
libfixposix (1:0.4.3-1) unstable; urgency=medium
* Team upload.
* New upstream release (epoch added since we're moving to a numbered
version scheme).
* Update Vcs-* fields for move to salsa.
* Set Maintainer to debian-common-lisp@l.d.o.
* Use secure URL for Homepage.
* Fix d/watch.
* d/copyright:
+ reflect upstream changes
+ fix Format field
* Bump to debhelper compat level 11.
* Bump SOVERSION of libfixposix (0->3).
* Multi-archify the package.
* Ship README.md.
* Remove duplicate Section field for libfixposix-dev.
* Bump Standards-Version to 4.1.4.
* Add symbols file.
* Add Build-Depends on pkg-config (needed for autoreconf).
-- Sébastien Villemot <sebastien@debian.org> Thu, 12 Apr 2018 12:56:50 +0200
libfixposix (20110316.git47f17f7-1) unstable; urgency=low
* delete unnecessary debian/*.dirs
......
Source: libfixposix
Priority: optional
Maintainer: Debian Common Lisp Team <pkg-common-lisp-devel@lists.alioth.debian.org>
Maintainer: Debian Common Lisp Team <debian-common-lisp@lists.debian.org>
Uploaders: Desmond O. Chang <dochang@gmail.com>
Build-Depends: debhelper (>= 7.0.50~), dh-autoreconf,
autoconf (>= 2.67-1~), automake (>= 1:1.11-1~), libtool (>= 2.2.6b-1~)
Standards-Version: 3.9.1
Build-Depends: debhelper (>= 11~),
pkg-config
Standards-Version: 4.1.4
Section: libdevel
Homepage: http://common-lisp.net/project/iolib/
Vcs-Git: git://git.debian.org/pkg-common-lisp/libfixposix.git
Vcs-Browser: http://git.debian.org/?p=pkg-common-lisp/libfixposix.git;a=summary
Homepage: https://common-lisp.net/project/iolib/
Vcs-Git: https://salsa.debian.org/common-lisp-team/libfixposix.git
Vcs-Browser: https://salsa.debian.org/common-lisp-team/libfixposix
Package: libfixposix-dev
Section: libdevel
Architecture: any
Depends: libfixposix0 (= ${binary:Version}), ${misc:Depends}
Multi-Arch: same
Depends: libfixposix3 (= ${binary:Version}), ${misc:Depends}
Description: Replacement for inconsistent parts of POSIX (development)
The purpose of libfixposix is to offer replacements for parts of
POSIX whose behaviour is inconsistent across *NIX flavours.
.
This package contains the headers and static library files.
Package: libfixposix0
Package: libfixposix3
Section: libs
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Replacement for inconsistent parts of POSIX (runtime)
The purpose of libfixposix is to offer replacements for parts of
......
Format: http://dep.debian.net/deps/dep5/
Upstream-Name: libfixposix
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: LibFixPOSIX
Upstream-Contact: Stelian Ionescu <sionescu@cddr.org>
Source: http://common-lisp.net/project/iolib/
Source: https://common-lisp.net/project/iolib/
Files: *
Copyright: 2010 Stelian Ionescu <sionescu@cddr.org>
Copyright: 2010-2018 Stelian Ionescu <sionescu@cddr.org>
2010 Francois-Rene Rideau <fare@tunes.org>
License: BSL
License: BSL-1.0
Files: config/m4/ax_pthread.m4
Copyright: 2008 Steven G. Johnson <stevenj@alum.mit.edu>
License: GPL-3+
Files: debian/*
Copyright: 2010 Desmond O. Chang <dochang@gmail.com>
License: BSL
2018 Sébastien Villemot <sebastien@debian.org>
License: BSL-1.0
License: BSL
License: BSL-1.0
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
......@@ -34,3 +39,12 @@ License: BSL
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
License: GPL-3+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 3 dated June, 2007, or (at
your option) any later version.
.
On Debian systems, the complete text of version 3 of the GNU General
Public License can be found in '/usr/share/common-licenses/GPL-3'.
usr/include/*
usr/lib/lib*.a
usr/lib/lib*.so
usr/lib/pkgconfig/*
usr/lib/*.la
usr/lib/*/lib*.a
usr/lib/*/lib*.so
usr/lib/*/pkgconfig/
libfixposix.so.3 libfixposix3 #MINVER#
lfp_accept@Base 1:0.4.3
lfp_buildinfo@Base 1:0.4.3
lfp_clearenv@Base 1:0.4.3
lfp_clock_getres@Base 1:0.4.3
lfp_clock_gettime@Base 1:0.4.3
lfp_clock_settime@Base 1:0.4.3
lfp_closedir@Base 1:0.4.3
lfp_closelog@Base 1:0.4.3
lfp_cmsg_data@Base 1:0.4.3
lfp_cmsg_firsthdr@Base 1:0.4.3
lfp_cmsg_len@Base 1:0.4.3
lfp_cmsg_nxthdr@Base 1:0.4.3
lfp_cmsg_space@Base 1:0.4.3
lfp_creat@Base 1:0.4.3
lfp_errno@Base 1:0.4.3
lfp_execve@Base 1:0.4.3
lfp_execvpe@Base 1:0.4.3
lfp_fd_clr@Base 1:0.4.3
lfp_fd_isset@Base 1:0.4.3
lfp_fd_set@Base 1:0.4.3
lfp_fd_zero@Base 1:0.4.3
lfp_fstat@Base 1:0.4.3
lfp_ftruncate@Base 1:0.4.3
lfp_get_environ@Base 1:0.4.3
lfp_getpath@Base 1:0.4.3
lfp_getpeereid@Base 1:0.4.3
lfp_getrlimit@Base 1:0.4.3
lfp_is_fd_cloexec@Base 1:0.4.3
lfp_is_fd_nonblock@Base 1:0.4.3
lfp_is_fd_open@Base 1:0.4.3
lfp_isblk@Base 1:0.4.3
lfp_ischr@Base 1:0.4.3
lfp_isdir@Base 1:0.4.3
lfp_isfifo@Base 1:0.4.3
lfp_islnk@Base 1:0.4.3
lfp_isreg@Base 1:0.4.3
lfp_issock@Base 1:0.4.3
lfp_log_mask@Base 1:0.4.3
lfp_log_upto@Base 1:0.4.3
lfp_lseek@Base 1:0.4.3
lfp_lstat@Base 1:0.4.3
lfp_mkostemp@Base 1:0.4.3
lfp_mkstemp@Base 1:0.4.3
lfp_mmap@Base 1:0.4.3
lfp_munmap@Base 1:0.4.3
lfp_open@Base 1:0.4.3
lfp_opendir@Base 1:0.4.3
lfp_openlog@Base 1:0.4.3
lfp_openpt@Base 1:0.4.3
lfp_parse_memsize@Base 1:0.4.3
lfp_pipe@Base 1:0.4.3
lfp_pread@Base 1:0.4.3
lfp_ptsname@Base 1:0.4.3
lfp_pwrite@Base 1:0.4.3
lfp_readdir@Base 1:0.4.3
lfp_rewinddir@Base 1:0.4.3
lfp_seekdir@Base 1:0.4.3
lfp_select@Base 1:0.4.3
lfp_sendfile@Base 1:0.4.3
lfp_set_environ@Base 1:0.4.3
lfp_set_errno@Base 1:0.4.3
lfp_set_fd_cloexec@Base 1:0.4.3
lfp_set_fd_nonblock@Base 1:0.4.3
lfp_setlogmask@Base 1:0.4.3
lfp_setrlimit@Base 1:0.4.3
lfp_sig_dfl@Base 1:0.4.3
lfp_sig_err@Base 1:0.4.3
lfp_sig_hold@Base 1:0.4.3
lfp_sig_ign@Base 1:0.4.3
lfp_sigrtmax@Base 1:0.4.3
lfp_sigrtmin@Base 1:0.4.3
lfp_socket@Base 1:0.4.3
lfp_spawn@Base 1:0.4.3
lfp_spawn_file_actions_addclose@Base 1:0.4.3
lfp_spawn_file_actions_adddup2@Base 1:0.4.3
lfp_spawn_file_actions_addkeep@Base 1:0.4.3
lfp_spawn_file_actions_addopen@Base 1:0.4.3
lfp_spawn_file_actions_destroy@Base 1:0.4.3
lfp_spawn_file_actions_init@Base 1:0.4.3
lfp_spawnattr_destroy@Base 1:0.4.3
lfp_spawnattr_getctty@Base 1:0.4.3
lfp_spawnattr_getcwd@Base 1:0.4.3
lfp_spawnattr_getflags@Base 1:0.4.3
lfp_spawnattr_getgid@Base 1:0.4.3
lfp_spawnattr_getpgroup@Base 1:0.4.3
lfp_spawnattr_getsigdefault@Base 1:0.4.3
lfp_spawnattr_getsigmask@Base 1:0.4.3
lfp_spawnattr_getuid@Base 1:0.4.3
lfp_spawnattr_init@Base 1:0.4.3
lfp_spawnattr_setctty@Base 1:0.4.3
lfp_spawnattr_setcwd@Base 1:0.4.3
lfp_spawnattr_setflags@Base 1:0.4.3
lfp_spawnattr_setgid@Base 1:0.4.3
lfp_spawnattr_setpgroup@Base 1:0.4.3
lfp_spawnattr_setsid@Base 1:0.4.3
lfp_spawnattr_setsigdefault@Base 1:0.4.3
lfp_spawnattr_setsigmask@Base 1:0.4.3
lfp_spawnattr_setuid@Base 1:0.4.3
lfp_spawnp@Base 1:0.4.3
lfp_stat@Base 1:0.4.3
lfp_strerror@Base 1:0.4.3
lfp_strndup@Base 1:0.4.3
lfp_strnlen@Base 1:0.4.3
lfp_syslog@Base 1:0.4.3
lfp_telldir@Base 1:0.4.3
lfp_truncate@Base 1:0.4.3
lfp_tty_attach@Base 1:0.4.3
lfp_tty_fattach@Base 1:0.4.3
lfp_vsyslog@Base 1:0.4.3
lfp_wcoredump@Base 1:0.4.3
lfp_wexitstatus@Base 1:0.4.3
lfp_wifcontinued@Base 1:0.4.3
lfp_wifexited@Base 1:0.4.3
lfp_wifsignaled@Base 1:0.4.3
lfp_wifstopped@Base 1:0.4.3
lfp_wstopsig@Base 1:0.4.3
lfp_wtermsig@Base 1:0.4.3
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@ --with autoreconf
dh $@
override_dh_install:
dh_install
sed -e "s/^dependency_libs=.*/dependency_libs=''/" < src/lib/libfixposix.la > debian/libfixposix-dev/usr/lib/libfixposix.la
override_dh_auto_configure:
dh_auto_configure -- --enable-static
# Compulsory line, this is a version 3 file
version=3
# We track repository
# git://gitorious.org/libfixposix/libfixposix.git
version=4
opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%libfixposix-$1.tar.gz%" \
https://github.com/sionescu/libfixposix/tags \
(?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate
Name: libfixposix
Summary: POSIX syscall wrappers
Version: @PACKAGE_VERSION@
Release: 0
License: BSL-1.0
Group: Development/Libraries/C and C++
URL: https://github.com/sionescu/%{name}
Source: https://github.com/sionescu/%{name}/releases/download/v%{version}/%{name}_%{version}.tar.gz
%define srcdir %{name}
BuildRequires: check-devel pkgconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Thin wrapper over POSIX syscalls and some replacement functionality, most notably lfp_spawn().
%package -n libfixposix3
Summary: Shared library for libfixposix
Group: Development/Libraries/C and C++
%description -n libfixposix3
Thin wrapper over POSIX syscalls.
%package -n libfixposix-devel
Summary: Development files
Group: Development/Libraries/C and C++
Requires: glibc-devel
Requires: libfixposix3 = %{version}-%{release}
Provides: %{name}-static = %{version}-%{release}
%description devel
Header files, static libraries and API documentation for using libfixposix.
%prep
%setup -q -n %{srcdir}
%build
%configure --enable-static --with-pic --enable-tests
make %{?_smp_mflags}
%check
make %{?_smp_mflags} check
%install
make %{?_smp_mflags} DESTDIR=%{buildroot} install
find %{buildroot} -type f -name "*.la" -delete -print
%post -n libfixposix3 -p /sbin/ldconfig
%postun -n libfixposix3 -p /sbin/ldconfig
%files -n libfixposix3
%defattr(-,root,root)
%{_libdir}/lib*so.*
%files -n libfixposix-devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/lib*.so
%{_libdir}/lib*.a
%{_libdir}/pkgconfig/libfixposix.pc
# -*- Autoconf -*-
AC_DEFUN([LFP_FLAGS_INIT], [
LFP_CPPFLAGS="-D_XOPEN_SOURCE"
LFP_CFLAGS=""
LFP_LDFLAGS=""
AC_SUBST(LFP_CPPFLAGS)
AC_SUBST(LFP_CFLAGS)
AC_SUBST(LFP_LDFLAGS)
])
AC_DEFUN([LFP_SYS_PLATFORM_SPECIFIC_DEFINITIONS], [
case "$host" in
*-*-linux*)
LFP_CPPFLAGS+=" -D_GNU_SOURCE=1"
LFP_LDFLAGS+=" -lrt"
;;
*-*-freebsd*)
LFP_CPPFLAGS+=" -D__BSD_VISIBLE"
;;
*-apple-darwin*)
LFP_CPPFLAGS+=" -D_DARWIN_C_SOURCE"
;;
*-sunos*|*-solaris*)
LFP_CPPFLAGS+=" -D__EXTENSIONS__ -D_XPG4 -D_XPG4_2"
;;
esac
])
AC_DEFUN([LFP_SYS_LARGEFILE], [
LFP_GETCONF_UNDEF([LFS_CFLAGS], [LFS_CFLAGS])
LFP_GETCONF_UNDEF([LFS_LDFLAGS], [LFS_LDFLAGS])
LFP_GETCONF_UNDEF([LFS_LIBS], [LFS_LIBS])
])
AC_DEFUN([LFP_CHECK_SIZEOF_CLOCKID_T], [
AC_CHECK_TYPE([clockid_t],
[AC_CHECK_SIZEOF([clockid_t], [], [[#include <time.h>]])
if test "$ac_cv_sizeof_clockid_t" -gt 4 ; then
AC_MSG_FAILURE([Type clockid_t is larger than 32 bits])
fi],
[case "$host" in
*-apple-darwin*) : ;;
*) AC_MSG_FAILURE([Type clockid_t not found]) ;;
esac],
[[#include <time.h>]])
])
AC_DEFUN([LFP_CHECK_POSIX_MONOTONIC_CLOCK], [
LFP_GETCONF_UNDEF([POSIX_MONOTONIC_CLOCK], [_POSIX_MONOTONIC_CLOCK],
[LFP_CHECK_SIZEOF_CLOCKID_T],
[case "$host" in
*-apple-darwin*) : ;;
*) AC_MSG_FAILURE([Type clockid_t not found]) ;;
esac])
])
AC_DEFUN([LFP_ARG_ENABLE_EMULATED_SIGNALFD], [
AC_ARG_ENABLE([emulated-signalfd],
[AS_HELP_STRING([--enable-emulated-signalfd={yes|no|check}],
[Use emulated signalfd @<:@default=check@:>@])],
[],
[enable_emulated_signalfd=check])
AS_CASE($enable_emulated_signalfd,
[yes], [AC_DEFINE(HAVE_EMULATED_SIGNALFD, 1, [Whether to use signalfd emulation])
AC_SUBST(HAVE_EMULATED_SIGNALFD, 1)
],
[check], [if test x"$ac_cv_header_sys_signalfd_h" = xyes ; then
AC_DEFINE(HAVE_EMULATED_SIGNALFD, 0, [Whether to use signalfd emulation])
AC_SUBST(HAVE_EMULATED_SIGNALFD, 0)
else
AC_DEFINE(HAVE_EMULATED_SIGNALFD, 1, [Whether to use signalfd emulation])
AC_SUBST(HAVE_EMULATED_SIGNALFD, 1)
fi],
[no], [if test x"$ac_cv_header_sys_signalfd_h" = xyes ; then
AC_DEFINE(HAVE_EMULATED_SIGNALFD, 0, [Whether to use signalfd emulation])
AC_SUBST(HAVE_EMULATED_SIGNALFD, 0)
else
AC_MSG_FAILURE([signalfd emulation was disabled although <sys/signalfd.h> is absent])
fi],
[AC_MSG_FAILURE(
[--enable-emulated-signalfd was given an illegal value: "$enable_emulated_signalfd"])])
])
# -*- Autoconf -*-
# Check for some headers and print an error if not found
AC_DEFUN([LFP_REQUIRE_HEADERS],
[AC_CHECK_HEADERS($1,,AC_MSG_FAILURE([Cannot find header(s) $1]))])
# Check for a function and print an error if not found
AC_DEFUN([LFP_REQUIRE_FUNCS],
[AC_CHECK_FUNCS($1,,AC_MSG_FAILURE([Cannot find function(s) $1]))])
# Check for a type and print an error if not found
AC_DEFUN([LFP_REQUIRE_TYPE],
[AC_CHECK_TYPE($1,,AC_MSG_FAILURE([Cannot find type $1 in $2]),
[[#include <$2>]])])
# Check for a declaration and print an error if not found
AC_DEFUN([LFP_REQUIRE_DECLS],
[AC_CHECK_DECLS($1,,AC_MSG_FAILURE([Cannot find $1 in $2]),
[[#include <$2>]])])
# Check for a declaration and print an error if not found
# Syntax: LFP_GETCONF(VARIABLE, SYSTEM_VAR, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
AC_DEFUN([LFP_GETCONF], [
$1=`(getconf $2) 2>/dev/null`
AC_SUBST($1)
if test $? -eq 0 ; then
: ; $3
else
: ; $4
fi
])
# Check for a declaration and print an error if not found or is undefined
# Syntax: LFP_GETCONF(VARIABLE, SYSTEM_VAR, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
AC_DEFUN([LFP_GETCONF_UNDEF], [
$1=`(getconf $2) 2>/dev/null`
AC_SUBST($1)
if test $? -eq 0 && test x"$$1" != xundefined ; then
: ; $3
else
: ; $4
fi
])
......@@ -25,8 +25,6 @@
#if !defined(_LFP_H_)
# define _LFP_H_
#include <lfp/aux.h>
#include <lfp/stdlib.h>
#include <lfp/string.h>
......@@ -61,4 +59,6 @@
#include <lfp/syslog.h>
#include <lfp/buildinfo.h>
#endif /* _LFP_H_ */
......@@ -26,14 +26,24 @@
# define _LFP_AUX_H_
#if defined(__cplusplus)
# define CPLUSPLUS_GUARD extern "C" {
# define END_CPLUSPLUS_GUARD }
# define LFP_BEGIN_DECLS extern "C" {
#else
# define CPLUSPLUS_GUARD
# define END_CPLUSPLUS_GUARD
# define LFP_BEGIN_DECLS
#endif
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
#if defined(__cplusplus)
# define LFP_END_DECLS }
#else
# define LFP_END_DECLS
#endif
#ifdef GCC
# define ATTRIBUTE_NONNULL __attribute__((nonnull (1)))
#else
# define ATTRIBUTE_NONNULL
#endif
#if (__STDC_VERSION__ - 0) < 199901L
// only C99 has restricted pointers
# define restrict
#endif
......
/*******************************************************************************/
/* Permission is hereby granted, free of charge, to any person or organization */
/* obtaining a copy of the software and accompanying documentation covered by */
/* this license (the "Software") to use, reproduce, display, distribute, */
/* execute, and transmit the Software, and to prepare derivative works of the */
/* Software, and to permit third-parties to whom the Software is furnished to */
/* do so, all subject to the following: */
/* */
/* The copyright notices in the Software and this entire statement, including */
/* the above license grant, this restriction and the following disclaimer, */
/* must be included in all copies of the Software, in whole or in part, and */
/* all derivative works of the Software, unless such copies or derivative */
/* works are solely in the form of machine-executable object code generated by */
/* a source language processor. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
/* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT */
/* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE */
/* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, */
/* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER */
/* DEALINGS IN THE SOFTWARE. */
/*******************************************************************************/
#if !defined(_LFP_BUILDINFO_H_)
# define _LFP_BUILDINFO_H_
#include <lfp/aux.h>
#include <lfp/unistd.h>
LFP_BEGIN_DECLS
struct lfp_buildinfo {
uint64_t release;
char vcsid[32+1];
};
int lfp_buildinfo(struct lfp_buildinfo *v);
LFP_END_DECLS
#endif /* _LFP_BUILDINFO_H_ */
......@@ -27,12 +27,22 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <dirent.h>
DIR* lfp_opendir(const char *name);
int lfp_readdir(DIR *dirp, struct dirent *entry, struct dirent **result);
END_CPLUSPLUS_GUARD
long lfp_telldir(DIR *dirp);
void lfp_seekdir(DIR *dirp, long offset);
void lfp_rewinddir(DIR *dirp);
int lfp_closedir(DIR *dirp);
LFP_END_DECLS
#endif /* _LFP_DIRENT_H_ */
......@@ -27,7 +27,7 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <errno.h>
......@@ -37,6 +37,6 @@ int lfp_errno(void);
int lfp_set_errno(int value);
END_CPLUSPLUS_GUARD
LFP_END_DECLS
#endif /* _LPF_ERRNO_H_ */
......@@ -27,15 +27,13 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <fcntl.h>
#include <inttypes.h>
#include <stdbool.h>
extern char **environ;
#if !defined(O_CLOEXEC)
// Syscalls use "int" for passing flags, and since
// *nix systems use the LP64 data model, "int" is 32 bits
......@@ -58,6 +56,6 @@ int lfp_is_fd_nonblock(int fd);
int lfp_set_fd_nonblock(int fd, bool enabled);
END_CPLUSPLUS_GUARD
LFP_END_DECLS
#endif /* _LFP_FCNTL_H_ */
......@@ -22,46 +22,22 @@
/* DEALINGS IN THE SOFTWARE. */
/*******************************************************************************/
#if !defined(_LFP_INTERNAL_UTILS_H_)
# define _LFP_INTERNAL_UTILS_H_
#if !defined(_LFP_IOCTL_H_)
# define _LFP_IOCTL_H_
#include <sys/types.h>
#include <sys/time.h>
#include <errno.h>
#if defined(__APPLE__)
# include <mach/mach.h>
#endif
static inline void
_lfp_timespec_to_timeval(struct timespec *ts, struct timeval *tv)
{
tv->tv_sec = ts->tv_sec;
tv->tv_usec = ts->tv_nsec / 1000;
}
#include <lfp/aux.h>
static inline void
_lfp_timeval_to_timespec(struct timeval *tv, struct timespec *ts)
{
ts->tv_sec = tv->tv_sec;
ts->tv_nsec = tv->tv_usec * 1000;
}
LFP_BEGIN_DECLS
#if defined(__APPLE__)
static inline void
_lfp_timespec_to_mach_timespec_t(struct timespec *ts, mach_timespec_t *mts)
{
mts->tv_sec = ts->tv_sec;
mts->tv_nsec = ts->tv_nsec;
}
#endif
#include <sys/types.h>
#include <sys/ioctl.h>
#define SYSERR(errcode) do { errno = errcode; return -1; } while(0)
#include <inttypes.h>
#define SYSCHECK(errcode,expr) do { if(expr) SYSERR(errcode); } while(0)
int lfp_tty_attach(const char *path);
#define SYSGUARD(expr) do { if((expr) < 0) return(-1); } while(0)
int lfp_tty_fattach(int fd);
/* not checking for OPEN_MAX, which might not be valid, on Linux */
#define INVALID_FD(fd) ( fd < 0 )
LFP_END_DECLS
#endif /* _LFP_INTERNAL_UTILS_H_ */
#endif /* _LFP_IOCTL_H_ */
......@@ -27,15 +27,15 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <sys/mman.h>
void *lfp_mmap(void *addr, size_t length, int prot,
void* lfp_mmap(void *addr, size_t length, int prot,
int flags, int fd, off_t offset);
int lfp_munmap(void *addr, size_t length);
END_CPLUSPLUS_GUARD
LFP_END_DECLS
#endif /* _LFP_MMAN_H_ */
......@@ -27,7 +27,7 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <sys/resource.h>
......@@ -35,6 +35,6 @@ int lfp_getrlimit(int resource, struct rlimit *rlim);
int lfp_setrlimit(int resource, const struct rlimit *rlim);
END_CPLUSPLUS_GUARD
LFP_END_DECLS
#endif /* _LPF_RESOURCE_H_ */
......@@ -27,9 +27,10 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <sys/select.h>
#include <string.h>
#include <stdbool.h>
......@@ -44,6 +45,6 @@ void lfp_fd_set(int fd, fd_set *set);
void lfp_fd_zero(fd_set *set);
END_CPLUSPLUS_GUARD
LFP_END_DECLS
#endif /* _LFP_SELECT_H_ */
......@@ -27,12 +27,12 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <sys/types.h>
ssize_t lfp_sendfile(int out_fd, int in_fd, off_t offset, size_t nbytes);
END_CPLUSPLUS_GUARD
LFP_END_DECLS
#endif /* _LFP_SENDFILE_H_ */
......@@ -27,8 +27,10 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <sys/types.h>
#include <sys/signal.h>
#include <signal.h>
typedef void (*lfp_sighandler_t) (int);
......@@ -45,6 +47,6 @@ int lfp_sigrtmin(void);
int lfp_sigrtmax(void);
END_CPLUSPLUS_GUARD
LFP_END_DECLS
#endif /* _LFP_SIGNAL_H_ */
......@@ -27,7 +27,7 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <lfp/signal.h>
......@@ -45,6 +45,6 @@ int lfp_install_signalfd(int signum, int sa_flags, bool* blockp);
int lfp_uninstall_signalfd(int signum, bool block);
END_CPLUSPLUS_GUARD
LFP_END_DECLS
#endif /* _LFP_SIGNALFD_H_ */
......@@ -27,8 +27,9 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <sys/types.h>
#include <sys/socket.h>
#include <inttypes.h>
......@@ -50,6 +51,8 @@ size_t lfp_cmsg_len(size_t length);
void* lfp_cmsg_data(struct cmsghdr* cmsg);
END_CPLUSPLUS_GUARD
int lfp_getpeereid(int socket, uid_t *euid, gid_t *egid);
LFP_END_DECLS
#endif /* _LFP_SOCKET_H_ */
......@@ -27,7 +27,7 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <lfp/fcntl.h>
#include <lfp/signal.h>
......@@ -36,9 +36,12 @@ CPLUSPLUS_GUARD
#include <sys/types.h>
typedef struct {
int initialized;
int allocated;
uint initialized;
uint allocated;
struct lfp_spawn_action *actions;
bool keep_descriptors;
int *kfd;
int kfd_size;
} lfp_spawn_file_actions_t;
int lfp_spawn_file_actions_init(lfp_spawn_file_actions_t *file_actions);
......@@ -55,6 +58,9 @@ int lfp_spawn_file_actions_addclose(lfp_spawn_file_actions_t *file_actions,
int lfp_spawn_file_actions_adddup2(lfp_spawn_file_actions_t *file_actions,
int fd, int newfd);
int lfp_spawn_file_actions_addkeep(lfp_spawn_file_actions_t *file_actions,
int fd);
typedef struct {
uint32_t flags;
sigset_t sigdefault;
......@@ -85,6 +91,8 @@ typedef enum {
#define LFP_SPAWN_SETSID ( 1 << 7 )
LFP_SPAWN_SETCTTY = 1 << 8,
#define LFP_SPAWN_SETCTTY ( 1 << 8 )
LFP_SPAWN_USEVFORK = 1 << 9,
#define LFP_SPAWN_USEVFORK ( 1 << 9 )
} lfp_spawnattr_flags;
int lfp_spawnattr_init(lfp_spawnattr_t *attr);
......@@ -130,6 +138,6 @@ int lfp_spawnp(pid_t *restrict pid,
const lfp_spawn_file_actions_t *restrict file_actions,
const lfp_spawnattr_t *restrict attr);
END_CPLUSPLUS_GUARD
LFP_END_DECLS
#endif /* _LFP_SPAWN_H_ */
......@@ -27,7 +27,7 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <sys/stat.h>
......@@ -55,6 +55,6 @@ bool lfp_islnk(mode_t mode);
bool lfp_issock(mode_t mode);
END_CPLUSPLUS_GUARD
LFP_END_DECLS
#endif /* _LFP_STAT_H_ */
......@@ -27,16 +27,20 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <inttypes.h>
#include <stdlib.h>
int lfp_mkstemp(char *tmplate);
int lfp_mkostemp(char *tmplate, uint64_t flags);
char* lfp_getpath(char *const envp[]);
char *lfp_ptsname(int masterfd);
int lfp_ptsname(int masterfd, char *buf, size_t buflen);
END_CPLUSPLUS_GUARD
LFP_END_DECLS
#endif /* _LFP_STDLIB_H_ */
/*******************************************************************************/
/* Permission is hereby granted, free of charge, to any person or organization */
/* obtaining a copy of the software and accompanying documentation covered by */
/* this license (the "Software") to use, reproduce, display, distribute, */
/* execute, and transmit the Software, and to prepare derivative works of the */
/* Software, and to permit third-parties to whom the Software is furnished to */
/* do so, all subject to the following: */
/* */
/* The copyright notices in the Software and this entire statement, including */
/* the above license grant, this restriction and the following disclaimer, */
/* must be included in all copies of the Software, in whole or in part, and */
/* all derivative works of the Software, unless such copies or derivative */
/* works are solely in the form of machine-executable object code generated by */
/* a source language processor. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
/* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT */
/* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE */
/* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, */
/* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER */
/* DEALINGS IN THE SOFTWARE. */
/*******************************************************************************/
#if !defined(_LFP_STRING_H_)
# define _LFP_STRING_H_
#include <lfp/aux.h>
LFP_BEGIN_DECLS
#include <sys/types.h>
int lfp_strerror(int errnum, char *buf, size_t buflen);
LFP_END_DECLS
#endif /* _LFP_STRING_H_ */
......@@ -27,16 +27,36 @@
#include <lfp/aux.h>
CPLUSPLUS_GUARD
LFP_BEGIN_DECLS
#include <sys/types.h>
#include <inttypes.h>
#include <string.h>
int lfp_strerror(int errnum, char *buf, size_t buflen);
#include <lfp/strerror.h>
size_t lfp_strnlen(const char *s, size_t maxlen);
char *lfp_strndup(const char *s, size_t maxlen);
END_CPLUSPLUS_GUARD
char* lfp_strndup(const char *s, size_t maxlen);
enum lfp_memsize_measure_unit {
LFP_OCTETS = 0,
LFP_KB,
LFP_KIB,
LFP_MB,
LFP_MIB,
LFP_GB,
LFP_GIB,
LFP_TB,
LFP_TIB,
LFP_PB,
LFP_PIB,
LFP_EB,