[TOC]
Some useful commands
$ ldd /bin/ls | grep libc
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb75e6000)
$ /lib/i386-linux-gnu/libc.so.6
Setps in the execution of a system call
图片.pngRelationship between file descriptors, open file descriptions, and i-nodes
图片.pngTypical memory layout of a process on Linux/x86-32
图片.pngOverview of virtual memory
图片.pngHeap containing allocated blocks and a free list
图片.pngSelected files in each /proc/PID directory
图片.pngSummary of I/O buffering
图片.pngStructure of the file blocks for a file in an ext2 file system
图片.pngI-node flags
图片.pngFrom the shell, i-node flags can be set and viewed using the chattr and lsattr commands.
ACL (Access Control List)
An ACL is a series of ACL entries, each of which defines the file permissions for an individual user or group of users:
图片.pngRelationship between i-node and directory structures
图片.pngRepresentation of hard and symbolic links
图片.pngLinux signals
图片.pngSignal delivery and handler execution
图片.pngRun for a few seconds elapsed time
for (startTime = time(NULL); time(NULL) < startTime + 4; )
continue; /* Run for a few seconds elapsed time */
Overview of the use of fork(), exit(), wait() and execve()
图片.pngValue returned in the status argument of wait() and waitpid()
图片.pngvoid handler(int sig)
{
/* Perform cleanup steps */
signal(sig, SIG_DFL); /* Disestablish handler */
raise(sig); /* Raise signal again */
}
The argument list supplied to an execed script
图片.pngexecution of system("sleep 20")
图片.pngAs an efficiency measure, when the string given to the -c option is a simple command (as opposed to a pipeline or a sequence), some shells (including bash) directly exec the command, rather than forking a child shell. For shells that perform such an optimization, Figure 27-2 is not strictly accurate, since there will be only two processes (the calling process and sleep).
Four threads executing in a process (Linux/x86-32)
图片.pngWe have simplified things somewhat in Figure 29-1. In particular, the location of the per-thread stacks may be intermingled with shared libraries and shared memory regions, depending on the order in which threads are created, shared libraries loaded, and shared memory regions attached. Further more, the location of the per-thread stacks can vary depending on the Linux distribution.
/* When using threads, errno is a per-thread value. */
#define errno (*__errno_location ())
Each reference to errno in a threaded program carries the overhead of a function call.
Thread-specific data (TSD) provides per-thread storage for a function
图片.pngRelationships between process groups, sessions, and the controlling terminal
图片.pngJob-control states
图片.pngResources values for getrlimit() and setrlimit()
图片.pngOverview of system logging
图片.pngCreating a shared library and linking a program against it
图片.pngExecution of a program that loads a shared library
图片.pngreal name, soname, linker name
图片.pngFinding Shared Libraries at Run Time
图片.pngA taxonomy of UNIX facilities
图片.pngIdentifiers and handles for various types of IPC facilities
图片.pngSetting up a pipe to transfer data from parent to a child
图片.pngpopen()
图片.pngUsing a FIFO and tee(1) to create a dual pipeline
$ mkfifo myfifo
$ wc -l < myfifo &
$ ls -l | tee myfifo | sort -k5n
图片.png
Separating messages in a byte stream
图片.pngOverview of memory-mapped file
图片.pngTwo processes with a shared mapping of the same region of a file
图片.pngWe simplify things in this diagram by omitting to show that the mapped pages are typically not contiguous in physical memory.
Memory mapping whose length is not a multiple of the system page size
图片.pngMemory mapping extending beyond end of mapped file
图片.pngSummary of programming interfaces for POSIX IPC objects
图片.pngSocket domains
图片.pngSocket types and their properties
图片.pngOverview of system calls used with stream sockets
图片.pngA pending socket connection
图片.pngOverview of system calls used with datagram sockets
图片.pngGeneric address structure, struct sockaddr
struct sockaddr {
sa_family_t sa_family;
char sa_data[14];
}
/* UNIX domain */
#define UNIX_PATH_MAX 108
struct sockaddr_un {
sa_family_t sun_family; /* AF_UNIX */
char sun_path[UNIX_PATH_MAX]; /* pathname */
};
/* IPv4 domain */
struct sockaddr_in {
sa_family_t sin_family; /* address family: AF_INET */
in_port_t sin_port; /* port in network byte order */
struct in_addr sin_addr; /* internet address */
/* pad to size of 'struct sockaddr' */
unsigned char __pad[sizeof (struct sockaddr) -
sizeof (sa_family_t) -
sizeof (in_port_t) -
sizeof(struct in_addr)];
};
/* Internet address. */
struct in_addr {
uint32_t s_addr; /* address in network byte order */
};
/* IPv6 domain */
struct sockaddr_in6 {
sa_family_t sin6_family; /* AF_INET6 */
in_port_t sin6_port; /* port number */
uint32_t sin6_flowinfo; /* IPv6 flow information */
struct in6_addr sin6_addr; /* IPv6 address */
uint32_t sin6_scope_id; /* Scope ID (new in 2.4) */
};
/* IPv6 address */
struct in6_addr
{
union
{
uint8_t __u6_addr8[16];
#ifdef __USE_MISC
uint16_t __u6_addr16[8];
uint32_t __u6_addr32[4];
#endif
} __in6_u;
#define s6_addr __in6_u.__u6_addr8
#ifdef __USE_MISC
# define s6_addr16 __in6_u.__u6_addr16
# define s6_addr32 __in6_u.__u6_addr32
#endif
};
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
TCP/IP protocol layers
图片.pngFormat of an IPv4-mapped IPv6 address
图片.pngConnected TCP sockets
图片.pngTransferring the contents of a file to a socket
图片.pngFormat of a TCP segment
图片.pngTCP state transition diagram
图片.pngThree-way handshake for TCP connection establishment
图片.pngThye connection termination
图片.pngInput and output queues for a terminal device
图片.pngTerminal Special characters
图片.pngselect() and poll indication for sockets
图片.pngTimes taken by poll(), select() and epoll for 100,000 monitoring operations
图片.pngTwo programs communicating via a pseudoterminal
图片.pngHow ssh uses a pseudoterminal
图片.pngFigure 64-3 shows a specific example: the use of pseudoterminal by ssh, an application that allows a user to securely run a login session on a remote system connected via a network. On the remote host, the driver program for the pseudoterminal master is the ssh server (sshd), and the terminal-oriented program connected to the pseudoterminal slave is the login shell. The ssh server is the glue that connects the pseudoterminal via a socket to the ssh client. Once all of the details of logging in have been completed, the primary purpose of the ssh server and client is to relay characters in either direction between the user's terminal on the local host and the shell on the remote host.
图片.png
网友评论