Re: System calls parameter restrictions
- From: "David Schwartz" <davids@xxxxxxxxxxxxx>
- Date: 26 Oct 2006 01:54:12 -0700
Rafael Almeida wrote:
Are there any restrictions on the parameters that are passed to a
system call? Is it possible to pass a struct as a parameter to a system
call?
Obviously, nobody would design a system that had a system call that
required a parameter you couldn't pass the value for. You can always
pass pointers, otherwise 'read' and 'write' wouldn't work. A struct
would be passed by address.
The _syscall1 macro tries to cast the parameter to a ``long''. Does it
mean that a struct or union type cannot be passed by value? Only as a
pointer?
Mine doesn't cast the parameter to a long. It looks like this:
#define _syscall1(type,name,type1,arg1) \
type name(type1 arg1) \
{\
return syscall(__NR_##name, arg1);\
}
And 'syscall' takes the number of the system call and then '...'.
I believe structs and unions are never passed by value, but I'm not
sure.
DS
.
- Follow-Ups:
- Re: System calls parameter restrictions
- From: Rafael Almeida
- Re: System calls parameter restrictions
- References:
- System calls parameter restrictions
- From: Rafael Almeida
- System calls parameter restrictions
- Prev by Date: Re: writing/finding pci bar0
- Next by Date: Re: writing to syslog file
- Previous by thread: System calls parameter restrictions
- Next by thread: Re: System calls parameter restrictions
- Index(es):
Relevant Pages
|