resetting manifest requested domain to floor
[platform/upstream/db4.git] / os_brew / os_open.c
1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 1997-2009 Oracle.  All rights reserved.
5  *
6  * $Id$
7  */
8
9 #include "db_config.h"
10
11 #include "db_int.h"
12
13 /*
14  * __os_open --
15  *      Open a file descriptor (including page size and log size information).
16  */
17 int
18 __os_open(env, name, page_size, flags, mode, fhpp)
19         ENV *env;
20         const char *name;
21         u_int32_t page_size, flags;
22         int mode;
23         DB_FH **fhpp;
24 {
25         OpenFileMode oflags;
26         int ret;
27
28         COMPQUIET(page_size, 0);
29
30 #define OKFLAGS                                                         \
31         (DB_OSO_ABSMODE | DB_OSO_CREATE | DB_OSO_DIRECT | DB_OSO_DSYNC |\
32         DB_OSO_EXCL | DB_OSO_RDONLY | DB_OSO_REGION |   DB_OSO_SEQ |    \
33         DB_OSO_TEMP | DB_OSO_TRUNC)
34         if ((ret = __db_fchk(env, "__os_open", flags, OKFLAGS)) != 0)
35                 return (ret);
36
37         oflags = 0;
38         if (LF_ISSET(DB_OSO_CREATE))
39                 oflags |= _OFM_CREATE;
40
41         if (LF_ISSET(DB_OSO_RDONLY))
42                 oflags |= _OFM_READ;
43         else
44                 oflags |= _OFM_READWRITE;
45
46         if ((ret = __os_openhandle(env, name, oflags, mode, fhpp)) != 0)
47                 return (ret);
48         if (LF_ISSET(DB_OSO_REGION))
49                 F_SET(fhp, DB_FH_REGION);
50         return (ret);
51 }