3

Updated to clarify :

Wrapper function is defined as a function called in user mode, which initiates calls to system calls (in kernel mode). For example open , or printf.

I'm wondering if there is any limitation in the number of arguments that the wrapper function can get?

My intuation is that it should be six because of the registers amount, but I'm not sure. I know that system call is limited to six arguemnts. (I'm talking about 32bit and 64bit where more registers exists).

thanks

meitalbs
  • 81
  • 5
  • What do you can a "wrapper" function? System calls (from application programs to kernel) are indeed limited to 6 arguments (on x86 32 bits, because they use registers for passing arguments). – Basile Starynkevitch Apr 09 '12 at 15:16
  • 1
    -1 I think there is a good question here, but it is unclear what is being asked. I'm downvoting to encourage a clarifying edit. – William Pursell Apr 09 '12 at 15:22
  • @WilliamPursell - thanks, I've updated my question. now you can take the -1 back :) – meitalbs Apr 09 '12 at 18:26

1 Answers1

0

Wrapper function is defined as a function called in user mode, which initiates calls to system calls (in kernel mode). For example open , or printf.

By your own definition, there's no limit on the number of arguments they can recieve. printf should have immediately told you. ( But note that open is itself a system call and has limitations on the number of arguments )

But when it comes to system calls like open, write etc, Linux-x86 has a limit of 6 arguments. Read here as to why and how this is.

Here is another SO post going in deeply regarding this

What are the calling conventions for UNIX & Linux system calls on x86-64

Community
  • 1
  • 1
Pavan Manjunath
  • 27,404
  • 12
  • 99
  • 125