-->

Previous | Table of Contents | Next

Page 1174

There is also a variant on the format, available by setting the RAWBITS option at compile time. This variant is different in the following ways:

The "magic number" is P6 instead of P3.

The pixel values are stored as plain bytes, instead of ASCII decimal.

Whitespace is not allowed in the pixels area, and only a single character of whitespace (typically a newline) is allowed after the maxval.

The files are smaller and many times faster to read and write.

Note that this raw format can only be used for maxvals less than or equal to 255. If you use the ppm library and try to write a file with a larger maxval, it will automatically fall back on the slower but more general plain format.

SEE ALSO


giftoppm(1), gouldtoppm(1), ilbmtoppm(1), imgtoppm(1), mtvtoppm(1), pcxtoppm(1), pgmtoppm(1), pi1toppm(1), picttoppm(1),

pjtoppm(1), qrttoppm(1), rawtoppm(1), rgb3toppm(1), sldtoppm(1), spctoppm(1), sputoppm(1), tgatoppm(1), ximtoppm(1),

xpmtoppm(1), yuvtoppm(1), ppmtoacad(1), ppmtogif(1), ppmtoicr(1), ppmtoilbm(1), ppmtopcx(1), ppmtopgm(1), ppmtopi1(1),

ppmtopict(1), ppmtopj(1), ppmtopuzz(1), ppmtorgb3(1), ppmtosixel(1), ppmtotga(1), ppmtouil(1), ppmtoxpm(1), ppmtoyuv(1),

ppmdither(1), ppmforge(1), ppmhist(1), ppmmake(1), ppmpat(1), ppmquant(1), ppmquantall(1), ppmrelief(1), pnm(5), pgm(5), pbm(5)

AUTHOR

Copyright 1989, 1991 by Jef Poskanzer.

27 September 1991

/proc

/proc—Process information pseudo-filesystem.

DESCRIPTION

/proc is a pseudo-filesystem that is used as an interface to kernel data structures rather than reading and interpreting /dev/kmem. Most of it is read-only, but some files allow kernel variables to be changed.

The following outline gives a quick tour through the /proc hierarchy.

[number] There is a numerical subdirectory for each running process; the subdirectory is named by the process ID. Each contains the following pseudo-files and directories.
cmdline This holds the complete command line for the process, unless the whole process has been swapped out or unless the process is a zombie. In either of these later cases, there is nothing in this file: That is, a read on this file will return as having read 0 characters. This file is null-terminated but not newline-terminated.
cwd This is a link current working directory of the process. To find out the cwd of process 20, for instance, you can do this: cd /proc/20/cwd; /bin/pwd. Note that the pwd command is often a shell built in and might not work properly in this context.
environ This file contains the environment for the process. The entries are separated by null characters, and there may be a null character at the end. Thus, to print out the environment of process 1, you would do

(cat /proc/1/environ; echo) | tr "\000" "\n"

For a reason why one should want to do this, see lilo(8).
exe A pointer to the binary that was executed and appears as a symbolic link. readlink(2) on the exe special file returns a string in the format:

[device]:inode

For example, [0301]:1502 is inode 1502 on device major 03 (IDE, MFM, and so on drives), minor

Page 1175

01 (first partition on the first drive). Also, the symbolic link can be dereferenced normally; attempting to open exe will open the executable. You can even type /proc/[number]/exe to run another copy of the same process as [number].
find(1) with the -inum option can be used to locate the file.
fd This is a subdirectory containing one entry for each file that the process has open, named by its file descriptor, and that is a symbolic link to the actual file (as the exe entry does). Thus, 0 is standard input, 1 standard output, 2 standard error, and so on.
Programs that will take a filename but will not take the standard input and that write to a file but will not send their output to standard output can be effectively foiled this way, assuming that -i is the flag designating an input file and -o is the flag designating an output file:

foobar -i /proc/self/fd/0 -o /proc/self/fd/1 ...

and you have a working filter. Note that this will not work for programs that seek on their files because the files in the fd directory are not seekable.
/proc/self/fd/N is approximately the same as /dev/fd/N in some UNIX and UNIX-like systems. Most Linux MAKEDEV scripts symbolically link /dev/fd to /proc/self/fd, in fact.
maps A file containing the currently mapped memory regions and their access permissions. The format is

address                 perms     offset     dev     inode

00000000-0002f000       r-x_      00000400   03:03     1401

0002f000-00032000       rwx-p     0002f400   03:03     1401

00032000-0005b000       rwx-p     00000000   00:00     0

60000000-60098000       rwx-p     00000400   03:03     215

60098000-600c7000       rwx-p     00000000   00:00     0

bfffa000-c0000000       rwx-p     00000000   00:00     0

address is the address space in the process that it occupies. perms is a set of permissions: r = read, w = write, x = execute, s = shared, p = private (copy on write).
offset is the offset into the file/whatever, dev is the device (major: minor), and inode is the inode on that device. 0 indicates that no inode is associated with the memory region, as the case would be with bss.
mem This is not the same as the mem (1,1) device, despite the fact that it has the same device numbers. The /dev/mem device is the physical memory before any address translation is done, but the mem file here is the memory of the process that accesses it. This cannot be mmap(2)ed currently, and will not be until a general mmap(2) is added to the kernel. (This might have happened by the time you read this.)
mmap Directory of maps by mmap(2) that are symbolic links such as exe, fd/*, and so on. Note that maps includes a superset of this information, so /proc/*/mmap should be considered obsolete. 0 is usually libc.so.4.
/proc/*/mmap was removed in Linux kernel version 1.1.40. (It really was obsolete!)
root UNIX and Linux support the idea of a per-process root of the filesystem, set by the chroot(2) system call. root points to the filesystem root and behaves as exe, fd/*, and so on do.
stat Status information about the process. This is used by ps(1). The fields, in order, with their proper scanf(3) format specifiers, are

pid %d     The process ID.

comm %s     The filename of the executable in parentheses. This is visible whether or

            not the executable is swapped out.

Previous | Table of Contents | Next