syscall

syscall(num [, args...]) รข integer
Instance Public methods
Calls the operating system function identified by _num_ and
returns the result of the function or raises SystemCallError if
it failed.

Arguments for the function can follow _num_. They must be either
+String+ objects or +Integer+ objects. A +String+ object is passed
as a pointer to the byte sequence. An +Integer+ object is passed
as an integer whose bit size is same as a pointer.
Up to nine parameters may be passed (14 on the Atari-ST).

The function identified by _num_ is system
dependent. On some Unix systems, the numbers may be obtained from a
header file called <code>syscall.h</code>.

   syscall 4, 1, "hello\n", 6   # '4' is write(2) on our box

<em>produces:</em>

   hello

Calling +syscall+ on a platform which does not have any way to
an arbitrary system function just fails with NotImplementedError.
Note

syscall is essentially unsafe and unportable. Feel free to shoot your foot. DL (Fiddle) library is preferred for safer and a bit more portable programming.

doc_ruby_on_rails
2015-04-17 12:25:13
Comments
Leave a Comment

Please login to continue.