UNIX Systems Programming for SVR4

Categories:

Recommended

When I wrote Using C on the UNIX System in 1988, UNIX was used primarily on large timesharing systems. It was administered and programmed by centralized staffs, and the everyday users of the system had little if any need to perform systems programming tasks. However, because there was not a great deal of third-party software available for UNIX, it was often necessary to “roll your own.” This meant that you needed to know all about the system calls and library routines provided by the UNIX operating system. That’s what Using C taught you.

Today, things are different. The large UNIX timesharing system is a dinosaur of the past, replaced by desktop workstations. Centralized staffs of administrators and programmers have diminished or vanished altogether, leaving the users of these workstations to fend for themselves. But because UNIX has become so widespread, so has the amount of software available for it—it’s quite likely that as a user of a UNIX workstation you may never need to write a program yourself. Someone has already written just what you need, and you can either purchase it or obtain it for free via the Internet or USENET. However, you still need to know all about the system calls and library routines provided by the UNIX operating system, because many of these packages must be ported from one version of UNIX to another.

Back in 1988, describing the UNIX programming environment required making allowances for three principal versions of UNIX: Version 7 (Seventh Edition), System V, and the Berkeley Software Distribution (BSD). There were no UNIX standards at the time, and each system did things in a slightly different way. Even within each major version things were different—4.2 BSD did things differently from 4.1 BSD, System V Release 3 did things differently from System V Release 2, and so forth. This made for a rather messy and confusing book.

Again, things are different today. Although there are more versions of UNIX than ever, they all share, thanks to standards such as POSIX, ANSI C, and X/Open, a fairly common programming interface. Unfortunately, as someone once said, “the nice thing about standards is that there are so many to choose from.” Although most modern versions of UNIX are very similar, each vendor has added its own little twists, reintroducing the difficulties the standards were supposed to eliminate. The trick now, rather than describing how to do something on each version of UNIX, is to describe how to do it on a “standard” version of UNIX and then describe how to port code written on other versions to this standard version. That’s what this book does.

The principal focus of this book, our “standard” version of UNIX, is System V Release 4, henceforth abbreviated as SVR4. Released in late 1989, SVR4 was intended to merge the best features from Berkeley-based systems such as SunOS with the best of System V, provide compatibility with Microsoft’s XENIX system, and conform to the IEEE POSIX standards. Although practically nobody uses “pure” SVR4 as it was originally released by UNIX System Laboratories, three of the four largest UNIX workstation vendors (Sun, Hewlett-Packard, and Silicon Graphics) have chosen it as the base for their most recent operating system releases. Together, these three companies’ products account for over 60% of the UNIX workstation market.

In the following chapters, nearly every SVR4 system call and library routine related to systems programming is described (libraries for other purposes, such as the math library, are not discussed). Examples are provided via small code fragments, numerous short demonstration programs, and several “real world” applications that demonstrate a large number of functions working together.

One of the major features of the book though, is the advice it offers on porting code between other versions of UNIX and SVR4-based systems. SVR4 is a completely new operating system. The amount of software currently running under these vendors’ earlier, BSD-based systems that needs to be ported to SVR4 is simply staggering. There are millions of lines of code in the freely available software packages most people take for granted, such as GNU Emacs, the X Window System, and so forth. There are probably millions more lines of code in the locally-developed applications in use at each site. To help with the porting process, most of the chapters in this book contain special sections targeted specifically at porting code. These sections describe how a task is performed on different versions of UNIX, and then explain how to change the code for these versions to perform the same task under SVR4. The porting sections also discuss differences in function names and parameters between other versions of UNIX and SVR4.

Category:

Attribution

David A. Curry. UNIX Systems Programming for SVR4. http://www.bitsinthewind.com/about-dac/publications/unix-systems-programming

VP Flipbook Maker

Convert your work to digital flipbook with VP Online Flipbook Maker! You can also create a new one with the tool. Try it now!