Keywords: lpg

Next: 10.2 Signal handling Up: 10 Porting Applications to Previous: 10 Porting Applications to

# 10.1 Introduction

Porting UNIX applications to the Linux operating system is remarkably easy. Linux, and the GNU C library used by it, have been designed with applications portability in mind, meaning that many applications will compile simply by issuing `make`. Those which don't generally use some obscure feature of a particular implementation, or rely strongly on undocumented or undefined behavior of, say, a particular system call.

Linux is mostly compliant with IEEE Std 1003.1-1988 (POSIX.1), but has not actually been certified as such. Similarly, Linux also implements many features found in the SVID and BSD strains of UNIX, but again does not necessarily adhere to them in all cases. In general, Linux has been designed to be compatible with other UNIX implementations, to make applications porting easier, and in a number of instances has improved upon or corrected behavior found in those implementations.

As an example, the timeout argument passed to the select system call is actually decremented during the poll operation by Linux. Other implementations don't modify this value at all, and applications which aren't expecting this could break when compiled under Linux. The BSD and SunOS man pages for select warn that in a ``future implementation'', the system call may modify the timeout pointer. Unfortunately, many applications still assume that the value will be untouched.

The goal of this paper is to provide an overview of the major issues associated with porting applications to Linux, highlighting the differences between Linux, POSIX.1, SVID, and BSD in the following areas: signal handling, terminal I/O, process control and information gathering, and portable conditional compilation.