[Midnightbsd-cvs] src [10626] trunk/lib/libc/db/hash: tag

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jun 9 12:21:33 EDT 2018


Revision: 10626
          http://svnweb.midnightbsd.org/src/?rev=10626
Author:   laffer1
Date:     2018-06-09 12:21:32 -0400 (Sat, 09 Jun 2018)
Log Message:
-----------
tag

Modified Paths:
--------------
    trunk/lib/libc/db/hash/Makefile.inc
    trunk/lib/libc/db/hash/README
    trunk/lib/libc/db/hash/extern.h
    trunk/lib/libc/db/hash/hash.c
    trunk/lib/libc/db/hash/hash.h
    trunk/lib/libc/db/hash/hash_bigkey.c
    trunk/lib/libc/db/hash/hash_buf.c
    trunk/lib/libc/db/hash/hash_func.c
    trunk/lib/libc/db/hash/hash_log2.c
    trunk/lib/libc/db/hash/hash_page.c

Property Changed:
----------------
    trunk/lib/libc/db/hash/Makefile.inc
    trunk/lib/libc/db/hash/README

Modified: trunk/lib/libc/db/hash/Makefile.inc
===================================================================
--- trunk/lib/libc/db/hash/Makefile.inc	2018-06-09 16:21:06 UTC (rev 10625)
+++ trunk/lib/libc/db/hash/Makefile.inc	2018-06-09 16:21:32 UTC (rev 10626)
@@ -1,6 +1,6 @@
 #       from @(#)Makefile.inc	8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/libc/db/hash/Makefile.inc,v 1.5 2002/11/18 09:50:54 ru Exp $
-# $MidnightBSD: src/lib/libc/db/hash/Makefile.inc,v 1.2 2009/03/16 16:23:37 laffer1 Exp $
+# $FreeBSD: stable/10/lib/libc/db/hash/Makefile.inc 107052 2002-11-18 09:50:57Z ru $
+# $MidnightBSD$
 
 .PATH: ${.CURDIR}/db/hash
 


Property changes on: trunk/lib/libc/db/hash/Makefile.inc
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/db/hash/README
===================================================================
--- trunk/lib/libc/db/hash/README	2018-06-09 16:21:06 UTC (rev 10625)
+++ trunk/lib/libc/db/hash/README	2018-06-09 16:21:32 UTC (rev 10626)
@@ -1,4 +1,6 @@
 #	@(#)README	8.1 (Berkeley) 6/4/93
+# $FreeBSD: stable/10/lib/libc/db/hash/README 190498 2009-03-28 07:31:02Z delphij $
+# $MidnightBSD$
 
 This package implements a superset of the hsearch and dbm/ndbm libraries.
 


Property changes on: trunk/lib/libc/db/hash/README
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/db/hash/extern.h
===================================================================
--- trunk/lib/libc/db/hash/extern.h	2018-06-09 16:21:06 UTC (rev 10625)
+++ trunk/lib/libc/db/hash/extern.h	2018-06-09 16:21:32 UTC (rev 10626)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1991, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -27,7 +28,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)extern.h	8.4 (Berkeley) 6/16/94
- * $FreeBSD: src/lib/libc/db/hash/extern.h,v 1.4 2007/01/09 00:27:50 imp Exp $
+ * $FreeBSD: stable/10/lib/libc/db/hash/extern.h 165903 2007-01-09 00:28:16Z imp $
  */
 
 BUFHEAD	*__add_ovflpage(HTAB *, BUFHEAD *);

Modified: trunk/lib/libc/db/hash/hash.c
===================================================================
--- trunk/lib/libc/db/hash/hash.c	2018-06-09 16:21:06 UTC (rev 10625)
+++ trunk/lib/libc/db/hash/hash.c	2018-06-09 16:21:32 UTC (rev 10626)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1990, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -34,7 +35,7 @@
 static char sccsid[] = "@(#)hash.c	8.9 (Berkeley) 6/16/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash.c,v 1.14 2007/05/25 09:57:48 delphij Exp $");
+__FBSDID("$FreeBSD: stable/10/lib/libc/db/hash/hash.c 309485 2016-12-03 17:17:42Z ngie $");
 
 #include "namespace.h"
 #include <sys/param.h>
