summaryrefslogtreecommitdiff
path: root/components/dfs/dfs_v2/filesystems/procfs/proc_version.c
blob: 1ca803543efb4cf2715fdcf71a0a7b358ac70c9c (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 * Copyright (c) 2006-2023, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 */

#include "proc.h"
#include "procfs.h"

#include <rthw.h>
#include <rtdbg.h>

#include <fcntl.h>
#include <errno.h>

#include <dfs_dentry.h>


static int single_show(struct dfs_seq_file *seq, void *data)
{
    dfs_seq_puts(seq, "\n \\ | /\n");
#ifdef RT_USING_SMART
    dfs_seq_puts(seq, "- RT -     Thread Smart Operating System\n");
#else
    dfs_seq_puts(seq, "- RT -     Thread Operating System\n");
#endif
    dfs_seq_printf(seq, " / | \\     %d.%d.%d build %s %s\n",
                    (rt_int32_t)RT_VERSION_MAJOR, (rt_int32_t)RT_VERSION_MINOR, (rt_int32_t)RT_VERSION_PATCH,
                    __DATE__, __TIME__);
    dfs_seq_puts(seq, " 2006 - 2022 Copyright by RT-Thread team\n");

    return 0;
}

int proc_version_init(void)
{
    struct proc_dentry *dentry = proc_create_single_data("version", 0, NULL, single_show, NULL);
    proc_release(dentry);

    return 0;
}
INIT_ENV_EXPORT(proc_version_init);