[Petter Reinholdtsen]
Hi. I notice that the latest insserv package fail to build on
kfreebsd, because several posix_fadvise() arguments are unknown. The
code in question is protected with #ifdefs like this:
#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600
else if ((dfd = dirfd(rcdir)) != 0) {
(void)posix_fadvise(dfd, 0, 0, POSIX_FADV_WILLNEED);
(void)posix_fadvise(dfd, 0, 0, POSIX_FADV_SEQUENTIAL);
}
#endif
Why is this test not sufficient on kfreebsd? Can any of you provide
patches to get insserv working on kfreebsd? I hope to make
dependency based boot sequencing a core part of the boot system in
Debian and then insserv should work on all archs.
I made this patch based on the changes done to startpar in sysvinit,
but fail to understand why this is needed. Can anyone confirm that
this work on kfreebsd?
--- insserv-1.12.0.orig/insserv.c
+++ insserv-1.12.0/insserv.c
@@ -40,6 +40,13 @@
#endif /* USE_RPMLIB */
#include "listing.h"
+#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600
+/* kfreebsd fail to provide working posix_fadvise
+# ifndef POSIX_FADV_SEQUENTIAL
+# define posix_fadvise(fd, off, len, adv) (-1)
+# endif
+#endif
+
#ifdef SUSE
# define DEFAULT_START_LVL "3 5"
# define DEFAULT_STOP_LVL "3 5"
posix_fadvise is optional per POSIX, so checking that that builds if
you use autoconf or for the macro is better.
See
http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fadvise.html
APPLICATION USAGE
The posix_fadvise() function is part of the Advisory Information
option and need not be provided on all implementations.
You should also probably return ENOSYS instead.
Well, to be 100% correct, errno should be set to ENOSYS and return -1.
The eventually implemented posix_fadvise() could only provide hint
to the kernel memory and io management.
The result of posix_fadvise() is not checked anyway.
The proper upstream way should be to guard all usage
of posix_fadvise() by something like
"#if USE_FADVISE" instead of current
"#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600"
and either check by autoconf for presence of function and macros
or put at the begin of insserv.c light variant like
#if defined(POSIX_FADV_SEQUENTIAL)
#define USE_FADVISE 1
#endif
The "#define posix_fadvise(fd, off, len, adv) (-1)" is sufficient
for GNU/kFreeBSD build.
Petr
_______________________________________________
initscripts-ng-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/initscripts-ng-devel