NetBSD Problem Report #45043
From www@NetBSD.org Fri Jun 10 14:35:51 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 3111F63C740
for <gnats-bugs@gnats.NetBSD.org>; Fri, 10 Jun 2011 14:35:51 +0000 (UTC)
Message-Id: <20110610143548.DE86663B99B@www.NetBSD.org>
Date: Fri, 10 Jun 2011 14:35:48 +0000 (UTC)
From: linuxgeek@gmail.com
Reply-To: linuxgeek@gmail.com
To: gnats-bugs@NetBSD.org
Subject: pkgtools/libnbcompat minix support
X-Send-Pr-Version: www-1.0
>Number: 45043
>Category: pkg
>Synopsis: pkgtools/libnbcompat minix support
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: joerg
>State: closed
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Fri Jun 10 14:40:00 +0000 2011
>Closed-Date: Wed Feb 20 16:00:43 +0000 2013
>Last-Modified: Wed Feb 20 16:20:03 +0000 2013
>Originator: Thomas Cort
>Release: N/A
>Organization:
Minix3
>Environment:
Minix 192.168.122.210 3.2.0 i686
>Description:
libnbcompat doesn't compile on Minix because Minix lacks the st_blksize member of struct statf. Additionally, some Minix systems use GNU ar (gar) instead of ar.
>How-To-Repeat:
Attempt to compile libnbcompat on Minix.
>Fix:
diff --git a/pkgtools/libnbcompat/files/configure b/pkgtools/libnbcompat/files/configure
index abef6f2..8f97e66 100755
--- a/pkgtools/libnbcompat/files/configure
+++ b/pkgtools/libnbcompat/files/configure
@@ -3724,8 +3724,10 @@ fi
test -n "$AWK" && break
done
-# Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
+for ac_prog in gar ar
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if test "${ac_cv_prog_AR+set}" = set; then :
@@ -3741,7 +3743,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_AR="ar"
+ ac_cv_prog_AR="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -3761,6 +3763,9 @@ $as_echo "no" >&6; }
fi
+ test -n "$AR" && break
+done
+
AUTOCONF=${AUTOCONF-"$srcdir/missing --run autoconf"}
@@ -6397,6 +6402,19 @@ fi
fi
+ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" " #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+_ACEOF
+
+:
+else
+ :
+fi
+
ac_fn_c_check_member "$LINENO" "struct statfs" "f_flags" "ac_cv_member_struct_statfs_f_flags" " #include <sys/statfs.h>
"
if test "x$ac_cv_member_struct_statfs_f_flags" = x""yes; then :
diff --git a/pkgtools/libnbcompat/files/configure.ac b/pkgtools/libnbcompat/files/configure.ac
index afb5ace..3f2ab3e 100644
--- a/pkgtools/libnbcompat/files/configure.ac
+++ b/pkgtools/libnbcompat/files/configure.ac
@@ -18,7 +18,7 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_AWK
-AC_CHECK_PROG(AR, ar, ar)
+AC_CHECK_PROGS(AR, [gar ar])
AUTOCONF=${AUTOCONF-"$srcdir/missing --run autoconf"}
AC_SUBST(AUTOCONF)
@@ -386,6 +386,8 @@ AC_CHECK_FUNCS([getpassphrase getpgrp memmove select])
AC_CHECK_FUNC(getpgrp, [AC_FUNC_GETPGRP])
+AC_CHECK_MEMBERS([struct stat.st_blksize], [:], [:],
+ [ #include <sys/stat.h> ])
AC_CHECK_MEMBERS([struct statfs.f_flags], [:], [:],
[ #include <sys/statfs.h> ])
AC_CHECK_MEMBERS([struct statfs.f_fsize], [:], [:],
diff --git a/pkgtools/libnbcompat/files/db/btree/bt_open.c b/pkgtools/libnbcompat/files/db/btree/bt_open.c
index bbf11a4..a990b16 100644
--- a/pkgtools/libnbcompat/files/db/btree/bt_open.c
+++ b/pkgtools/libnbcompat/files/db/btree/bt_open.c
@@ -260,7 +260,11 @@ __bt_open(const char *fname, int flags, mode_t mode, const BTREEINFO *openinfo,
* Don't overflow the page offset type.
*/
if (b.psize == 0) {
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
b.psize = sb.st_blksize;
+#else
+ b.psize = 1024;
+#endif
if (b.psize < MINPSIZE)
b.psize = MINPSIZE;
if (b.psize > MAX_PAGE_OFFSET + 1)
diff --git a/pkgtools/libnbcompat/files/db/hash/hash.c b/pkgtools/libnbcompat/files/db/hash/hash.c
index d3fa75f..8606181 100644
--- a/pkgtools/libnbcompat/files/db/hash/hash.c
+++ b/pkgtools/libnbcompat/files/db/hash/hash.c
@@ -304,7 +304,11 @@ init_hash(HTAB *hashp, const char *file, const HASHINFO *info)
if (file != NULL) {
if (stat(file, &statbuf))
return (NULL);
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
hashp->BSIZE = MIN(statbuf.st_blksize, MAX_BSIZE);
+#else
+ hashp->BSIZE = MIN(1024, MAX_BSIZE);
+#endif
hashp->BSHIFT = __log2((uint32_t)hashp->BSIZE);
}
diff --git a/pkgtools/libnbcompat/files/nbcompat/config.h.in b/pkgtools/libnbcompat/files/nbcompat/config.h.in
index 2445893..7fbcf47 100644
--- a/pkgtools/libnbcompat/files/nbcompat/config.h.in
+++ b/pkgtools/libnbcompat/files/nbcompat/config.h.in
@@ -388,6 +388,9 @@
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
#undef HAVE_STRUCT_SOCKADDR_STORAGE
+/* Define to 1 if `st_blksize' is a member of `struct statf'. */
+#undef HAVE_STRUCT_STAT_ST_BLKSIZE
+
/* Define to 1 if `f_flags' is a member of `struct statfs'. */
#undef HAVE_STRUCT_STATFS_F_FLAGS
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->joerg
Responsible-Changed-By: obache@NetBSD.org
Responsible-Changed-When: Fri, 10 Jun 2011 22:19:04 +0000
Responsible-Changed-Why:
Over to maintainer.
From: Thomas Cort <tcort@minix3.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/45043 (pkgtools/libnbcompat minix support)
Date: Tue, 19 Jul 2011 08:40:31 -0400
After submitting the original patch, Minix's struct stat was enhanced to
include the st_blksize member. That eliminates the st_blksize changes from
the original patch. Additionally, Minix got a new C library and headers.
The C library and headers were ported from NetBSD. An updated patch follows.
Patch Summary:
* Check for gar and ar since some Minix systems use GNU ar (gar) instead
of ar.
* If __UNCONST is defined, undefine it so that the local version can be
used. The Minix version is defined somewhat differently...
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
* Don't define FTS_WHITEOUT if __minix is defined. FTS_WHITEOUT isn't
supported on Minix.
* Change the prototype of timegm() (remove the 'const') to make it
match the definition in <time.h>. The version without the const is
what is defined in <time.h> on Minix and NetBSD.
See http://netbsd.gw.com/cgi-bin/man-cgi?timegm++NetBSD-current
diff --git a/pkgtools/libnbcompat/files/configure b/pkgtools/libnbcompat/files/configure
index abef6f2..458b209 100755
diff --git a/pkgtools/libnbcompat/files/configure.ac b/pkgtools/libnbcompat/files/configure.ac
index afb5ace..365e9f2 100644
--- a/pkgtools/libnbcompat/files/configure.ac
+++ b/pkgtools/libnbcompat/files/configure.ac
@@ -18,7 +18,7 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_AWK
-AC_CHECK_PROG(AR, ar, ar)
+AC_CHECK_PROGS(AR, [gar ar])
AUTOCONF=${AUTOCONF-"$srcdir/missing --run autoconf"}
AC_SUBST(AUTOCONF)
diff --git a/pkgtools/libnbcompat/files/db/hash/hash.c b/pkgtools/libnbcompat/files/db/hash/hash.c
index d3fa75f..005162e 100644
--- a/pkgtools/libnbcompat/files/db/hash/hash.c
+++ b/pkgtools/libnbcompat/files/db/hash/hash.c
@@ -58,6 +58,9 @@ __RCSID("$NetBSD: hash.c,v 1.2 2008/10/30 19:27:20 joerg Exp $");
#include "../pwrite.c"
#endif
+#ifdef __UNCONST
+#undef __UNCONST
+#endif
#define __UNCONST(a) ((void *)(size_t)(const void *)(a))
static int alloc_segs(HTAB *, int);
diff --git a/pkgtools/libnbcompat/files/nbcompat/fts.h b/pkgtools/libnbcompat/files/nbcompat/fts.h
index 141bb4c..d335aa7 100644
--- a/pkgtools/libnbcompat/files/nbcompat/fts.h
+++ b/pkgtools/libnbcompat/files/nbcompat/fts.h
@@ -53,7 +53,9 @@ typedef struct {
#define FTS_PHYSICAL 0x010 /* physical walk */
#define FTS_SEEDOT 0x020 /* return dot and dot-dot */
#define FTS_XDEV 0x040 /* don't cross devices */
+#ifndef __minix
#define FTS_WHITEOUT 0x080 /* return whiteout information */
+#endif
#define FTS_OPTIONMASK 0x0ff /* valid user option mask */
#define FTS_NAMEONLY 0x100 /* (private) child names only */
diff --git a/pkgtools/libnbcompat/files/timegm.c b/pkgtools/libnbcompat/files/timegm.c
index 16ef642..eedfa77 100644
--- a/pkgtools/libnbcompat/files/timegm.c
+++ b/pkgtools/libnbcompat/files/timegm.c
@@ -56,7 +56,7 @@ leap_days(int y1, int y2)
* Code adapted from Python 2.4.1 sources (Lib/calendar.py).
*/
time_t
-timegm(const struct tm *tm)
+timegm(struct tm *tm)
{
int year;
time_t days;
State-Changed-From-To: open->closed
State-Changed-By: tcort@NetBSD.org
State-Changed-When: Wed, 20 Feb 2013 16:00:43 +0000
State-Changed-Why:
Minix base system has changed and these patches are no longer needed.
From: Thomas Cort <tcort@minix3.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/45043 (pkgtools/libnbcompat minix support)
Date: Wed, 20 Feb 2013 10:51:36 -0500
Due to changes in the Minix base system (headers, libc, and others) to
more closely align it with NetBSD, these patches are no longer needed.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.