Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
fcntl.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2016 Eistec AB
3
*
4
* This file is subject to the terms and conditions of the GNU Lesser
5
* General Public License v2.1. See the file LICENSE in the top level
6
* directory for more details.
7
*/
8
9
#pragma once
10
20
21
#ifndef DOXYGEN
22
#if defined(CPU_NATIVE) || MODULE_NEWLIB || MODULE_PICOLIBC
23
/* If building on native or newlib we need to use the system header instead */
24
#pragma GCC system_header
25
/* without the GCC pragma above #include_next will trigger a pedantic error */
26
#include_next <fcntl.h>
27
#else
28
29
#include <sys/types.h>
/* for mode_t, off_t */
30
31
#ifdef __cplusplus
32
extern
"C"
{
33
#endif
34
35
/* Constants used for the flags in fcntl and open */
36
/* The names of the constants are defined by POSIX but most of these numbers
37
* were chosen somewhat arbitrarily */
38
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
39
#define O_RDONLY 0
/* Read only */
40
#define O_WRONLY 1
/* Write only */
41
#define O_RDWR 2
/* Read+write */
42
#define O_APPEND 0x0008
/* Set append mode */
43
#define O_CREAT 0x0010
/* Create file if it does not exist */
44
#define O_TRUNC 0x0020
/* Truncate flag */
45
#define O_EXCL 0x0040
/* Exclusive use flag */
46
47
#define F_DUPFD 0
/* Duplicate file descriptor */
48
#define F_GETFD 1
/* Get file descriptor flags */
49
#define F_SETFD 2
/* Set file descriptor flags */
50
#define F_GETFL 3
/* Get file status flags */
51
#define F_SETFL 4
/* Set file status flags */
52
#define F_GETOWN 5
/* Get owner */
53
#define F_SETOWN 6
/* Set owner */
54
#define F_GETLK 7
/* Get record-locking information */
55
#define F_SETLK 8
/* Set or Clear a record-lock (Non-Blocking) */
56
#define F_SETLKW 9
/* Set or Clear a record-lock (Blocking) */
57
58
#define FD_CLOEXEC 1
/* Close the file descriptor upon execution of an exec family function */
59
60
int
creat(
const
char
*, mode_t);
61
int
fcntl(
int
,
int
, ...);
62
int
open(
const
char
*,
int
, ...);
63
int
openat(
int
,
const
char
*,
int
, ...);
64
int
posix_fadvise(
int
, off_t, off_t,
int
);
65
int
posix_fallocate(
int
, off_t, off_t);
66
67
#ifdef __cplusplus
68
}
69
#endif
70
71
#endif
/* CPU_NATIVE */
72
73
#endif
/* DOXYGEN */
74
Generated on Thu Jul 3 2025 17:41:22 by
1.13.2