Re: problem with System call!!

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

 



On Tue, Apr 02, 2002 at 12:59:40AM -0800, Pavan Kumar Achanta wrote:
>    I was tring to implement the standard pedagogictime system
> call from 'nutt'.. It got compiled but got an error :
> 
>    Error while loading shared libraries : libc.80.6   Cannot
> stat shared object: Error 14  /sbin/mingetty 
> 
>  when I restart with the new kernel image
>   And this is what I did .....
> 
> 
> ********* step1 *******************
> /usr/src/linux/arch/i386/kernel/entry.S
> 
> .data
> ENTRY(sys_call_table)
>     .long SYMBOL_NAME(sys_ni_syscall)   /* 0  -  old "setup()"
> system call*/
>     .long SYMBOL_NAME(sys_exit)
>     .long SYMBOL_NAME(sys_fork)
>     .long SYMBOL_NAME(sys_read)
>     .long SYMBOL_NAME(sys_write)
>     .long SYMBOL_NAME(sys_open)     /* 5 */   
> 	
> 	..................
> 
>     .long SYMBOL_NAME(sys_ni_syscall)       /* streams1 */
>     .long SYMBOL_NAME(sys_ni_syscall)       /* streams2 */
>     .long SYMBOL_NAME(sys_vfork)            /* 190 */
> 	
>     .long SYMBOL_NAME(sys_pedagogictime)    /* 191 */ 
>  
>     .rept NR_syscalls-191  //change number -190 to -191
>         .long SYMBOL_NAME(sys_ni_syscall)
>     .endr
> 
> it was NR_syscalls-221 and changed it to NR_syscalls-191

Funny, the number should have increased! I mean, when you added
a syscall, you must have had shotened the padding at the end.
Ie. if there was NR_syscalls-221, then it should end up as
NR_syscalls-222. And your syscall should have had number 222.

> //********* step2 *******************
> And  one more line to file /usr/src/linux/include/asm/unistd.h
> 
> #define __NR_sigaltstack    186
> #define __NR_sendfile       187
> #define __NR_getpmsg        188 /* some people actually want
> streams */
> #define __NR_putpmsg        189 /* some people actually want
> streams */
> #define __NR_vfork      190
> #define __NR_pedagogictime  191 /*Bill add this line for lab4 */
> 
> 
> Here I didnt know what to do about the already existing 
> #define __NR_mmap  191  so I just kept it as it is..  
Funny... I see (kernel 2.4.17):
#define __NR_ugetrlimit         191     /* SuS compliant getrlimit */
#define __NR_mmap2              192
And IIRC syscall's can't be renumbered, because that would require
recompilation of libc.

>   Can somebody tell me what the line 

Choose different number; this one is already in use!

>   .rept NR_syscalls-191  //change number -190 to -191
>         .long SYMBOL_NAME(sys_ni_syscall)
>     .endr

In 2.4.17, I see:
        .rept NR_syscalls-(.-sys_call_table)/4
	        .long SYMBOL_NAME(sys_ni_syscall)
	.endr
Which is The Right Thing. Which kernel version are you using?

>   means and how the whole thing works!!! and what is the right
> way to add a system call ....

You just have to pick an unused number. The one you used seems not to be
a good one.

--------------------------------------------------------------------------------
                  				- 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