00001 // Copyright (C) 2006-2007 Benedikt Böhm <hollow@gentoo.org> 00002 // 00003 // This program is free software; you can redistribute it and/or 00004 // modify it under the terms of the GNU General Public License 00005 // as published by the Free Software Foundation; either version 2 00006 // of the License, or (at your option) any later version. 00007 // 00008 // This program is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License 00014 // along with this program; if not, write to the Free Software 00015 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00016 00017 /*! 00018 * @defgroup open Create or open files 00019 * 00020 * The open family of functions provide wrappers around open(2) with different 00021 * flags. 00022 * 00023 * @{ 00024 */ 00025 00026 #ifndef _LUCID_OPEN_H 00027 #define _LUCID_OPEN_H 00028 00029 /*! 00030 * @brief open file in append mode 00031 * 00032 * @param filename file to open 00033 * 00034 * @return filedescriptor on success, -1 otherwise with errno set 00035 * 00036 * @see open(2) 00037 */ 00038 int open_append(const char *filename); 00039 00040 /*! 00041 * @brief open file exclusively 00042 * 00043 * @param filename file to open 00044 * 00045 * @return filedescriptor on success, -1 otherwise with errno set 00046 * 00047 * @see open(2) 00048 */ 00049 int open_excl(const char *filename); 00050 00051 /*! 00052 * @brief open file for reading 00053 * 00054 * @param filename file to open 00055 * 00056 * @return filedescriptor on success, -1 otherwise with errno set 00057 * 00058 * @see open(2) 00059 */ 00060 int open_read(const char *filename); 00061 00062 /*! 00063 * @brief open file for reading and writing 00064 * 00065 * @param filename file to open 00066 * 00067 * @return filedescriptor on success, -1 otherwise with errno set 00068 * 00069 * @see open(2) 00070 */ 00071 int open_rw(const char *filename); 00072 00073 /*! 00074 * @brief open and truncate file for reading and writing 00075 * 00076 * @param filename file to open 00077 * 00078 * @return filedescriptor on success, -1 otherwise with errno set 00079 * 00080 * @see open(2) 00081 */ 00082 int open_trunc(const char *filename); 00083 00084 /*! 00085 * @brief open file for writing 00086 * 00087 * @param filename file to open 00088 * 00089 * @return filedescriptor on success, -1 otherwise with errno set 00090 * 00091 * @see open(2) 00092 */ 00093 int open_write(const char *filename); 00094 00095 #endif 00096 00097 /*! @} open */