@@ -121,9 +122,8 @@
 	hashp->flags = flags;
 
 	if (file) {
-		if ((hashp->fp = _open(file, flags, mode)) == -1)
+		if ((hashp->fp = _open(file, flags | O_CLOEXEC, mode)) == -1)
 			RETURN_ERROR(errno, error0);
-		(void)_fcntl(hashp->fp, F_SETFD, 1);
 		new_table = _fstat(hashp->fp, &statbuf) == 0 &&
 		    statbuf.st_size == 0 && (flags & O_ACCMODE) != O_RDONLY;
 	} else
@@ -423,8 +423,11 @@
 	if (hashp->tmp_buf)
 		free(hashp->tmp_buf);
 
-	if (hashp->fp != -1)
+	if (hashp->fp != -1) {
+		if (hashp->save_file)
+			(void)_fsync(hashp->fp);
 		(void)_close(hashp->fp);
+	}
 
 	free(hashp);
 
@@ -459,6 +462,8 @@
 		return (0);
 	if (__buf_free(hashp, 0, 1) || flush_meta(hashp))
 		return (ERROR);
+	if (hashp->fp != -1 && _fsync(hashp->fp) != 0)
+		return (ERROR);
 	hashp->new_file = 0;
 	return (0);
 }
@@ -767,7 +772,7 @@
 		if (__big_keydata(hashp, bufp, key, data, 1))
 			return (ERROR);
 	} else {
-		if (hashp->cpage == 0)
+		if (hashp->cpage == NULL)
 			return (ERROR);
 		key->data = (u_char *)hashp->cpage->page + bp[ndx];
 		key->size = (ndx > 1 ? bp[ndx - 1] : hashp->BSIZE) - bp[ndx];

Modified: trunk/lib/libc/db/hash/hash.h
===================================================================
--- trunk/lib/libc/db/hash/hash.h	2018-06-09 16:21:06 UTC (rev 10625)
+++ trunk/lib/libc/db/hash/hash.h	2018-06-09 16:21:32 UTC (rev 10626)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1990, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -30,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)hash.h	8.3 (Berkeley) 5/31/94
- * $FreeBSD: src/lib/libc/db/hash/hash.h,v 1.7 2007/01/09 00:27:50 imp Exp $
+ * $FreeBSD: stable/10/lib/libc/db/hash/hash.h 206178 2010-04-05 10:12:21Z avg $
  */
 
 /* Operations */

Modified: trunk/lib/libc/db/hash/hash_bigkey.c
===================================================================
--- trunk/lib/libc/db/hash/hash_bigkey.c	2018-06-09 16:21:06 UTC (rev 10625)
+++ trunk/lib/libc/db/hash/hash_bigkey.c	2018-06-09 16:21:32 UTC (rev 10626)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1990, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -34,7 +35,7 @@
 static char sccsid[] = "@(#)hash_bigkey.c	8.3 (Berkeley) 5/31/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_bigkey.c,v 1.6 2007/01/09 00:27:50 imp Exp $");
+__FBSDID("$FreeBSD: stable/10/lib/libc/db/hash/hash_bigkey.c 190494 2009-03-28 06:47:05Z delphij $");
 
 /*
  * PACKAGE: hash

Modified: trunk/lib/libc/db/hash/hash_buf.c
===================================================================
--- trunk/lib/libc/db/hash/hash_buf.c	2018-06-09 16:21:06 UTC (rev 10625)
+++ trunk/lib/libc/db/hash/hash_buf.c	2018-06-09 16:21:32 UTC (rev 10626)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1990, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -34,7 +35,7 @@
 static char sccsid[] = "@(#)hash_buf.c	8.5 (Berkeley) 7/15/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_buf.c,v 1.8 2007/01/09 00:27:50 imp Exp $");
+__FBSDID("$FreeBSD: stable/10/lib/libc/db/hash/hash_buf.c 309485 2016-12-03 17:17:42Z ngie $");
 
 /*
  * PACKAGE: hash
@@ -245,7 +246,7 @@
 			 */
 			for (xbp = bp; xbp->ovfl;) {
 				next_xbp = xbp->ovfl;
-				xbp->ovfl = 0;
+				xbp->ovfl = NULL;
 				xbp = next_xbp;
 
 				/* Check that ovfl pointer is up date. */
@@ -350,7 +351,7 @@
 void
 __reclaim_buf(HTAB *hashp, BUFHEAD *bp)
 {
-	bp->ovfl = 0;
+	bp->ovfl = NULL;
 	bp->addr = 0;
 	bp->flags = 0;
 	BUF_REMOVE(bp);

Modified: trunk/lib/libc/db/hash/hash_func.c
===================================================================
--- trunk/lib/libc/db/hash/hash_func.c	2018-06-09 16:21:06 UTC (rev 10625)
+++ trunk/lib/libc/db/hash/hash_func.c	2018-06-09 16:21:32 UTC (rev 10626)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1990, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -34,7 +35,7 @@
 static char sccsid[] = "@(#)hash_func.c	8.2 (Berkeley) 2/21/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_func.c,v 1.6 2007/01/09 00:27:50 imp Exp $");
+__FBSDID("$FreeBSD: stable/10/lib/libc/db/hash/hash_func.c 190498 2009-03-28 07:31:02Z delphij $");
 
 #include <sys/types.h>
 

Modified: trunk/lib/libc/db/hash/hash_log2.c
===================================================================
--- trunk/lib/libc/db/hash/hash_log2.c	2018-06-09 16:21:06 UTC (rev 10625)
+++ trunk/lib/libc/db/hash/hash_log2.c	2018-06-09 16:21:32 UTC (rev 10626)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1990, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -34,10 +35,8 @@
 static char sccsid[] = "@(#)hash_log2.c	8.2 (Berkeley) 5/31/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_log2.c,v 1.3 2007/01/09 00:27:51 imp Exp $");
