2#include "global-sync-syscalls.h"
3#include "pedigree/kernel/process/Process.h"
4#include "pedigree/kernel/process/TerminationDeferral.h"
5#include "pedigree/kernel/process/Thread.h"
6#include "pedigree/kernel/processor/Processor.h"
7#include "pedigree/kernel/processor/ProcessorInformation.h"
8#include "pedigree/kernel/syscallError.h"
12#include "FileDescriptor.h"
13#include "PosixSubsystem.h"
14#include "modules/system/vfs/File.h"
15#include "modules/system/vfs/VFS.h"
17int posix_syncfs(
int fd) {
23 auto* subsystem =
static_cast<PosixSubsystem*
>(process->getSubsystem());
24 if (!subsystem || !subsystem->acquireFileDescriptor(fd, descriptor) ||
26 error = Error::BadFileDescriptor;
28 File* file = descriptor->getFile();
29 const auto status = file && file->getFilesystem()
31 : Filesystem::SyncStatus::Unsupported;
33 case Filesystem::SyncStatus::Success:
35 case Filesystem::SyncStatus::Unsupported:
36 error = Error::OperationNotSupported;
38 case Filesystem::SyncStatus::NoMemory:
39 error = Error::OutOfMemory;
41 case Filesystem::SyncStatus::IoError:
42 error = Error::IoError;
50 return error ? -1 : 0;
int getStatusFlags() const
Get current status flags.
static ProcessorInformation & information()
Filesystem::SyncStatus syncFilesystem(Filesystem *key)
Filesystem::SyncStatus syncAll()