From owner-freebsd-questions Mon Nov 6 8:44:13 2000 Delivered-To: freebsd-questions@freebsd.org Received: from lennier.cc.vt.edu (lennier.cc.vt.edu [198.82.161.193]) by hub.freebsd.org (Postfix) with ESMTP id 5851037B4CF for ; Mon, 6 Nov 2000 08:44:10 -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 eA6Gi9t379240 for ; Mon, 6 Nov 2000 11:44:09 -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 <0G3M0079M3TJIJ@gkar.cc.vt.edu> for freebsd-questions@FreeBSD.ORG; Mon, 6 Nov 2000 11:44:08 -0500 (EST) Date: Mon, 06 Nov 2000 11:52:19 -0500 From: Raymond Law Subject: system call and SYSCALL macro X-Sender: flaw@mail.vt.edu To: freebsd-questions@FreeBSD.ORG Message-id: <4.3.0.20001106114918.01cc6bb0@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-questions@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-questions" in the body of the message