Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

os_mkdir.c

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 1997-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: os_mkdir.c,v 12.8 2005/11/02 03:12:17 mjc Exp $
00008  */
00009 
00010 #include "db_config.h"
00011 
00012 #ifndef NO_SYSTEM_INCLUDES
00013 #include <sys/types.h>
00014 #include <sys/stat.h>
00015 #endif
00016 
00017 #include "db_int.h"
00018 
00019 /*
00020  * __os_mkdir --
00021  *      Create a directory.
00022  *
00023  * PUBLIC: int __os_mkdir __P((DB_ENV *, const char *, int));
00024  */
00025 int
00026 __os_mkdir(dbenv, name, mode)
00027         DB_ENV *dbenv;
00028         const char *name;
00029         int mode;
00030 {
00031         int ret;
00032 
00033         COMPQUIET(dbenv, NULL);
00034 
00035         /* Make the directory, with paranoid permissions. */
00036 #ifdef HAVE_VXWORKS
00037         RETRY_CHK((mkdir((char *)name)), ret);
00038 #else
00039 #ifdef DB_WIN32
00040         RETRY_CHK((_mkdir(name)), ret);
00041 #else
00042         RETRY_CHK((mkdir(name, 0600)), ret);
00043 #endif
00044         if (ret != 0)
00045                 return (ret);
00046 
00047         /* Set the absolute permissions, if specified. */
00048 #ifndef DB_WIN32
00049         if (mode != 0)
00050                 RETRY_CHK((chmod(name, mode)), ret);
00051 #endif
00052 #endif
00053         return (ret);
00054 }

Generated on Sun Dec 25 12:14:42 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2