Date: Mon, 06 Nov 2000 13:16:51 -0500 From: Raymond Law <rlaw@vt.edu> To: freebsd-hackers@FreeBSD.ORG Subject: system call and SYSCALL macro Message-ID: <4.3.0.20001106131527.00df0cc0@mail.vt.edu>
next in thread | raw e-mail | index | archive | help
Hi:
I am trying to implement a system call. I used the syscalls.master already.
I know I have to modify libc, but this requires makeworld and all the
binaries must be compiled again. If I don't want to modify libc, I know I
have to use the SYSCALL macro or something like that. But I don't know how
to use it. Also, I tried the syscall() function but are not getting good
results.
I just try to add a simple system call for testing:
int my_call(int x, int y) {
return (x + y);
}
In my user program:
int main(int argc, char ** argv) {
int x = 3;
int y = 8;
int z = 0;
z = syscall(SYS_my_call, x, y);
printf("%i + %i = %i\n", x, y, z);
return 0;
}
But it prints:
3 + 8 = -1
Can you give me some idea what I did wrong and what I should do? Also, can
you tell me how to use the SYSCALL macro because I am not familiar with
macros at all? Thanks in advance.
Thanks.
Ray,
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4.3.0.20001106131527.00df0cc0>
