GRASS 8 Programmer's Manual
8.6.0dev(2026)-8843f13794
Loading...
Searching...
No Matches
fcntl.c
Go to the documentation of this file.
1
/*!
2
* \file msvc/fcntl.c
3
*
4
* \brief Wrapper functions for MSVC _open() and _creat() that convert
5
* permission mode.
6
*
7
* SPDX-FileCopyrightText: 2025 GRASS Development Team
8
* SPDX-License-Identifier: GPL-2.0-or-later
9
*
10
* \author Huidae Cho
11
*
12
* \date 2025
13
*/
14
15
#include <stdarg.h>
16
#include <
fcntl.h
>
17
#include <
sys/stat.h
>
18
19
#define O_TMPFILE O_TEMPORARY
20
21
int
__open
(
const
char
*
pathname
,
int
flags, ...)
22
{
23
if
(flags & (
O_CREAT
|
O_TMPFILE
)) {
24
va_list
ap
;
25
int
mode;
26
27
va_start
(
ap
, flags);
28
mode =
va_arg
(
ap
,
int
);
29
va_end
(
ap
);
30
31
return
_open
(
pathname
, flags,
32
(mode & 0400 ?
_S_IREAD
: 0) |
33
(mode & 0200 ?
_S_IWRITE
: 0));
34
}
35
36
return
_open
(
pathname
, flags);
37
}
38
39
int
__creat
(
const
char
*
pathname
,
int
mode)
40
{
41
return
_creat
(
pathname
,
42
(mode & 0400 ?
_S_IREAD
: 0) | (mode & 0200 ?
_S_IWRITE
: 0));
43
}
AMI_STREAM
Definition
ami_stream.h:153
O_TMPFILE
#define O_TMPFILE
Definition
fcntl.c:19
__creat
int __creat(const char *pathname, int mode)
Definition
fcntl.c:39
__open
int __open(const char *pathname, int flags,...)
Definition
fcntl.c:21
fcntl.h
Header file for msvc/fcntl.c.
stat.h
msvc
fcntl.c
Generated on Tue Sep 15 2026 06:57:42 for GRASS 8 Programmer's Manual by
1.9.8