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)
.
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);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.