  | |  | implementation of recv() and send() | implementation of recv() and send() 2004-06-15 - By Tsakiridis Antonis
Back On Tue, 15 Jun 2004 20:25:00 +0530 (IST), K S SUNDEEP REDDY <sundeep@(protected)> wrote:
As far as the location of recv() and send() is concerned, I guess you 'll have to do some more searching since I do not remember....
For the second matter:
When kernel code is executed as part of a user space process, the task struct of the current process is pointed by the "current" pointer. Hence, you can access the current processes id from your module like this:
current->pid
Below, I attach an excerpt from the book "Linux Device Drivers, 2nd Edition", By Alessandro Rubini & Jonathan Corbet :
{ The Current Process
Although kernel modules don't execute sequentially as applications do, most actions performed by the kernel are related to a specific process. Kernel code can know the current process driving it by accessing the global item current, a pointer to struct task_struct, which as of version 2.4 of the kernel is declared in <asm/current.h>, included by <linux/sched.h>. The current pointer refers to the user process currently executing. During the execution of a system call, such as open or read, the current process is the one that invoked the call. Kernel code can use process-specific information by using current, if it needs to do so. An example of this technique is presented in "Access Control on a Device File", in Chapter 5, "Enhanced Char Driver Operations". }
By the way, this book is great and most of all FREE!
I think you 'd get more answers in matters like these in lower lever mailing-lists, although I have none to propose...
Regards,
> hi > i am trying to modify the recv() and send() system calls in red hat linux > kernel version 2.4.26. i am unable to find the code for the specified > function in the kernel source code. can anyone please help me out in this > matter. > > also i am having the following problems > > i am writing a kernel module for modifying read() and write() system > calls > how do i know the process id of the calling process from this module? > > Hoping that someone can help me. > > warm regards, > sundeep > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- --- > This email was sent from IIT Guwahati Webmail.If you are not the > intended recipient, please contact the sender by email and delete all > copies; your cooperation in this regard is appreciated. > http://www.iitg.ernet.in > > >
-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks transtec Computers for their support.
-- Shrike-list mailing list Shrike-list@(protected) https://www.redhat.com/mailman/listinfo/shrike-list
Earn $52 per hosting referral at Lunarpages.
|
|
 |