From owner-freebsd-hackers Mon Nov 6 10: 8:54 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from lennier.cc.vt.edu (lennier.cc.vt.edu [198.82.161.193]) by hub.freebsd.org (Postfix) with ESMTP id 02DB737B4CF for ; Mon, 6 Nov 2000 10:08:52 -0800 (PST) Received: from mail.vt.edu (gkar.cc.vt.edu [198.82.161.190]) by lennier.cc.vt.edu (8.11.0/8.11.0) with ESMTP id eA6I8pt397314 for ; Mon, 6 Nov 2000 13:08:51 -0500 (EST) Received: from flaw.vt.edu ([198.82.82.148]) by gkar.cc.vt.edu (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) with ESMTP id <0G3M00GBD7QP6I@gkar.cc.vt.edu> for freebsd-hackers@FreeBSD.ORG; Mon, 6 Nov 2000 13:08:50 -0500 (EST) Date: Mon, 06 Nov 2000 13:16:51 -0500 From: Raymond Law Subject: system call and SYSCALL macro X-Sender: flaw@mail.vt.edu To: freebsd-hackers@FreeBSD.ORG Message-id: <4.3.0.20001106131527.00df0cc0@mail.vt.edu> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Version 4.3 Content-type: text/plain; format=flowed; charset=us-ascii Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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