+__FBSDID("$FreeBSD: stable/10/lib/libc/db/hash/hash_log2.c 190484 2009-03-28 05:45:29Z delphij $");
 
-#include <sys/types.h>
-
 #include <db.h>
 #include "hash.h"
 #include "page.h"

Modified: trunk/lib/libc/db/hash/hash_page.c
===================================================================
--- trunk/lib/libc/db/hash/hash_page.c	2018-06-09 16:21:06 UTC (rev 10625)
+++ trunk/lib/libc/db/hash/hash_page.c	2018-06-09 16:21:32 UTC (rev 10626)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1990, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -34,7 +35,7 @@
 static char sccsid[] = "@(#)hash_page.c	8.7 (Berkeley) 8/16/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_page.c,v 1.9 2007/01/09 00:27:51 imp Exp $");
+__FBSDID("$FreeBSD: stable/10/lib/libc/db/hash/hash_page.c 313532 2017-02-10 06:34:52Z ngie $");
 
 /*
  * PACKAGE:  hashing
@@ -66,6 +67,7 @@
 #include <assert.h>
 #endif
 #include "un-namespace.h"
+#include "libc_private.h"
 
 #include <db.h>
 #include "hash.h"
@@ -571,7 +573,9 @@
 int
 __put_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_bitmap)
 {
-	int fd, page, size, wsize;
+	int fd, page, size;
+	ssize_t wsize;
+	char pbuf[MAX_BSIZE];
 
 	size = hashp->BSIZE;
 	if ((hashp->fp == -1) && open_temp(hashp))
@@ -581,15 +585,18 @@
 	if (hashp->LORDER != BYTE_ORDER) {
 		int i, max;
 
+		memcpy(pbuf, p, size);
 		if (is_bitmap) {
 			max = hashp->BSIZE >> 2;	/* divide by 4 */
 			for (i = 0; i < max; i++)
-				M_32_SWAP(((int *)p)[i]);
+				M_32_SWAP(((int *)pbuf)[i]);
 		} else {
-			max = ((u_int16_t *)p)[0] + 2;
+			uint16_t *bp = (uint16_t *)(void *)pbuf;
+			max = bp[0] + 2;
 			for (i = 0; i <= max; i++)
-				M_16_SWAP(((u_int16_t *)p)[i]);
+				M_16_SWAP(bp[i]);
 		}
+		p = pbuf;
 	}
 	if (is_bucket)
 		page = BUCKET_TO_PAGE(bucket);
@@ -861,12 +868,10 @@
 
 	/* Block signals; make sure file goes away at process exit. */
 	(void)sigfillset(&set);
-	(void)_sigprocmask(SIG_BLOCK, &set, &oset);
-	if ((hashp->fp = mkstemp(path)) != -1) {
+	(void)__libc_sigprocmask(SIG_BLOCK, &set, &oset);
+	if ((hashp->fp = mkostemp(path, O_CLOEXEC)) != -1)
 		(void)unlink(path);
-		(void)_fcntl(hashp->fp, F_SETFD, 1);
-	}
-	(void)_sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL);
+	(void)__libc_sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL);
 	return (hashp->fp != -1 ? 0 : -1);
 }
 



More information about the Midnightbsd-cvs mailing list