summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/SysFS/Subsystems/Kernel/Uptime.h
blob: 5a8eb002f1b6b49cfca8b62bdb6ba54f1b84a92e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/RefPtr.h>
#include <AK/Types.h>
#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.h>
#include <Kernel/KBufferBuilder.h>
#include <Kernel/UserOrKernelBuffer.h>

namespace Kernel {

class SysFSUptime final : public SysFSGlobalInformation {
public:
    virtual StringView name() const override { return "uptime"sv; }
    static NonnullRefPtr<SysFSUptime> must_create(SysFSDirectory const& parent_directory);

private:
    explicit SysFSUptime(SysFSDirectory const& parent_directory);
    virtual ErrorOr<void> try_generate(KBufferBuilder& builder) override;

    virtual bool is_readable_by_jailed_processes() const override { return true; }
};

}