mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:14:58 +00:00
LibC: Implement __fpurge
This commit is contained in:
parent
cd970928a0
commit
ccef5fe234
2 changed files with 13 additions and 0 deletions
|
@ -40,6 +40,7 @@ public:
|
|||
void setbuf(u8* data, int mode, size_t size) { m_buffer.setbuf(data, mode, size); }
|
||||
|
||||
bool flush();
|
||||
void purge();
|
||||
bool close();
|
||||
|
||||
int fileno() const { return m_fd; }
|
||||
|
@ -192,6 +193,11 @@ bool FILE::flush()
|
|||
return true;
|
||||
}
|
||||
|
||||
void FILE::purge()
|
||||
{
|
||||
m_buffer.drop();
|
||||
}
|
||||
|
||||
ssize_t FILE::do_read(u8* data, size_t size)
|
||||
{
|
||||
int nread = ::read(m_fd, data, size);
|
||||
|
@ -1323,4 +1329,10 @@ int __fwriting(FILE* stream)
|
|||
|
||||
return (stream->flags() & FILE::Flags::LastWrite);
|
||||
}
|
||||
|
||||
void __fpurge(FILE* stream)
|
||||
{
|
||||
ScopedFileLock lock(stream);
|
||||
stream->purge();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue