summaryrefslogtreecommitdiffstats
path: root/usr/include/fcntl.h
blob: cb2e4e53b3330757f54d4f87a7e181fd49dee6af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * fcntl.h
 */

#ifndef _FCNTL_H
#define _FCNTL_H

#include <klibc/extern.h>
#include <klibc/compiler.h>
#include <klibc/seek.h>
#include <sys/types.h>
#if defined(__mips__) && ! defined(__mips64)
# include <klibc/archfcntl.h>
#elif _BITSIZE == 32
/* We want a struct flock with 64-bit offsets, which we define below */
# define HAVE_ARCH_STRUCT_FLOCK
#endif
#include <linux/fcntl.h>
#include <bitsize.h>

#if !defined(__mips__) && _BITSIZE == 32

/*
 * <linux/fcntl.h> defines struct flock with offsets of type
 * __kernel_off_t (= long) and struct flock64 with offsets of
 * type __kernel_loff_t (= long long).  We want struct flock
 * to have 64-bit offsets, so we define it here.
 */

struct flock {
	short  l_type;
	short  l_whence;
	__kernel_loff_t l_start;
	__kernel_loff_t l_len;
	__kernel_pid_t  l_pid;
#ifdef __ARCH_FLOCK64_PAD
        __ARCH_FLOCK64_PAD
#endif
};

#ifdef F_GETLK64
# undef F_GETLK
# define F_GETLK F_GETLK64
#endif

#ifdef F_SETLK64
# undef F_SETLK
# define F_SETLK F_SETLK64
#endif

#ifdef F_SETLKW64
# undef F_SETLKW
# define F_SETLKW F_SETLKW64
#endif

#endif /* _BITSIZE == 32 */

/* This is defined here as well as in <unistd.h> */
#ifndef _KLIBC_IN_OPEN_C
__extern int open(const char *, int, ...);
__extern int openat(int, const char *, int, ...);
#endif

__extern int creat(const char *, mode_t);
__extern int fcntl(int, int, ...);

#endif				/* _FCNTL_H */