source: trunk/libs/mini-libc/fcntl.h @ 449

Last change on this file since 449 was 449, checked in by alain, 4 years ago

Introduce several missing user libs.

File size: 2.8 KB
Line 
1/*
2 * fcntl.h - User level <fcntl> library definition.
3 *
4 * Author     Alain Greiner (2016,2017,2018)
5 *
6 * Copyright (c) UPMC Sorbonne Universites
7 *
8 * This file is part of ALMOS-MKH.
9 *
10 * ALMOS-MKH is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2.0 of the License.
13 *
14 * ALMOS-MKH is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef _FCNTL_H_
25#define _FCNTL_H_
26
27/*****************************************************************************************
28 * This file defines the user side, file system related <fcntl> library.
29 * All these functions make a system call to access the kernel VFS.
30 * The user/kernel shared structures and mnemonics are defined in
31 * the <syscalls/shared_include/shared_fcntl.h> file.
32 ****************************************************************************************/
33
34#include <shared_fcntl.h>
35
36/*****************************************************************************************
37 * This function creates a new open file descriptor for the file identified by the
38 * <pathname> argument, and returns the file descriptor value.
39 * The supported flags are descripted in the <syscalls/shared_include/shared_fcntl.h>.
40 * - O_RDONLY   : open file in read-only mode
41 * - O_WRONLY   : open file in write-only mode
42 * - O_RDWR     : open file in read/write mode
43 * - O_NONBLOCK : do not block if data non available
44 * - O_APPEND   : append on each write
45 * - O_CREAT    : create file if it does not exist
46 * - O_TRUNC    : file length is forced to
47 * - O_EXCL     : error if VFS_O_CREAT and file exist
48 * - O_SYNC         : synchronize File System on each write
49 * - O_CLOEXEC  : set the close-on-exec flag in file descriptor
50 * - O_DIR      : new file descriptor is for a directory
51 * When the O_CREAT is set, the <mode> argument defines the access rights, as described
52 * for chmod().
53 *****************************************************************************************
54 * @ pathname  : pathname in VFS (absolute, or relative to current working directory).
55 * @ oflags    : bit vector of flags.
56 * @ mode      : access rights.
57 * @ return file descriptor value if success / returns -1 if failure.
58 ****************************************************************************************/
59int open( const char * pathname,
60          int          flags,
61          int          mode );
62
63
64#endif
Note: See TracBrowser for help on using the repository browser.