summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/fsync.cpp
blob: 15fda4ac2e5d48284c69e7f7930bbc3540de616a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * Copyright (c) 2021, the SerenityOS developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <Kernel/Process.h>

namespace Kernel {

ErrorOr<FlatPtr> Process::sys$fsync(int fd)
{
    VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
    TRY(require_promise(Pledge::stdio));
    auto description = TRY(fds().open_file_description(fd));
    TRY(description->sync());
    return 0;
}

}