fileio.h
Go to the documentation of this file.
1 #ifndef NVIM_OS_FILEIO_H
2 #define NVIM_OS_FILEIO_H
3 
4 #include <stdbool.h>
5 #include <stddef.h>
6 
7 #include "nvim/func_attr.h"
8 #include "nvim/rbuffer.h"
9 
11 typedef struct {
12  int fd;
13  int _error;
15  bool wr;
16  bool eof;
17  bool non_blocking;
19 
21 typedef enum {
24  kFileWriteOnly = 4,
26  kFileNoSymlink = 8,
29  kFileTruncate = 32,
32  kFileAppend = 64,
35  kFileNonBlocking = 128,
39 
40 static inline bool file_eof(const FileDescriptor *const fp)
42 
49 static inline bool file_eof(const FileDescriptor *const fp)
50 {
51  return fp->eof && rbuffer_size(fp->rv) == 0;
52 }
53 
54 static inline int file_fd(const FileDescriptor *const fp)
56 
62 static inline int file_fd(const FileDescriptor *const fp)
63 {
64  return fp->fd;
65 }
66 
67 enum {
72 };
73 
74 #ifdef INCLUDE_GENERATED_DECLARATIONS
75 # include "os/fileio.h.generated.h"
76 #endif
77 #endif // NVIM_OS_FILEIO_H
Open file read-only. Default.
Definition: fileio.h:22
Definition: fileio.h:31
bool eof
True if end of file was encountered.
Definition: fileio.h:16
bool wr
True if file is in write mode.
Definition: fileio.h:15
Definition: fileio.h:36
Structure used to read from/write to file.
Definition: fileio.h:11
Do not allow symbolic links.
Definition: fileio.h:27
Definition: rbuffer.h:77
bool non_blocking
True if EAGAIN should not restart syscalls.
Definition: fileio.h:17
static int REAL_FATTR_WARN_UNUSED_RESULT
Definition: typval_encode.c.h:295
ufunc_T * fp
Definition: eval.c:6569
Definition: fileio.h:34
#define REAL_FATTR_NONNULL_ALL
Definition: func_attr.h:183
Definition: fileio.h:23
Definition: fileio.h:25
size_t rbuffer_size(RBuffer *buf) FUNC_ATTR_NONNULL_ALL
Definition: rbuffer.c:40
Definition: fileio.h:28
FileOpenFlags
file_open() flags
Definition: fileio.h:21
int fd
File descriptor.
Definition: fileio.h:12
Definition: fileio.h:71
#define REAL_FATTR_PURE
Definition: func_attr.h:163
int _error
Error code for use with RBuffer callbacks or zero.
Definition: fileio.h:13
RBuffer * rv
Read or write buffer.
Definition: fileio.h:14