From owner-freebsd-questions Mon May 17 14:22:10 1999 Delivered-To: freebsd-questions@freebsd.org Received: from sol (cs1-gw.cs.binghamton.edu [128.226.171.72]) by hub.freebsd.org (Postfix) with SMTP id 9D26A156ED for ; Mon, 17 May 1999 14:22:04 -0700 (PDT) (envelope-from zzhang@cs.binghamton.edu) Received: from localhost (zzhang@localhost) by sol (SMI-8.6/8.6.9) with SMTP id RAA27721; Mon, 17 May 1999 17:10:57 -0400 Date: Mon, 17 May 1999 17:10:57 -0400 (EDT) From: Zhihui Zhang Reply-To: Zhihui Zhang To: yiyung@mmlab.snu.ac.kr Cc: dwhite@resnet.uoregon.edu, freebsd-questions@FreeBSD.ORG Subject: Procedure used to add a system call In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I have used the following steps to add system calls to FreeBSD 3.1 several times. Suppose you want to add a system call: int mysys(int a, int b, int c). You can do the following steps: (1) # cd /usr/src/sys/kern (2) # vi syscalls.master to add your system call into the file: 172 STD BSD { int mysys(int a, int b, int c); } The number 172 can be another number that is not currently in use. (3) # sh makesyscalls.sh syscalls.master This creates three files: syscall.h, syscall-hide.h, and sysproto.h. (4) # vi mysys.c Edit your file to implement your mysys(). You can follow the file kern/vfs_syscalls.c. (6) # vi /sys/conf/files to add you file mysys.c into it. (7) Make a new kernel and install it (see FreeBSD handbook) The following steps update the libc library: (8) copy syscall.h, syscall-hide.h, and sysproto.h to /usr/include/sys (9) # cd /usr/src/lib/libc (10) # make obj (11) # make depend (12) # make all (13) # make insall Now you can reboot your machine and write a program that uses your mysys(). Good luck! -Zhihui To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message