PatchworkOS
Loading...
Searching...
No Matches
fgetc.c
Go to the documentation of this file.
1
#include <
stdio.h
>
2
#include <
stdlib.h
>
3
4
#include "
user/common/file.h
"
5
#include "
user/common/syscalls.h
"
6
7
int
fgetc
(
FILE
* stream)
8
{
9
int
result =
EOF
;
10
11
mtx_lock
(&stream->
mtx
);
12
13
if
(
_file_prepare_read
(stream) !=
ERR
)
14
{
15
if
(
_FILE_CHECK_AVAIL
(stream) !=
ERR
)
16
{
17
result =
_FILE_GETC
(stream);
18
}
19
}
20
21
mtx_unlock
(&stream->
mtx
);
22
23
return
result;
24
}
fgetc
int fgetc(FILE *stream)
Definition
fgetc.c:7
ERR
#define ERR
Integer error value.
Definition
ERR.h:17
_file_prepare_read
uint64_t _file_prepare_read(FILE *stream)
Definition
file.c:224
file.h
_FILE_GETC
#define _FILE_GETC(stream)
Definition
file.h:49
_FILE_CHECK_AVAIL
#define _FILE_CHECK_AVAIL(fh)
Definition
file.h:53
syscalls.h
stdio.h
EOF
#define EOF
Definition
stdio.h:25
stdlib.h
FILE
Definition
file.h:34
FILE::mtx
mtx_t mtx
Definition
file.h:45
mtx_lock
_PUBLIC int mtx_lock(mtx_t *mtx)
Definition
mtx_lock.c:11
mtx_unlock
_PUBLIC int mtx_unlock(mtx_t *mtx)
Definition
mtx_unlock.c:10
src
libstd
user
functions
stdio
fgetc.c
Generated by
1.9.8