Re: Linux Kernel and Device Drivers

2013-07-18 Thread Srinivas Ganji
Yes. As said by Anish, I generally practice through a dummy hello world
module. Suppose, if I want to print all the processes currently running, I
do like this.

#include linux/module.h
#include linux/kernel.h
#include linux/sched.h

MODULE_LICENSE(Dual BSD/GPL);

static int hello_init(void)
{
struct task_struct *task;

printk(Hello World!\n);
 for_each_process(task) {
printk(%s %d\n, task-comm, task-pid);
}
 printk(\n\n\n);
 for(task = init_task; ((task=next_task(task)) != init_task) ; )
printk(%s %d\n, task-comm, task-pid);
 printk(\n\n\n);
 return 0;
}

static void hello_exit(void)
{
printk(Good bye!\n);
}

module_init(hello_init);
module_exit(hello_exit);

By the way, you can do as suggested by Valdis, too. I do search for a
particular code/strings using find, xargs, grep combination.

I hope this helps you.

Regards,
Srinivas



On Tue, Jul 16, 2013 at 12:42 PM, Satya Prakash Prasad 
unixkernel...@gmail.com wrote:

 Thanks .. I have another question. I was trying to practice some kernel
 process management APIs as in
 http://reiber.org/nxt/pub/Linux/LinuxKernelDevelopment/Linux.Kernel.Development.3rd.Edition.pdfhttp://www.linkedin.com/redirect?url=http%3A%2F%2Freiber%2Eorg%2Fnxt%2Fpub%2FLinux%2FLinuxKernelDevelopment%2FLinux%2EKernel%2EDevelopment%2E3rd%2EEdition%2Epdfurlhash=3MN8_t=tracking_disc(Linux
  Kernel Development by Robert Love, 3rd edition).

 I am not sure how to practice the code snippet given in the text book. I
 can understand the theory but do not find a way to practice. For example: I
 want to read a process 'struct task_struct' to find it parent's process
 identifier, how many tasks are in which state, creating kernel threads etc?

 Any idea?


 On Mon, Jul 15, 2013 at 2:32 PM, Srinivas Ganji 
 srinivasganji.ker...@gmail.com wrote:

 As per as I know, you can follow two text books.

 1. Linux Kernel Development by Robert Love, 3rd edition.
 2. Linux Device Drivers by Alessandro Rubini, Jonathan Corbet, Greh
 Kroah-Hartman. 3rd edition.

 At the same time, you can practice the exercises given in the text books
 - practice makes a man perfect. The other thing is Make your hands dirty
 by digging the kernel code whenever you have a doubt.

 Regards,
 Srinivas




 On Mon, Jul 15, 2013 at 2:06 PM, Satya Prakash Prasad 
 unixkernel...@gmail.com wrote:

 Please let me know how to study and get hands on experience on Linux
 Kernel and Device Drivers?

 Regards,
 Prakash

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Linux Kernel and Device Drivers

2013-07-18 Thread Satya Prakash Prasad
Thanks to Srinivas and others. I got a point to start from.

Regards,
Prakash


On Thu, Jul 18, 2013 at 12:01 PM, Srinivas Ganji 
srinivasganji.ker...@gmail.com wrote:

 Yes. As said by Anish, I generally practice through a dummy hello world
 module. Suppose, if I want to print all the processes currently running, I
 do like this.

 #include linux/module.h
 #include linux/kernel.h
 #include linux/sched.h

 MODULE_LICENSE(Dual BSD/GPL);

 static int hello_init(void)
 {
 struct task_struct *task;

 printk(Hello World!\n);
  for_each_process(task) {
  printk(%s %d\n, task-comm, task-pid);
 }
  printk(\n\n\n);
  for(task = init_task; ((task=next_task(task)) != init_task) ; )
  printk(%s %d\n, task-comm, task-pid);
  printk(\n\n\n);
  return 0;
 }

 static void hello_exit(void)
 {
 printk(Good bye!\n);
 }

 module_init(hello_init);
 module_exit(hello_exit);

 By the way, you can do as suggested by Valdis, too. I do search for a
 particular code/strings using find, xargs, grep combination.

 I hope this helps you.

 Regards,
 Srinivas



 On Tue, Jul 16, 2013 at 12:42 PM, Satya Prakash Prasad 
 unixkernel...@gmail.com wrote:

 Thanks .. I have another question. I was trying to practice some kernel
 process management APIs as in
 http://reiber.org/nxt/pub/Linux/LinuxKernelDevelopment/Linux.Kernel.Development.3rd.Edition.pdfhttp://www.linkedin.com/redirect?url=http%3A%2F%2Freiber%2Eorg%2Fnxt%2Fpub%2FLinux%2FLinuxKernelDevelopment%2FLinux%2EKernel%2EDevelopment%2E3rd%2EEdition%2Epdfurlhash=3MN8_t=tracking_disc(Linux
  Kernel Development by Robert Love, 3rd edition).

 I am not sure how to practice the code snippet given in the text book. I
 can understand the theory but do not find a way to practice. For example: I
 want to read a process 'struct task_struct' to find it parent's process
 identifier, how many tasks are in which state, creating kernel threads etc?

 Any idea?


 On Mon, Jul 15, 2013 at 2:32 PM, Srinivas Ganji 
 srinivasganji.ker...@gmail.com wrote:

 As per as I know, you can follow two text books.

 1. Linux Kernel Development by Robert Love, 3rd edition.
 2. Linux Device Drivers by Alessandro Rubini, Jonathan Corbet, Greh
 Kroah-Hartman. 3rd edition.

 At the same time, you can practice the exercises given in the text books
 - practice makes a man perfect. The other thing is Make your hands dirty
 by digging the kernel code whenever you have a doubt.

 Regards,
 Srinivas




 On Mon, Jul 15, 2013 at 2:06 PM, Satya Prakash Prasad 
 unixkernel...@gmail.com wrote:

 Please let me know how to study and get hands on experience on Linux
 Kernel and Device Drivers?

 Regards,
 Prakash

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies





