Filename |
Sample Contents |
include/asm-alpha/errno.h include/asm-arm/errno.h include/asm-cris/errno.h include/asm-i386/errno.h include/asm-ia64/errno.h include/asm-m68k/errno.h include/asm-mips/errno.h include/asm-mips64/errno.h include/asm-parisc/errno.h include/asm-ppc/errno.h include/asm-ppc64/errno.h include/asm-s390/errno.h include/asm-s390x/errno.h include/asm-sh/errno.h include/asm-sparc/errno.h include/asm-sparc64/errno.h include/asm-x86_64/errno.h |
#define EPERM 1 /* Operation not permitted */ |
Comment
This set of files covers a wide variety of computer architectures,
encompassing platforms that run the gamut of modernity from nearly
obsolete to cutting edge. The range of cost, size, and complexity
extends from PDAs to mainframes. But the errno.h file itself is very
similar in all cases, and there's a good reason for that. Please note
that text between "/*" and the opposite "*/" is a comment by the programmer, not
something processed by the machine. What's it for?
This "header"
file defines the meaning of simple symbols for the purposes of a
computer program running on Unix or Linux. When a program
wants to return an error code because it encountered an Input/Output
error (such as when the system tries to write to the floppy disk , but
there's no disk in the drive), it will return a "EIO" error in the form
of the value 5. What's the point? For the operating system, checking to see if the error return value is "5" is simpler and faster than checking to see if it is "EIO" - but for the programmer, remembering that "EIO" is an "Error, Input/Output" is simpler and faster than looking up the associated return value. The programmer writes "EIO", the compiler substitutes "5" when it builds the program, and both parties are satisfied. There are about a hundred more lines in the file, most similar to the sample set. Why
is errno.h the same for most/all architectures?
It's because of a fairly old idea in systems programming - the idea
that a program may well outlive a particular operating system (or,
indeed, a particular hardware platform), or that a program written for
one version of UNIX may also be useful on another version of UNIX. If
the two operating systems have different definitions for the values of
error returns, the programmer has to alter the source code of the
program to make it compile and run correctly on the second operating
system. Standardization of low-level features of the operating system
makes programming more efficient by reducing busywork and rework. This applies whether the program is closed-source or open-source - in the first case, the business producing the program can more easily expand its markets or maintain its customer base as computing hardware evolves, and in the second case individual users can adapt a program from one platform to another without customizing the low-level interfaces in the code. Customers of the closed-source business also benefit because they have less chance of being "trapped" by a single hardware or operating system vendor. This cross-platform interoperability is a hallmark of what vendors sometimes refer to as "open systems". |
|
Filename | Sample Contents |
include/asm-alpha/signal.h include/asm-arm/signal.h include/asm-cris/signal.h include/asm-i386/signal.h include/asm-ia64/signal.h include/asm-m68k/signal.h include/asm-mips/signal.h include/asm-mips64/signal.h include/asm-parisc/signal.h include/asm-ppc/signal.h include/asm-ppc64/signal.h include/asm-s390/signal.h include/asm-s390x/signal.h include/asm-sh/signal.h include/asm-sparc/signal.h include/asm-sparc64/signal.h include/asm-x86_64/signal.h |
#define SIGHUP 1 struct osf_sigaction { |
Comment
A signal is a brief message sent from one program running on a system
to another program on the same system. SIGHUP, for instance, is the
human readable name for the "hangup" signal. What a particular program
does when it receives the hangup signal varies, but it would not do to
send a "kill" signal inadvertently. Say one platform defined the
"hangup" value to be 4. A program written for that platform would
transmit the value 4 when it sent a hangup signal. But if the program
were transplanted to another platform that assigned the value 4 to the
"kill" signal, the transplanted program would be transmitting the value
for a "kill" signal -- not what it meant to do. Of course, the program
could be rewritten or recompiled to use the new platform's signal
definitions, but that adds rework and the risk of typos without adding
benefits.It is most efficient for the various signals to carry the same values across systems. As with errno.h above, signal.h is very similar across the platforms listed, for the same reasons. The sample contents shows that, in addition to simple value definitions, signal.h carries a definition for a data structure called "osf_sigaction". This data structure is likewise part of cross-platform interoperability; in fact the prefix of its name refers to the "Open Software Foundation (OSF)", a group formed in the Eighties by industry members to promote cross-platform interoperability. By the way, OSF is now known as The Open Group; they are the current owners of the UNIX trademark. |
|
Filename | Sample Contents |
include/asm-alpha/ioctl.h include/asm-arm/ioctl.h include/asm-cris/ioctl.h include/asm-i386/ioctl.h include/asm-ia64/ioctl.h include/asm-m68k/ioctl.h include/asm-mips/ioctl.h include/asm-mips64/ioctl.h include/asm-parisc/ioctl.h include/asm-ppc/ioctl.h include/asm-ppc64/ioctl.h include/asm-s390/ioctl.h include/asm-s390x/ioctl.h include/asm-sh/ioctl.h include/asm-sparc/ioctl.h include/asm-sparc64/ioctl.h include/asm-x86_64/ioctl.h |
/* used to create numbers */ /* used to decode them.. */ |
Comment
Just as error return values and signal values are practically the same
across interoperable systems, the low-level definitions for reading and
writing data correspond. The author of the ioctl.h file for the
"alpha" architecture (presumably Linus Torvalds) placed a lengthy
comment near the top of the file which is worth quoting:/*The author of the code apologizes for not corresponding to an established numbering scheme, and refers to the Open Group's operating system standard, OSF/1, as a target for compatibility. |
|
Filename | Sample Contents |
include/asm-alpha/ioctls.h |
#define FIOCLEX _IO('f', 1) |
Comment
These files cover a smaller range of platforms, mostly constituting
proprietary UNIX workstation architectures from such companies as DEC,
Sun, Hewlett-Packard, SGI, and IBM. Aside from the narrower coverage,
much of the commentary above regarding the other "header" files applies
here with equal force. |
|
include/linux/stat.h |
#define _U 0x01 /* upper */ |
include/linux/ipc.h |
comp_t ac_utime; /* Accounting User Time */ |
include/asm-sparc/bsderrno.h |
#define BSD_EPERM 1 /* Operation not permitted */ |