RE: What is this function doing

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

 



I'm also a newbie, but It looks to me like it's just finding the init
process and then printing some info about it.  Is this actually in the
kernel or is it part of a tutorial of sorts?




On Tue, 26 Oct 2004 22:57:47 -0600, F. A. <alhaidary@xxxxxxxxx> wrote:
> Hello All,
>
> Can anybody explain what is this function in this module doing.  this
> is newbie question but thank you for any help?
>
> static int my_init_module(void)
> {
>         if (verbose) {
>             printk(KERN_ALERT "Module %s has been loaded.\n", MYMODNAME);
>         }
>
>         /* matching process */
>         struct task_struct *p = NULL;
>         p = find_task_by_pid(1);
>
>         else {
>
>         struct thread_struct *thread = &p->thread;
>          struct vm86_struct *vm86 = NULL;
>          vm86 = thread->vm86_info;
>         /*  vm86 = p->thread.vm86_info; */
>                 pid_t mypid;
>                 mypid = p->pid;
>                 if (verbose)
>                 printk(KERN_ALERT "process pid 1 init.\n");
>                 printk(KERN_ALERT "printit: p = %p\n", p);
>                 printk(KERN_ALERT "printit: The instruction pointer
> for init is: %lu\n", KSTK_EIP(p));
>                 printk(KERN_ALERT "printit: The stack pointer for init
> is: %lu\n", KSTK_ESP(p));
>                 printk(KERN_ALERT "printit: The fs register contains
> %lu\n", thread->fs);
> }
> --
> F. A.
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
>
>


--
Brandon Niemczyk
http://bniemczyk.doesntexist.com


-- 
Brandon Niemczyk
http://bniemczyk.doesntexist.com

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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