Re: obtaining linux kernel command line from a module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 21 May 2010, Jason Nymble wrote:

>
> On 21 May 2010, at 12:07 PM, Jason Nymble wrote:
>
> > Is there a way (e.g. exported variable or kernel API) for a kernel module to obtain the linux kernel command line? i.e. the contents as seen from userspace by 'cat /proc/cmdline'
>
> I see linux/init.h has:
> extern char __initdata boot_command_line[];
>
> Will try that...

  "__initdata" typically means that, once the kernel is running, that
space is freed so a module won't have access to it.  you probably want
to look at what's just below that in init/main.c:

...
/* Untouched command line saved by arch-specific code. */
char __initdata boot_command_line[COMMAND_LINE_SIZE];
/* Untouched saved command line (eg. for /proc) */
char *saved_command_line;
...

although since i don't see that being EXPORTed, you won't have access
to that, either.  good question.  now i'm curious ...

rday

-- 

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux