Re: System calls parameter restrictions




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

.



Relevant Pages

  • Re: Simple question, err... I think
    ... Your nodes contain no other indication of which pointers are valid, ... struct CountedObject ... int is_red; ... bool lament(char const s) ...
    (comp.programming)
  • Re: porting problems encountered
    ... Tru64 compiles long variables to size 8 bytes while VMS and HP-UX ... platform, the size of the structure would be 12 bytes. ... when it got to the AS/400 with 128 bit pointers. ... Using the struct from before: ...
    (comp.os.vms)
  • Re: strict aliasing rules in ISO C, someone understands them ?
    ... I understand now that my interpretation of the standard was totally ... an aggregate is a struct or an array. ... struct s1 {int i; double d;}; ... Pointers are just a means of accessing the objects, ...
    (comp.lang.c)
  • Re: Array of pointers in a struct
    ... >typedef struct trieNode ... This is an array of 27 pointers. ... >And this is the code I make a new trie node, initialize and return it. ...
    (comp.lang.c)
  • Re: How are C++ objects laid out in memory ?
    ... If a C++ class or struct contains no virtual methods, ... There are no function pointers. ... >pointers which I can locate and then invoke the function pointers? ...
    (comp.lang.asm.x86)