Commit 9935447b authored by Mark Andrews's avatar Mark Andrews

2503. [port] linux: improve compatibility with Linux Standard

                        Base. [RT #18793]
parent 07e2d951
2503. [port] linux: improve compatibility with Linux Standard
Base. [RT #18793]
2502. [cleanup] isc_radix: Improve compliance with coding style,
document function in <isc/radix.h>. [RT #18534]
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: acconfig.h,v 1.51 2007/06/19 23:46:59 tbox Exp $ */
/* $Id: acconfig.h,v 1.52 2008/12/01 03:51:47 marka Exp $ */
/*! \file */
......@@ -25,9 +25,6 @@
***/
@TOP@
/** define to `int' if <sys/types.h> doesn't define. */
#undef ssize_t
/** define on DEC OSF to enable 4.4BSD style sa_len support */
#undef _SOCKADDR_LEN
......@@ -61,9 +58,6 @@
/** define if you have the NET_RT_IFLIST sysctl variable and sys/sysctl.h */
#undef HAVE_IFLIST_SYSCTL
/** define if chroot() is available */
#undef HAVE_CHROOT
/** define if tzset() is available */
#undef HAVE_TZSET
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: os.c,v 1.89 2008/11/14 05:08:48 marka Exp $ */
/* $Id: os.c,v 1.90 2008/12/01 03:51:47 marka Exp $ */
/*! \file */
......@@ -505,10 +505,14 @@ ns_os_chroot(const char *root) {
ns_smf_chroot = 0;
#endif
if (root != NULL) {
#ifdef HAVE_CHROOT
if (chroot(root) < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf));
ns_main_earlyfatal("chroot(): %s", strbuf);
}
#else
ns_main_earlyfatal("chroot(): disabled");
#endif
if (chdir("/") < 0) {
isc__strerror(errno, strbuf, sizeof(strbuf));
ns_main_earlyfatal("chdir(/): %s", strbuf);
......
......@@ -16,7 +16,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.h.in,v 1.106 2008/10/21 02:43:07 marka Exp $ */
/* $Id: config.h.in,v 1.107 2008/12/01 03:53:32 marka Exp $ */
/*! \file */
......@@ -25,9 +25,6 @@
*** it does not get installed.
***/
/** define to `int' if <sys/types.h> doesn't define. */
#undef ssize_t
/** define on DEC OSF to enable 4.4BSD style sa_len support */
#undef _SOCKADDR_LEN
......@@ -61,9 +58,6 @@
/** define if you have the NET_RT_IFLIST sysctl variable and sys/sysctl.h */
#undef HAVE_IFLIST_SYSCTL
/** define if chroot() is available */
#undef HAVE_CHROOT
/** define if tzset() is available */
#undef HAVE_TZSET
......@@ -163,6 +157,9 @@ int sigwait(const unsigned int *set, int *sig);
/* Solaris hack to get select_large_fdset. */
#undef FD_SETSIZE
/* Define to 1 if you have the `chroot' function. */
#undef HAVE_CHROOT
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
......@@ -187,9 +184,6 @@ int sigwait(const unsigned int *set, int *sig);
/* Define to 1 if you have the `c_r' library (-lc_r). */
#undef HAVE_LIBC_R
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
......@@ -214,6 +208,9 @@ int sigwait(const unsigned int *set, int *sig);
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `nanosleep' function. */
#undef HAVE_NANOSLEEP
/* Define to 1 if you have the <net/if6.h> header file. */
#undef HAVE_NET_IF6_H
......
This diff is collapsed.
......@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.457 $)
AC_REVISION($Revision: 1.458 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.59)
......@@ -1155,7 +1155,6 @@ AC_CHECK_FUNC(catgets, AC_DEFINE(HAVE_CATGETS),)
#
# AC_CHECK_LIB(xnet, socket, ,
# AC_CHECK_LIB(socket, socket)
# AC_CHECK_LIB(nsl, inet_ntoa)
# )
#
# Use this for now, instead:
......@@ -1165,7 +1164,6 @@ case "$host" in
;;
*)
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, inet_ntoa)
;;
esac
......@@ -1603,23 +1601,8 @@ main() { char a[16]; return (inet_pton(AF_INET, "1.2.3", a) == 1 ? 1 :
[AC_MSG_RESULT(assuming target platform has working inet_pton)
ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"])
AC_MSG_CHECKING([for inet_aton])
AC_TRY_LINK([
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>],
[struct in_addr in; inet_aton(0, &in); return (0);],
[AC_MSG_RESULT(yes)
ISC_PLATFORM_NEEDATON="#undef ISC_PLATFORM_NEEDATON"],
[AC_MSG_RESULT(no)
ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_aton.$O"
ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS inet_aton.c"
ISC_PLATFORM_NEEDATON="#define ISC_PLATFORM_NEEDATON 1"])
AC_SUBST(ISC_PLATFORM_NEEDNTOP)
AC_SUBST(ISC_PLATFORM_NEEDPTON)
AC_SUBST(ISC_PLATFORM_NEEDATON)
#
# Look for a 4.4BSD-style sa_len member in struct sockaddr.
......@@ -1972,7 +1955,17 @@ AC_SUBST(LWRES_PLATFORM_QUADFORMAT)
#
# Security Stuff
#
AC_CHECK_FUNC(chroot, AC_DEFINE(HAVE_CHROOT))
# Note it is very recommended to *not* disable chroot(),
# this is only because chroot() was made obsolete by Posix.
AC_ARG_ENABLE(chroot,
[ --disable-chroot disable chroot])
case "$enable_chroot" in
yes|'')
AC_CHECK_FUNCS(chroot)
;;
no)
;;
esac
AC_ARG_ENABLE(linux-caps,
[ --disable-linux-caps disable linux capabilities])
case "$enable_linux_caps" in
......@@ -2207,6 +2200,8 @@ yes)
esac
AC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX)
AC_CHECK_FUNCS(nanosleep)
#
# Machine architecture dependent features
#
......
......@@ -31,7 +31,7 @@
/*
* Principal Author: Brian Wellington
* $Id: dst_api.c,v 1.16 2008/11/14 22:53:46 marka Exp $
* $Id: dst_api.c,v 1.17 2008/12/01 03:51:47 marka Exp $
*/
/*! \file */
......@@ -125,6 +125,7 @@ static isc_result_t addsuffix(char *filename, unsigned int len,
return (_r); \
} while (0); \
#ifdef OPENSSL
static void *
default_memalloc(void *arg, size_t size) {
UNUSED(arg);
......@@ -138,6 +139,7 @@ default_memfree(void *arg, void *ptr) {
UNUSED(arg);
free(ptr);
}
#endif
isc_result_t
dst_lib_init(isc_mem_t *mctx, isc_entropy_t *ectx, unsigned int eflags) {
......
......@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.96 2008/09/24 02:46:23 marka Exp $
# $Id: Makefile.in,v 1.97 2008/12/01 03:51:47 marka Exp $
srcdir = @srcdir@
VPATH = @srcdir@
......@@ -54,7 +54,7 @@ OBJS = @ISC_EXTRA_OBJS@ \
assertions.@O@ base32.@O@ base64.@O@ bitstring.@O@ buffer.@O@ \
bufferlist.@O@ commandline.@O@ error.@O@ event.@O@ \
hash.@O@ heap.@O@ hex.@O@ hmacmd5.@O@ hmacsha.@O@ \
httpd.@O@ iterated_hash.@O@ \
httpd.@O@ inet_aton.@O@ iterated_hash.@O@ \
lex.@O@ lfsr.@O@ lib.@O@ log.@O@ \
md5.@O@ mem.@O@ mutexblock.@O@ \
netaddr.@O@ netscope.@O@ ondestroy.@O@ \
......@@ -69,7 +69,7 @@ SRCS = @ISC_EXTRA_SRCS@ \
assertions.c base32.c base64.c bitstring.c buffer.c \
bufferlist.c commandline.c error.c event.c \
heap.c hex.c hmacmd5.c hmacsha.c \
httpd.c iterated_hash.c \
httpd.c inet_aton.c iterated_hash.c \
lex.c lfsr.c lib.c log.c \
md5.c mem.c mutexblock.c \
netaddr.c netscope.c ondestroy.c \
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: platform.h.in,v 1.48 2008/06/23 19:41:19 jinmei Exp $ */
/* $Id: platform.h.in,v 1.49 2008/12/01 03:51:47 marka Exp $ */
#ifndef ISC_PLATFORM_H
#define ISC_PLATFORM_H 1
......@@ -93,11 +93,6 @@
*/
@ISC_PLATFORM_NEEDPTON@
/*! \brief
* If this system needs inet_aton(), ISC_PLATFORM_NEEDATON will be defined.
*/
@ISC_PLATFORM_NEEDATON@
/*! \brief
* If this system needs in_port_t, ISC_PLATFORM_NEEDPORTT will be defined.
*/
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dir.c,v 1.25 2007/06/19 23:47:18 tbox Exp $ */
/* $Id: dir.c,v 1.26 2008/12/01 03:51:47 marka Exp $ */
/*! \file
* \author Principal Authors: DCL */
......@@ -171,10 +171,14 @@ isc_dir_chroot(const char *dirname) {
REQUIRE(dirname != NULL);
#ifdef HAVE_CHROOT
if (chroot(dirname) < 0)
return (isc__errno2result(errno));
return (ISC_R_SUCCESS);
#else
return (ISC_R_NOTIMPLEMENTED);
#endif
}
isc_result_t
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: entropy.c,v 1.80 2007/06/19 23:47:18 tbox Exp $ */
/* $Id: entropy.c,v 1.81 2008/12/01 03:51:47 marka Exp $ */
/* \file unix/entropy.c
* \brief
......@@ -31,6 +31,9 @@
#include <sys/socket.h>
#include <sys/un.h>
#ifdef HAVE_NANOSLEEP
#include <time.h>
#endif
#include <unistd.h>
#include <isc/platform.h>
......@@ -174,7 +177,15 @@ get_from_usocketsource(isc_entropysource_t *source, isc_uint32_t desired) {
* just "break", then the "desired"
* amount gets borked.
*/
#ifdef HAVE_NANOSLEEP
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 1000000;
nanosleep(&ts, NULL);
#else
usleep(1000);
#endif
goto eagain_loop;
}
if (errno == EWOULDBLOCK || errno == EINTR)
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: net.h,v 1.48 2008/06/23 23:47:11 tbox Exp $ */
/* $Id: net.h,v 1.49 2008/12/01 03:51:47 marka Exp $ */
#ifndef ISC_NET_H
#define ISC_NET_H 1
......@@ -354,11 +354,9 @@ isc_net_pton(int af, const char *src, void *dst);
#define inet_pton isc_net_pton
#endif
#ifdef ISC_PLATFORM_NEEDATON
int
isc_net_aton(const char *cp, struct in_addr *addr);
#define inet_aton isc_net_aton
#endif
ISC_LANG_ENDDECLS
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: offset.h,v 1.15 2007/06/19 23:47:19 tbox Exp $ */
/* $Id: offset.h,v 1.16 2008/12/01 03:51:47 marka Exp $ */
#ifndef ISC_OFFSET_H
#define ISC_OFFSET_H 1
......@@ -26,6 +26,7 @@
*/
#include <limits.h> /* Required for CHAR_BIT. */
#include <sys/types.h>
#include <stddef.h> /* For Linux Standard Base. */
typedef off_t isc_offset_t;
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: strerror.h,v 1.8 2007/06/19 23:47:19 tbox Exp $ */
/* $Id: strerror.h,v 1.9 2008/12/01 03:51:47 marka Exp $ */
#ifndef ISC_STRERROR_H
#define ISC_STRERROR_H
......@@ -32,7 +32,7 @@ ISC_LANG_BEGINDECLS
#define ISC_STRERRORSIZE 128
/*%
* Provide a thread safe wrapper to strerrror().
* Provide a thread safe wrapper to strerror().
*
* Requires:
* 'buf' to be non NULL.
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: interfaceiter.c,v 1.44 2008/03/20 23:47:00 tbox Exp $ */
/* $Id: interfaceiter.c,v 1.45 2008/12/01 03:51:47 marka Exp $ */
/*! \file */
......@@ -217,8 +217,8 @@ linux_if_inet6_current(isc_interfaceiter_t *iter) {
for (i = 0; i < 16; i++) {
unsigned char byte;
static const char hex[] = "0123456789abcdef";
byte = ((index(hex, address[i * 2]) - hex) << 4) |
(index(hex, address[i * 2 + 1]) - hex);
byte = ((strchr(hex, address[i * 2]) - hex) << 4) |
(strchr(hex, address[i * 2 + 1]) - hex);
addr6.s6_addr[i] = byte;
}
iter->current.af = AF_INET6;
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: net.h,v 1.30 2008/07/01 23:47:17 tbox Exp $ */
/* $Id: net.h,v 1.31 2008/12/01 03:51:47 marka Exp $ */
#ifndef ISC_NET_H
#define ISC_NET_H 1
......@@ -335,11 +335,9 @@ isc_net_pton(int af, const char *src, void *dst);
#define inet_pton isc_net_pton
#endif
#ifdef ISC_PLATFORM_NEEDATON
int
isc_net_aton(const char *cp, struct in_addr *addr);
#define inet_aton isc_net_aton
#endif
ISC_LANG_ENDDECLS
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: platform.h,v 1.16 2008/04/02 23:46:58 tbox Exp $ */
/* $Id: platform.h,v 1.17 2008/12/01 03:51:47 marka Exp $ */
#ifndef ISC_PLATFORM_H
#define ISC_PLATFORM_H 1
......@@ -39,7 +39,6 @@
#undef MSG_TRUNC
#define ISC_PLATFORM_NEEDNTOP
#define ISC_PLATFORM_NEEDPTON
#define ISC_PLATFORM_NEEDATON
#define ISC_PLATFORM_QUADFORMAT "I64"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment