Core kernel, Creating Syscalls: Where is the syscall table?

Where is the syscall table located under an x86_64 system?

I have compiled a 2.6.25.9 kernel using the opensuse config file. I am trying to add some system calls to my development kernel but I can’t find the syscall table for 64 bit arch. I have found unistd_64.h but there is only a syscall_table_32.S in the arch directory.

So, my user space code for the syscall will not compile because the syscall has not been defined. Where is the syscall table for the 64 bit arch?

thanks for your patience,

brahan

note that I have added my syscall definitions to the unistd_32.h and syscall_table_32.S but my user program still says that the syscall is undefined so that is why I think I need the syscall_table for 64 bit

brahan7 wrote:

>
> note that I have added my syscall definitions to the unistd_32.h and
> syscall_table_32.S but my user program still says that the syscall is
> undefined so that is why I think I need the syscall_table for 64 bit
>
>

You’re trying too hard.

#include <linux/unistd.h>

works quite well for both 32 bit and 64 bit systems (have both here)

(all this is in ‘/usr/include’)

View the files, you’ll see that ‘linux/unistd.h’ actually
includes ‘asm/unistd.h’…

Which then determines whether you have 32/64 bit system, and includes the
appropriate unistd_32.h or unistd_64.h

Take Care,

Loni


L R Nix
lornix@lornix.com

brahan7 wrote:

>
> note that I have added my syscall definitions to the unistd_32.h and
> syscall_table_32.S but my user program still says that the syscall is
> undefined so that is why I think I need the syscall_table for 64 bit
>
>

Oops, hate it when I send too soon,

#include <sys/syscall.h>

will get your syscall definitions too.

Oh pooh! almost did it again,

man page for syscall

man 2 syscall

says that <unistd.h> and <sys/syscall.h> should be included.

Hmmm, I’ve always included <linux/unistd.h> too.

{Sigh} ok, I could be wrong here, shoot me. But at least you might be closer
to your goal.

(NOW I’ve got to go check my code…)

{good-natured grumbling}

Loni

L R Nix
lornix@lornix.com

brahan7 wrote:

>
> note that I have added my syscall definitions to the unistd_32.h and
> syscall_table_32.S but my user program still says that the syscall is
> undefined so that is why I think I need the syscall_table for 64 bit
>
>

As an aside…

It’s not recommended to edit any of the system includes. If you need
something like that, make your own .h header file and include it as required.
Editing the system headers will make your programs fail to compile properly
on anyone else’s machine, since they wouldn’t have the matching edit.

Quite permissible to do:

// brahan7’s stuff
//
#include <sys/syscall.h>
//
// define my calls here
#define SYS_brahan __NR_exit
//

Or whatever. (contrived example above)

Loni

I’ll shut up now…


L R Nix
lornix@lornix.com