libc: Add fileno()
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-03-12 17:38:35 +01:00
parent 3cc2e4b2a4
commit 80a897fbc5
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,9 @@ extern "C"
/* Close a file and frees up its stream. */
int fclose(FILE* stream);
/* Return the file descriptor associated with a stream. */
int fileno(FILE* stream);
/* Read arbitrarily sized items from a stream. */
size_t fread(void* buf, size_t size, size_t nmemb, FILE* stream);

View File

@ -66,6 +66,11 @@ extern "C"
return 0;
}
int fileno(FILE* stream)
{
return stream->_fd;
}
size_t fread(void* buf, size_t size, size_t nmemb, FILE* stream)
{
if (size * nmemb == 0) return 0;