[asterisk-commits] qwell: branch qwell/ast_open r103560 - in /team/qwell/ast_open: include/aster...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 12 18:56:18 CST 2008


Author: qwell
Date: Tue Feb 12 18:56:18 2008
New Revision: 103560

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103560
Log:
Add very very (did I say very?) basic ast_open() and ast_creat() functions.

Modified:
    team/qwell/ast_open/include/asterisk/utils.h
    team/qwell/ast_open/main/utils.c

Modified: team/qwell/ast_open/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/team/qwell/ast_open/include/asterisk/utils.h?view=diff&rev=103560&r1=103559&r2=103560
==============================================================================
--- team/qwell/ast_open/include/asterisk/utils.h (original)
+++ team/qwell/ast_open/include/asterisk/utils.h Tue Feb 12 18:56:18 2008
@@ -650,6 +650,24 @@
  */
 int ast_mkdir(const char *path, int mode);
 
+/*!
+ *  \brief A wrapper for open()
+ *
+ * ast_open() is a wrapper for open()
+ *
+ * The arguments and return value are the same as open(), minus the mode, which is set to AST_FILE_MODE
+ */
+int ast_open(const char *pathname, int flags);
+
+/*!
+ *  \brief A wrapper for creat()
+ *
+ * ast_creat() is a wrapper for creat()
+ *
+ * The arguments and return value are the same as creat(), minus the mode, which is set to AST_FILE_MODE
+ */
+int ast_creat(const char *pathname);
+
 #define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
 
 #include "asterisk/strings.h"

Modified: team/qwell/ast_open/main/utils.c
URL: http://svn.digium.com/view/asterisk/team/qwell/ast_open/main/utils.c?view=diff&rev=103560&r1=103559&r2=103560
==============================================================================
--- team/qwell/ast_open/main/utils.c (original)
+++ team/qwell/ast_open/main/utils.c Tue Feb 12 18:56:18 2008
@@ -1544,6 +1544,17 @@
 	return 0;
 }
 
+int ast_open(const char *pathname, int flags)
+{
+	return open(pathname, flags, AST_FILE_MODE);
+}
+
+int ast_creat(const char *pathname)
+{
+	/* Just call ast_open(), and use the logic there.. */
+	return ast_open(pathname, O_CREAT | O_WRONLY | O_TRUNC);
+}
+
 int ast_utils_init(void)
 {
 #ifdef HAVE_DEV_URANDOM




More information about the asterisk-commits mailing list