Import BSDDB 4.7.25 (as of svn r89086)

This commit is contained in:
Zachary Ware
2017-09-04 13:40:25 -05:00
parent 4b29e0458f
commit 8f590873d0
4781 changed files with 2241032 additions and 6 deletions

51
common/openflags.c Normal file
View File

@@ -0,0 +1,51 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1997,2008 Oracle. All rights reserved.
*
* $Id: openflags.c 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
/*
* __db_openflags --
* Convert open(2) flags to DB flags.
*
* PUBLIC: u_int32_t __db_openflags __P((int));
*/
u_int32_t
__db_openflags(oflags)
int oflags;
{
u_int32_t dbflags;
dbflags = 0;
if (oflags & O_CREAT)
dbflags |= DB_CREATE;
if (oflags & O_TRUNC)
dbflags |= DB_TRUNCATE;
/*
* !!!
* Convert POSIX 1003.1 open(2) mode flags to DB flags. This isn't
* an exact science as few POSIX implementations have a flag value
* for O_RDONLY, it's simply the lack of a write flag.
*/
#ifndef O_ACCMODE
#define O_ACCMODE (O_RDONLY | O_RDWR | O_WRONLY)
#endif
switch (oflags & O_ACCMODE) {
case O_RDWR:
case O_WRONLY:
break;
default:
dbflags |= DB_RDONLY;
break;
}
return (dbflags);
}