blob: 8233e7af9389dc8316e71a4f42e0206a6ceb5e9b [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Alexey Dobriyancf9887f2008-10-04 14:13:59 +04002#include <linux/fs.h>
3#include <linux/init.h>
4#include <linux/proc_fs.h>
5#include <linux/seq_file.h>
6
7static int cmdline_proc_show(struct seq_file *m, void *v)
8{
Alexey Dobriyan58c501a2018-04-10 16:32:01 -07009 seq_puts(m, saved_command_line);
10 seq_putc(m, '\n');
Alexey Dobriyancf9887f2008-10-04 14:13:59 +040011 return 0;
12}
13
14static int cmdline_proc_open(struct inode *inode, struct file *file)
15{
16 return single_open(file, cmdline_proc_show, NULL);
17}
18
19static const struct file_operations cmdline_proc_fops = {
20 .open = cmdline_proc_open,
21 .read = seq_read,
22 .llseek = seq_lseek,
23 .release = single_release,
24};
25
26static int __init proc_cmdline_init(void)
27{
28 proc_create("cmdline", 0, NULL, &cmdline_proc_fops);
29 return 0;
30}
Paul Gortmakerabaf3782014-01-23 15:55:45 -080031fs_initcall(proc_cmdline_init);