Reputation: 159
How can I execute syscalls directly? I'm using OpenBSD right now, the Unix platform.
I want to be able to call syscalls without the 'wrapper', as an example:
instead of write(1, "hello!", 6)
I'd like to be able to type syscall (4, 1, "hello!", 6)
.
Upvotes: 2
Views: 350
Reputation: 11
You can use syscall(2)
or __syscall(2)
.
#include <sys/syscall.h> /* syscall constants */
#include <unistd.h> /* syscall() */
int
main(void)
{
syscall(SYS_write, 1, "Hello\n", 7);
}
Upvotes: 1