Loading...
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/fs.h>
3#include <linux/init.h>
4#include <linux/kernel.h>
5#include <linux/proc_fs.h>
6#include <linux/seq_file.h>
7#include <linux/utsname.h>
8#include "internal.h"
9
10static int version_proc_show(struct seq_file *m, void *v)
11{
12 seq_printf(m, linux_proc_banner,
13 utsname()->sysname,
14 utsname()->release,
15 utsname()->version);
16 return 0;
17}
18
19static int __init proc_version_init(void)
20{
21 struct proc_dir_entry *pde;
22
23 pde = proc_create_single("version", 0, NULL, version_proc_show);
24 pde_make_permanent(pde);
25 return 0;
26}
27fs_initcall(proc_version_init);
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/fs.h>
3#include <linux/init.h>
4#include <linux/kernel.h>
5#include <linux/proc_fs.h>
6#include <linux/seq_file.h>
7#include <linux/utsname.h>
8
9static int version_proc_show(struct seq_file *m, void *v)
10{
11 seq_printf(m, linux_proc_banner,
12 utsname()->sysname,
13 utsname()->release,
14 utsname()->version);
15 return 0;
16}
17
18static int version_proc_open(struct inode *inode, struct file *file)
19{
20 return single_open(file, version_proc_show, NULL);
21}
22
23static const struct file_operations version_proc_fops = {
24 .open = version_proc_open,
25 .read = seq_read,
26 .llseek = seq_lseek,
27 .release = single_release,
28};
29
30static int __init proc_version_init(void)
31{
32 proc_create("version", 0, NULL, &version_proc_fops);
33 return 0;
34}
35fs_initcall(proc_version_init);