Re: System calls within the kernel??

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

 



Hello,

On Sat, Apr 27, 2002 at 01:57:51AM +0000, krishnan charumathi wrote:
> so, I would like to know if we can make a system call from within the 
> kernel.
> I tried doing it , by calling getpid() from a system call that i already 
> wrote. but, while make bzImage, kernel complains as "getpid() undefined 
> symbol".

You don't want to call syscalls from kernel. You want to do the thing
they do. Every syscall is implemented by function sys_<syscall_name> in
kernel (perhaps with some rare exceptions). This function genaly handles
passing data to user-land (that you don't need) and either do something
trivial or call function to do real work. You want to call whatever does
the real work.

IRRC for getpid the real work consists solely of expression current->pid.

> within my system call code, I called getpid() as
> printk("Process Id %d\n",getpid());

Here, this will do:
printk(Process Id %d\n", current->pid);

--------------------------------------------------------------------------------
                  				- Jan Hudec `Bulb' <bulb@ucw.cz>
--
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