Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 May 1999 17:10:57 -0400 (EDT)
From:      Zhihui Zhang <zzhang@cs.binghamton.edu>
To:        yiyung@mmlab.snu.ac.kr
Cc:        dwhite@resnet.uoregon.edu, freebsd-questions@FreeBSD.ORG
Subject:   Procedure used to add a system call
Message-ID:  <Pine.GSO.3.96.990517164646.27557A-100000@sol.cs.binghamton.edu>
In-Reply-To: <Pine.BSF.4.03.9905171319500.15052-100000@resnet.uoregon.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.3.96.990517164646.27557A-100000>