___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Is the Kernel Janitors project still alive?

2013-07-18 Thread Christopher Stanton
I have been poking around on the Kernel Newbies site and there are listings
about the old Kernel Janitors project but everything seems out of date in
addition to various versions/homes of the Kernel Janitors project floating
around at various URLs.

Is there some live version of this project somewhere or has there been a
replacement? A unified list of needed but non-critical clean-ups? Or, is it
suggested people just look at bug reports?

sincerely,
Christopher
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Where is the system call table in linux kernel v3.9?

2013-07-18 Thread Valdis . Kletnieks
On Thu, 18 Jul 2013 18:14:22 +0530, Sudip Mukherjee said:
 Hi
 In 3.10.1 the system call table is in arch/x86/syscalls/syscall_32.tbl

Only for x86.  You're on an ARM or PowerPC or MIPS or any of the other 27
or so architectures we support, it's elsewhere. ;)


pgp7413KqpI0x.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Is the Kernel Janitors project still alive?

2013-07-18 Thread Valdis . Kletnieks
On Thu, 18 Jul 2013 08:33:05 -0500, Christopher Stanton said:

 Is there some live version of this project somewhere or has there been a
 replacement? A unified list of needed but non-critical clean-ups? Or, is it
 suggested people just look at bug reports?

Janitors is pretty much deceased, for several reasons:

1) Most of the low-hanging fruit that can be done by somebody who's just
starting out has already been done.  The kernel tree is much cleaner than it
was when the Janitors project started.

2) There's fewer old APIs to clean up, as most subsystem maintainers require
that a patch series that replaces an API also clean up the old one.

3) For many subsystems, the maintainer will give some pushback for style
cleanup patches not part of actual development, for two reasons:  (a) it's
possible for a cleanup patch to break something (for instance, a bad cleanup
of curly brackets can change the control flow).  So they don't like patches
against old stable code that could destabilize it.  (b) If there *is* other
development going on, style cleanups cause merge conflicts (unless they're
done as Step 0 of a development patch, by the guy writing the code, so
all the conflicts are pre-resolved).

A good place to start is to just use git to suck down the current linux-next
tree, build it, run it, and report all problems you encounter. Most code only
gets tested on the 3-4 boxes the code author has access to before it gets into
the linux-next tree. I usually manage to trip over anywhere from 1 to 5 bugs
per kernel release, just because nobody else has actually tried running the
code on a Dell Latitude with the same .config as I have and the same workflow.

If anything, we need a good pool of kernel testers even more than we need more
kernel coders. (And you'll learn a ton that way too - some 95% of what I know
about kernel innards has come from Oh crud, what did I break *this* time?
investigation...



pgpH3iYEdfG6a.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kernel Testing (was Re: Is the Kernel Janitors project still alive?)

2013-07-18 Thread Valdis . Kletnieks
On Thu, 18 Jul 2013 10:58:36 -0700, Arlie Stephens said:

 Does the linux kernel have any kind of regression test package? If so,
 where can I find it? If not, does anyone know of ongoing attempts to
 create one?

 A quick web search gave me a few pointers to attempts at this:

The Google-foo is weak in this one. :)  You missed the biggest one of all:

The Linux Test Project: http://ltp.sourceforge.net/

Enjoy.  If this doesn't address your needs, feel free to contribute to it
until it does. :)


pgpiu1r4Oskfv.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Notifier chains

2013-07-18 Thread PV Juliet
Hi ,
   I am new to kernel and i would like to know where i can get sample
programs to use notifier chains .How to subscribe the notifier chains to
some application so that i will get notified. Is there any way make this as
service in linux system??

Thanks and Regards
Juliet
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies