B. Adding a System Call to Solaris

Contributed by Eric Schrock

In this appendix, we provide an example of how to add a system call to Solaris.

B.1. Setting Kernel Parameters

For the purposes of this appendix, we will assume that it’s a simple system call that lives in the generic kernel code, and we’ll put the code into an existing file to avoid having to deal with Makefiles. The goal is to print an arbitrary message to the console whenever the system call is issued.

B.1.1 Picking a Syscall Number

Before writing any real code, we first have to pick a number that will represent our system call. The main source of documentation here is syscall.h, which describes all the available system call numbers, as well as which ones are reserved. The maximum ...

Get Solaris™ Internals: Solaris 10 and OpenSolaris Kernel Architecture, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.