mirror of https://github.com/mkerrisk/man-pages
pldd.1, bpf.2, clone.2, dup.2, ioctl_fat.2, nfsservctl.2, open_by_handle_at.2, perf_event_open.2, pivot_root.2, request_key.2, sched_setaffinity.2, seccomp.2, select.2, statx.2, dl_iterate_phdr.3, dlinfo.3, dlopen.3, insque.3, newlocale.3, printf.3, pthread_setname_np.3, rpc.3, stdarg.3, strfmon.3, veth.4, proc.5, slabinfo.5, cgroup_namespaces.7, cgroups.7, cpuset.7, fanotify.7, inotify.7, mount_namespaces.7, sock_diag.7, user_namespaces.7, ld.so.8: Use \(aq instead of ' inside monospace fonts
Use \(aq to get an unslanted single quote inside monospace code blocks. Using a simple ' results in a slanted quote inside PDFs. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
89de1a399e
commit
861d36ba31
|
@ -93,7 +93,7 @@ using a command such as the following
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
$ \fBgdb \-ex "set confirm off" \-ex "set height 0" \-ex "info shared" \e\fP
|
$ \fBgdb \-ex "set confirm off" \-ex "set height 0" \-ex "info shared" \e\fP
|
||||||
\fB\-ex "quit" \-p $pid | grep '\(ha0x.*0x'\fP
|
\fB\-ex "quit" \-p $pid | grep \(aq\(ha0x.*0x\(aq\fP
|
||||||
.EE
|
.EE
|
||||||
.in
|
.in
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
|
|
|
@ -209,11 +209,11 @@ union bpf_attr {
|
||||||
struct { /* Used by BPF_PROG_LOAD */
|
struct { /* Used by BPF_PROG_LOAD */
|
||||||
__u32 prog_type;
|
__u32 prog_type;
|
||||||
__u32 insn_cnt;
|
__u32 insn_cnt;
|
||||||
__aligned_u64 insns; /* 'const struct bpf_insn *' */
|
__aligned_u64 insns; /* \(aqconst struct bpf_insn *\(aq */
|
||||||
__aligned_u64 license; /* 'const char *' */
|
__aligned_u64 license; /* \(aqconst char *\(aq */
|
||||||
__u32 log_level; /* verbosity level of verifier */
|
__u32 log_level; /* verbosity level of verifier */
|
||||||
__u32 log_size; /* size of user buffer */
|
__u32 log_size; /* size of user buffer */
|
||||||
__aligned_u64 log_buf; /* user supplied 'char *'
|
__aligned_u64 log_buf; /* user supplied \(aqchar *\(aq
|
||||||
buffer */
|
buffer */
|
||||||
__u32 kern_version;
|
__u32 kern_version;
|
||||||
/* checked when prog_type=kprobe
|
/* checked when prog_type=kprobe
|
||||||
|
@ -990,7 +990,7 @@ main(int argc, char **argv)
|
||||||
map_fd = bpf_create_map(BPF_MAP_TYPE_ARRAY, sizeof(key),
|
map_fd = bpf_create_map(BPF_MAP_TYPE_ARRAY, sizeof(key),
|
||||||
sizeof(value), 256);
|
sizeof(value), 256);
|
||||||
if (map_fd < 0) {
|
if (map_fd < 0) {
|
||||||
printf("failed to create map '%s'\en", strerror(errno));
|
printf("failed to create map \(aq%s\(aq\en", strerror(errno));
|
||||||
/* likely not run as root */
|
/* likely not run as root */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,9 +185,9 @@ struct clone_args {
|
||||||
u64 pidfd; /* Where to store PID file descriptor
|
u64 pidfd; /* Where to store PID file descriptor
|
||||||
(\fIpid_t *\fP) */
|
(\fIpid_t *\fP) */
|
||||||
u64 child_tid; /* Where to store child TID,
|
u64 child_tid; /* Where to store child TID,
|
||||||
in child's memory (\fIpid_t *\fP) */
|
in child\(aqs memory (\fIpid_t *\fP) */
|
||||||
u64 parent_tid; /* Where to store child TID,
|
u64 parent_tid; /* Where to store child TID,
|
||||||
in parent's memory (\fIint *\fP) */
|
in parent\(aqs memory (\fIint *\fP) */
|
||||||
u64 exit_signal; /* Signal to deliver to parent on
|
u64 exit_signal; /* Signal to deliver to parent on
|
||||||
child termination */
|
child termination */
|
||||||
u64 stack; /* Pointer to lowest byte of stack */
|
u64 stack; /* Pointer to lowest byte of stack */
|
||||||
|
|
|
@ -249,23 +249,23 @@ Instead, code something like the following could be used:
|
||||||
.PP
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
/* Obtain a duplicate of 'newfd' that can subsequently
|
/* Obtain a duplicate of \(aqnewfd\(aq that can subsequently
|
||||||
be used to check for close() errors; an EBADF error
|
be used to check for close() errors; an EBADF error
|
||||||
means that 'newfd' was not open. */
|
means that \(aqnewfd\(aq was not open. */
|
||||||
|
|
||||||
tmpfd = dup(newfd);
|
tmpfd = dup(newfd);
|
||||||
if (tmpfd == \-1 && errno != EBADF) {
|
if (tmpfd == \-1 && errno != EBADF) {
|
||||||
/* Handle unexpected dup() error */
|
/* Handle unexpected dup() error */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Atomically duplicate 'oldfd' on 'newfd' */
|
/* Atomically duplicate \(aqoldfd\(aq on \(aqnewfd\(aq */
|
||||||
|
|
||||||
if (dup2(oldfd, newfd) == \-1) {
|
if (dup2(oldfd, newfd) == \-1) {
|
||||||
/* Handle dup2() error */
|
/* Handle dup2() error */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now check for close() errors on the file originally
|
/* Now check for close() errors on the file originally
|
||||||
referred to by 'newfd' */
|
referred to by \(aqnewfd\(aq */
|
||||||
|
|
||||||
if (tmpfd != \-1) {
|
if (tmpfd != \-1) {
|
||||||
if (close(tmpfd) == \-1) {
|
if (close(tmpfd) == \-1) {
|
||||||
|
|
|
@ -422,11 +422,11 @@ The following was recorded when applying the program to the directory
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
$ \fB./fat_dir /mnt/user\fP
|
$ \fB./fat_dir /mnt/user\fP
|
||||||
\[char46] -> ''
|
\[char46] -> \(aq\(aq
|
||||||
\[char46]. -> ''
|
\[char46]. -> \(aq\(aq
|
||||||
ALONGF\(ti1.TXT -> 'a long filename.txt'
|
ALONGF\(ti1.TXT -> \(aqa long filename.txt\(aq
|
||||||
UPPER.TXT -> ''
|
UPPER.TXT -> \(aq\(aq
|
||||||
LOWER.TXT -> 'lower.txt'
|
LOWER.TXT -> \(aqlower.txt\(aq
|
||||||
.EE
|
.EE
|
||||||
.in
|
.in
|
||||||
.\"
|
.\"
|
||||||
|
@ -481,7 +481,7 @@ main(int argc, char *argv[])
|
||||||
/*
|
/*
|
||||||
* Write both the short name and the long name.
|
* Write both the short name and the long name.
|
||||||
*/
|
*/
|
||||||
printf("%s \-> '%s'\en", entry[0].d_name, entry[1].d_name);
|
printf("%s \-> \(aq%s\(aq\en", entry[0].d_name, entry[1].d_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == \-1) {
|
if (ret == \-1) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ filesystem; see
|
||||||
#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */
|
#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */
|
||||||
#define NFSCTL_EXPORT 3 /* Export a filesystem. */
|
#define NFSCTL_EXPORT 3 /* Export a filesystem. */
|
||||||
#define NFSCTL_UNEXPORT 4 /* Unexport a filesystem. */
|
#define NFSCTL_UNEXPORT 4 /* Unexport a filesystem. */
|
||||||
#define NFSCTL_UGIDUPDATE 5 /* Update a client's UID/GID map
|
#define NFSCTL_UGIDUPDATE 5 /* Update a client\(aqs UID/GID map
|
||||||
(only in Linux 2.4.x and earlier). */
|
(only in Linux 2.4.x and earlier). */
|
||||||
#define NFSCTL_GETFH 6 /* Get a file handle (used by mountd)
|
#define NFSCTL_GETFH 6 /* Get a file handle (used by mountd)
|
||||||
(only in Linux 2.4.x and earlier). */
|
(only in Linux 2.4.x and earlier). */
|
||||||
|
|
|
@ -504,7 +504,7 @@ The following shell session demonstrates the use of these two programs:
|
||||||
.PP
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
$ \fBecho 'Can you please think about it?' > cecilia.txt\fP
|
$ \fBecho \(aqCan you please think about it?\(aq > cecilia.txt\fP
|
||||||
$ \fB./t_name_to_handle_at cecilia.txt > fh\fP
|
$ \fB./t_name_to_handle_at cecilia.txt > fh\fP
|
||||||
$ \fB./t_open_by_handle_at < fh\fP
|
$ \fB./t_open_by_handle_at < fh\fP
|
||||||
open_by_handle_at: Operation not permitted
|
open_by_handle_at: Operation not permitted
|
||||||
|
@ -528,7 +528,7 @@ no longer exists.
|
||||||
$ \fBstat \-\-printf="%i\en" cecilia.txt\fP # Display inode number
|
$ \fBstat \-\-printf="%i\en" cecilia.txt\fP # Display inode number
|
||||||
4072121
|
4072121
|
||||||
$ \fBrm cecilia.txt\fP
|
$ \fBrm cecilia.txt\fP
|
||||||
$ \fBecho 'Can you please think about it?' > cecilia.txt\fP
|
$ \fBecho \(aqCan you please think about it?\(aq > cecilia.txt\fP
|
||||||
$ \fBstat \-\-printf="%i\en" cecilia.txt\fP # Check inode number
|
$ \fBstat \-\-printf="%i\en" cecilia.txt\fP # Check inode number
|
||||||
4072121
|
4072121
|
||||||
$ \fBsudo ./t_open_by_handle_at < fh\fP
|
$ \fBsudo ./t_open_by_handle_at < fh\fP
|
||||||
|
|
|
@ -218,10 +218,10 @@ struct perf_event_attr {
|
||||||
inherit : 1, /* children inherit it */
|
inherit : 1, /* children inherit it */
|
||||||
pinned : 1, /* must always be on PMU */
|
pinned : 1, /* must always be on PMU */
|
||||||
exclusive : 1, /* only group on PMU */
|
exclusive : 1, /* only group on PMU */
|
||||||
exclude_user : 1, /* don't count user */
|
exclude_user : 1, /* don\(aqt count user */
|
||||||
exclude_kernel : 1, /* don't count kernel */
|
exclude_kernel : 1, /* don\(aqt count kernel */
|
||||||
exclude_hv : 1, /* don't count hypervisor */
|
exclude_hv : 1, /* don\(aqt count hypervisor */
|
||||||
exclude_idle : 1, /* don't count when idle */
|
exclude_idle : 1, /* don\(aqt count when idle */
|
||||||
mmap : 1, /* include mmap data */
|
mmap : 1, /* include mmap data */
|
||||||
comm : 1, /* include comm data */
|
comm : 1, /* include comm data */
|
||||||
freq : 1, /* use freq, not period */
|
freq : 1, /* use freq, not period */
|
||||||
|
@ -232,8 +232,8 @@ struct perf_event_attr {
|
||||||
precise_ip : 2, /* skid constraint */
|
precise_ip : 2, /* skid constraint */
|
||||||
mmap_data : 1, /* non-exec mmap data */
|
mmap_data : 1, /* non-exec mmap data */
|
||||||
sample_id_all : 1, /* sample_type all events */
|
sample_id_all : 1, /* sample_type all events */
|
||||||
exclude_host : 1, /* don't count in host */
|
exclude_host : 1, /* don\(aqt count in host */
|
||||||
exclude_guest : 1, /* don't count in guest */
|
exclude_guest : 1, /* don\(aqt count in guest */
|
||||||
exclude_callchain_kernel : 1,
|
exclude_callchain_kernel : 1,
|
||||||
/* exclude kernel callchains */
|
/* exclude kernel callchains */
|
||||||
exclude_callchain_user : 1,
|
exclude_callchain_user : 1,
|
||||||
|
|
|
@ -294,7 +294,7 @@ $ \fBmkdir /tmp/rootfs\fP
|
||||||
$ \fBls \-id /tmp/rootfs\fP # Show inode number of new root directory
|
$ \fBls \-id /tmp/rootfs\fP # Show inode number of new root directory
|
||||||
319459 /tmp/rootfs
|
319459 /tmp/rootfs
|
||||||
$ \fBcp $(which busybox) /tmp/rootfs\fP
|
$ \fBcp $(which busybox) /tmp/rootfs\fP
|
||||||
$ \fBPS1='bbsh$ ' sudo ./pivot_root_demo /tmp/rootfs /busybox sh\fP
|
$ \fBPS1=\(aqbbsh$ \(aq sudo ./pivot_root_demo /tmp/rootfs /busybox sh\fP
|
||||||
bbsh$ \fBPATH=/\fP
|
bbsh$ \fBPATH=/\fP
|
||||||
bbsh$ \fBbusybox ln busybox ln\fP
|
bbsh$ \fBbusybox ln busybox ln\fP
|
||||||
bbsh$ \fBln busybox echo\fP
|
bbsh$ \fBln busybox echo\fP
|
||||||
|
|
|
@ -463,7 +463,7 @@ we first create a suitable entry in the file
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
$ sudo sh
|
$ sudo sh
|
||||||
# \fBecho 'create user mtk:* * /bin/keyctl instantiate %k %c %S' \e\fP
|
# \fBecho \(aqcreate user mtk:* * /bin/keyctl instantiate %k %c %S\(aq \e\fP
|
||||||
\fB> /etc/request\-key.conf\fP
|
\fB> /etc/request\-key.conf\fP
|
||||||
# \fBexit\fP
|
# \fBexit\fP
|
||||||
.EE
|
.EE
|
||||||
|
|
|
@ -324,7 +324,7 @@ system has two cores, each with two CPUs:
|
||||||
.PP
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
$ \fBlscpu | egrep \-i 'core.*:|socket'\fP
|
$ \fBlscpu | egrep \-i \(aqcore.*:|socket\(aq\fP
|
||||||
Thread(s) per core: 2
|
Thread(s) per core: 2
|
||||||
Core(s) per socket: 2
|
Core(s) per socket: 2
|
||||||
Socket(s): 1
|
Socket(s): 1
|
||||||
|
|
|
@ -975,7 +975,7 @@ $ \fBuname \-m\fP
|
||||||
x86_64
|
x86_64
|
||||||
$ \fBsyscall_nr() {
|
$ \fBsyscall_nr() {
|
||||||
cat /usr/src/linux/arch/x86/syscalls/syscall_64.tbl | \e
|
cat /usr/src/linux/arch/x86/syscalls/syscall_64.tbl | \e
|
||||||
awk '$2 != "x32" && $3 == "'$1'" { print $1 }'
|
awk \(aq$2 != "x32" && $3 == "\(aq$1\(aq" { print $1 }\(aq
|
||||||
}\fP
|
}\fP
|
||||||
.EE
|
.EE
|
||||||
.in
|
.in
|
||||||
|
@ -1059,21 +1059,21 @@ install_filter(int syscall_nr, int t_arch, int f_errno)
|
||||||
|
|
||||||
/* Assume that AUDIT_ARCH_X86_64 means the normal x86-64 ABI
|
/* Assume that AUDIT_ARCH_X86_64 means the normal x86-64 ABI
|
||||||
(in the x32 ABI, all system calls have bit 30 set in the
|
(in the x32 ABI, all system calls have bit 30 set in the
|
||||||
'nr' field, meaning the numbers are >= X32_SYSCALL_BIT) */
|
\(aqnr\(aq field, meaning the numbers are >= X32_SYSCALL_BIT) */
|
||||||
if (t_arch == AUDIT_ARCH_X86_64)
|
if (t_arch == AUDIT_ARCH_X86_64)
|
||||||
upper_nr_limit = X32_SYSCALL_BIT - 1;
|
upper_nr_limit = X32_SYSCALL_BIT - 1;
|
||||||
|
|
||||||
struct sock_filter filter[] = {
|
struct sock_filter filter[] = {
|
||||||
/* [0] Load architecture from 'seccomp_data' buffer into
|
/* [0] Load architecture from \(aqseccomp_data\(aq buffer into
|
||||||
accumulator */
|
accumulator */
|
||||||
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
|
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
|
||||||
(offsetof(struct seccomp_data, arch))),
|
(offsetof(struct seccomp_data, arch))),
|
||||||
|
|
||||||
/* [1] Jump forward 5 instructions if architecture does not
|
/* [1] Jump forward 5 instructions if architecture does not
|
||||||
match 't_arch' */
|
match \(aqt_arch\(aq */
|
||||||
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, t_arch, 0, 5),
|
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, t_arch, 0, 5),
|
||||||
|
|
||||||
/* [2] Load system call number from 'seccomp_data' buffer into
|
/* [2] Load system call number from \(aqseccomp_data\(aq buffer into
|
||||||
accumulator */
|
accumulator */
|
||||||
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
|
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
|
||||||
(offsetof(struct seccomp_data, nr))),
|
(offsetof(struct seccomp_data, nr))),
|
||||||
|
@ -1084,11 +1084,11 @@ install_filter(int syscall_nr, int t_arch, int f_errno)
|
||||||
BPF_JUMP(BPF_JMP | BPF_JGT | BPF_K, upper_nr_limit, 3, 0),
|
BPF_JUMP(BPF_JMP | BPF_JGT | BPF_K, upper_nr_limit, 3, 0),
|
||||||
|
|
||||||
/* [4] Jump forward 1 instruction if system call number
|
/* [4] Jump forward 1 instruction if system call number
|
||||||
does not match 'syscall_nr' */
|
does not match \(aqsyscall_nr\(aq */
|
||||||
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, syscall_nr, 0, 1),
|
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, syscall_nr, 0, 1),
|
||||||
|
|
||||||
/* [5] Matching architecture and system call: don't execute
|
/* [5] Matching architecture and system call: don\(aqt execute
|
||||||
the system call, and return 'f_errno' in 'errno' */
|
the system call, and return \(aqf_errno\(aq in \(aqerrno\(aq */
|
||||||
BPF_STMT(BPF_RET | BPF_K,
|
BPF_STMT(BPF_RET | BPF_K,
|
||||||
SECCOMP_RET_ERRNO | (f_errno & SECCOMP_RET_DATA)),
|
SECCOMP_RET_ERRNO | (f_errno & SECCOMP_RET_DATA)),
|
||||||
|
|
||||||
|
|
|
@ -604,7 +604,7 @@ pointer, but is instead a structure of the form:
|
||||||
struct {
|
struct {
|
||||||
const kernel_sigset_t *ss; /* Pointer to signal set */
|
const kernel_sigset_t *ss; /* Pointer to signal set */
|
||||||
size_t ss_len; /* Size (in bytes) of object
|
size_t ss_len; /* Size (in bytes) of object
|
||||||
pointed to by 'ss' */
|
pointed to by \(aqss\(aq */
|
||||||
};
|
};
|
||||||
.EE
|
.EE
|
||||||
.in
|
.in
|
||||||
|
@ -730,7 +730,7 @@ main(void)
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
|
|
||||||
retval = select(1, &rfds, NULL, NULL, &tv);
|
retval = select(1, &rfds, NULL, NULL, &tv);
|
||||||
/* Don't rely on the value of tv now! */
|
/* Don\(aqt rely on the value of tv now! */
|
||||||
|
|
||||||
if (retval == \-1)
|
if (retval == \-1)
|
||||||
perror("select()");
|
perror("select()");
|
||||||
|
|
|
@ -61,7 +61,7 @@ struct statx {
|
||||||
__u64 stx_size; /* Total size in bytes */
|
__u64 stx_size; /* Total size in bytes */
|
||||||
__u64 stx_blocks; /* Number of 512B blocks allocated */
|
__u64 stx_blocks; /* Number of 512B blocks allocated */
|
||||||
__u64 stx_attributes_mask;
|
__u64 stx_attributes_mask;
|
||||||
/* Mask to show what's supported
|
/* Mask to show what\(aqs supported
|
||||||
in stx_attributes */
|
in stx_attributes */
|
||||||
|
|
||||||
/* The following fields are file timestamps */
|
/* The following fields are file timestamps */
|
||||||
|
|
|
@ -99,8 +99,8 @@ struct dl_phdr_info {
|
||||||
/* If there is a PT_TLS segment, its module
|
/* If there is a PT_TLS segment, its module
|
||||||
ID as used in TLS relocations, else zero */
|
ID as used in TLS relocations, else zero */
|
||||||
void *dlpi_tls_data;
|
void *dlpi_tls_data;
|
||||||
/* The address of the calling thread's instance
|
/* The address of the calling thread\(aqs instance
|
||||||
of this module's PT_TLS segment, if it has
|
of this module\(aqs PT_TLS segment, if it has
|
||||||
one and it has been allocated in the calling
|
one and it has been allocated in the calling
|
||||||
thread, otherwise a null pointer */
|
thread, otherwise a null pointer */
|
||||||
};
|
};
|
||||||
|
|
|
@ -159,9 +159,9 @@ typedef struct {
|
||||||
size_t dls_size; /* Size in bytes of
|
size_t dls_size; /* Size in bytes of
|
||||||
the whole buffer */
|
the whole buffer */
|
||||||
unsigned int dls_cnt; /* Number of elements
|
unsigned int dls_cnt; /* Number of elements
|
||||||
in 'dls_serpath' */
|
in \(aqdls_serpath\(aq */
|
||||||
Dl_serpath dls_serpath[1]; /* Actually longer,
|
Dl_serpath dls_serpath[1]; /* Actually longer,
|
||||||
'dls_cnt' elements */
|
\(aqdls_cnt\(aq elements */
|
||||||
} Dl_serinfo;
|
} Dl_serinfo;
|
||||||
.EE
|
.EE
|
||||||
.in
|
.in
|
||||||
|
|
|
@ -587,7 +587,7 @@ main(void)
|
||||||
cosine = (double (*)(double)) dlsym(handle, "cos");
|
cosine = (double (*)(double)) dlsym(handle, "cos");
|
||||||
|
|
||||||
/* According to the ISO C standard, casting between function
|
/* According to the ISO C standard, casting between function
|
||||||
pointers and 'void *', as done above, produces undefined results.
|
pointers and \(aqvoid *\(aq, as done above, produces undefined results.
|
||||||
POSIX.1-2001 and POSIX.1-2008 accepted this state of affairs and
|
POSIX.1-2001 and POSIX.1-2008 accepted this state of affairs and
|
||||||
proposed the following workaround:
|
proposed the following workaround:
|
||||||
|
|
||||||
|
@ -598,8 +598,8 @@ main(void)
|
||||||
|
|
||||||
The 2013 Technical Corrigendum 1 to POSIX.1-2008 improved matters
|
The 2013 Technical Corrigendum 1 to POSIX.1-2008 improved matters
|
||||||
by requiring that conforming implementations support casting
|
by requiring that conforming implementations support casting
|
||||||
'void *' to a function pointer. Nevertheless, some compilers
|
\(aqvoid *\(aq to a function pointer. Nevertheless, some compilers
|
||||||
(e.g., gcc with the '\-pedantic' option) may complain about the
|
(e.g., gcc with the \(aq\-pedantic\(aq option) may complain about the
|
||||||
cast used in this program. */
|
cast used in this program. */
|
||||||
.\" http://pubs.opengroup.org/onlinepubs/009695399/functions/dlsym.html#tag_03_112_08
|
.\" http://pubs.opengroup.org/onlinepubs/009695399/functions/dlsym.html#tag_03_112_08
|
||||||
.\" http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html#tag_16_96_07
|
.\" http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html#tag_16_96_07
|
||||||
|
|
|
@ -202,7 +202,7 @@ main(int argc, char *argv[])
|
||||||
circular = 0;
|
circular = 0;
|
||||||
while ((opt = getopt(argc, argv, "c")) != \-1) {
|
while ((opt = getopt(argc, argv, "c")) != \-1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'c':
|
case \(aqc\(aq:
|
||||||
circular = 1;
|
circular = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -332,8 +332,8 @@ main(int argc, char *argv[])
|
||||||
/* If a second command\-line argument was specified, modify the
|
/* If a second command\-line argument was specified, modify the
|
||||||
locale object to take the LC_TIME settings from the locale
|
locale object to take the LC_TIME settings from the locale
|
||||||
specified in argv[2]. We assign the result of this newlocale()
|
specified in argv[2]. We assign the result of this newlocale()
|
||||||
call to 'nloc' rather than 'loc', since in some cases, we might
|
call to \(aqnloc\(aq rather than \(aqloc\(aq, since in some cases, we might
|
||||||
want to preserve 'loc' if this call fails. */
|
want to preserve \(aqloc\(aq if this call fails. */
|
||||||
|
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
nloc = newlocale(LC_TIME_MASK, argv[2], loc);
|
nloc = newlocale(LC_TIME_MASK, argv[2], loc);
|
||||||
|
@ -365,7 +365,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
/* Free the locale object */
|
/* Free the locale object */
|
||||||
|
|
||||||
uselocale(LC_GLOBAL_HANDLE); /* So 'loc' is no longer in use */
|
uselocale(LC_GLOBAL_HANDLE); /* So \(aqloc\(aq is no longer in use */
|
||||||
freelocale(loc);
|
freelocale(loc);
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
|
@ -1148,7 +1148,7 @@ make_message(const char *fmt, ...)
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* One extra byte for '\e0' */
|
/* One extra byte for \(aq\e0\(aq */
|
||||||
|
|
||||||
size = (size_t) n + 1;
|
size = (size_t) n + 1;
|
||||||
p = malloc(size);
|
p = malloc(size);
|
||||||
|
|
|
@ -141,7 +141,7 @@ Created a thread. Default name is: a.out
|
||||||
The thread name after setting it is THREADFOO.
|
The thread name after setting it is THREADFOO.
|
||||||
\fB\(haZ\fP # Suspend the program
|
\fB\(haZ\fP # Suspend the program
|
||||||
[1]+ Stopped ./a.out
|
[1]+ Stopped ./a.out
|
||||||
.RB "$ " "ps H \-C a.out \-o 'pid tid cmd comm'"
|
.RB "$ " "ps H \-C a.out \-o \(aqpid tid cmd comm\(aq"
|
||||||
PID TID CMD COMMAND
|
PID TID CMD COMMAND
|
||||||
5990 5990 ./a.out a.out
|
5990 5990 ./a.out a.out
|
||||||
5990 5991 ./a.out THREADFOO
|
5990 5991 ./a.out THREADFOO
|
||||||
|
|
|
@ -264,7 +264,7 @@ will be ignored in all future calls.
|
||||||
.IP
|
.IP
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
\fBCLGET_SERVER_ADDR\fP \fIstruct sockaddr_in \fP // get server's address
|
\fBCLGET_SERVER_ADDR\fP \fIstruct sockaddr_in \fP // get server\(aqs address
|
||||||
.EE
|
.EE
|
||||||
.in
|
.in
|
||||||
.IP
|
.IP
|
||||||
|
|
|
@ -280,7 +280,7 @@ with each format character based on the type.
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
foo(char *fmt, ...) /* '...' is C syntax for a variadic function */
|
foo(char *fmt, ...) /* \(aq...\(aq is C syntax for a variadic function */
|
||||||
|
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
|
@ -206,7 +206,7 @@ locales yield
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
[ **1234,57 €] [ **1.234,57 EUR]
|
[ **1234,57 €] [ **1.234,57 EUR]
|
||||||
[ Fr. **1234.57] [ CHF **1'234.57]
|
[ Fr. **1234.57] [ CHF **1\(aq234.57]
|
||||||
[ $**1234.57] [ AUD**1,234.57]
|
[ $**1234.57] [ AUD**1,234.57]
|
||||||
[ £**1234.57] [ GBP**1,234.57]
|
[ £**1234.57] [ GBP**1,234.57]
|
||||||
.EE
|
.EE
|
||||||
|
|
|
@ -94,7 +94,7 @@ network interface, using commands something like:
|
||||||
# \fBethtool \-S ve_A\fP # Discover interface index of peer
|
# \fBethtool \-S ve_A\fP # Discover interface index of peer
|
||||||
NIC statistics:
|
NIC statistics:
|
||||||
peer_ifindex: 16
|
peer_ifindex: 16
|
||||||
# \fBip link | grep '\(ha16:'\fP # Look up interface
|
# \fBip link | grep \(aq\(ha16:\(aq\fP # Look up interface
|
||||||
16: ve_B@ve_A: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc ...
|
16: ve_B@ve_A: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc ...
|
||||||
.EE
|
.EE
|
||||||
.in
|
.in
|
||||||
|
|
|
@ -1829,7 +1829,7 @@ and in that shell we create some new mount points:
|
||||||
.IP
|
.IP
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
$ \fBPS1='sh1# ' unshare \-Urnm\fP
|
$ \fBPS1=\(aqsh1# \(aq unshare \-Urnm\fP
|
||||||
sh1# \fBmount \-t tmpfs tmpfs /etc\fP # Mount empty tmpfs at /etc
|
sh1# \fBmount \-t tmpfs tmpfs /etc\fP # Mount empty tmpfs at /etc
|
||||||
sh1# \fBmount \-\-bind /usr /dev\fP # Mount /usr at /dev
|
sh1# \fBmount \-\-bind /usr /dev\fP # Mount /usr at /dev
|
||||||
sh1# \fBecho $$\fP
|
sh1# \fBecho $$\fP
|
||||||
|
@ -1843,7 +1843,7 @@ the initial and new namespaces:
|
||||||
.IP
|
.IP
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
$ \fBPS1='sh2# ' sudo sh\fP
|
$ \fBPS1=\(aqsh2# \(aq sudo sh\fP
|
||||||
sh2# \fBls /etc | wc \-l\fP # In initial NS
|
sh2# \fBls /etc | wc \-l\fP # In initial NS
|
||||||
309
|
309
|
||||||
sh2# \fBls /proc/27123/root/etc | wc \-l\fP # /etc in other NS
|
sh2# \fBls /proc/27123/root/etc | wc \-l\fP # /etc in other NS
|
||||||
|
@ -3182,7 +3182,7 @@ driver driver version
|
||||||
geometry physical and logical geometry
|
geometry physical and logical geometry
|
||||||
identify in hexadecimal
|
identify in hexadecimal
|
||||||
media media type
|
media media type
|
||||||
model manufacturer's model number
|
model manufacturer\(aqs model number
|
||||||
settings drive settings
|
settings drive settings
|
||||||
smart_thresholds IDE disk management thresholds (in hex)
|
smart_thresholds IDE disk management thresholds (in hex)
|
||||||
smart_values IDE disk management values (in hex)
|
smart_values IDE disk management values (in hex)
|
||||||
|
|
|
@ -97,7 +97,7 @@ lines of the following form to
|
||||||
.PP
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
# \fBecho 'name limit batchcount sharedfactor' > /proc/slabinfo\fP
|
# \fBecho \(aqname limit batchcount sharedfactor\(aq > /proc/slabinfo\fP
|
||||||
.EE
|
.EE
|
||||||
.in
|
.in
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -171,7 +171,7 @@ new cgroup namespace), after which we see the expected results:
|
||||||
.PP
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
sh2# \fBmount \-\-make\-rslave /\fP # Don't propagate mount events
|
sh2# \fBmount \-\-make\-rslave /\fP # Don\(aqt propagate mount events
|
||||||
# to other namespaces
|
# to other namespaces
|
||||||
sh2# \fBumount /sys/fs/cgroup/freezer\fP
|
sh2# \fBumount /sys/fs/cgroup/freezer\fP
|
||||||
sh2# \fBmount \-t cgroup \-o freezer freezer /sys/fs/cgroup/freezer\fP
|
sh2# \fBmount \-t cgroup \-o freezer freezer /sys/fs/cgroup/freezer\fP
|
||||||
|
|
|
@ -791,7 +791,7 @@ or '\-' (to disable a controller), as in the following example:
|
||||||
.IP
|
.IP
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
echo '+pids \-memory' > x/y/cgroup.subtree_control
|
echo \(aq+pids \-memory\(aq > x/y/cgroup.subtree_control
|
||||||
.EE
|
.EE
|
||||||
.in
|
.in
|
||||||
.IP
|
.IP
|
||||||
|
|
|
@ -1398,7 +1398,7 @@ and then attach the current shell to that cpuset.
|
||||||
.RB "$" " /bin/echo 1 > cpuset.mems"
|
.RB "$" " /bin/echo 1 > cpuset.mems"
|
||||||
.RB "$" " /bin/echo $$ > tasks"
|
.RB "$" " /bin/echo $$ > tasks"
|
||||||
# The current shell is now running in cpuset Charlie
|
# The current shell is now running in cpuset Charlie
|
||||||
# The next line should display '/Charlie'
|
# The next line should display \(aq/Charlie\(aq
|
||||||
.RB "$" " cat /proc/self/cpuset"
|
.RB "$" " cat /proc/self/cpuset"
|
||||||
.EE
|
.EE
|
||||||
.in
|
.in
|
||||||
|
|
|
@ -1017,7 +1017,7 @@ been processed.
|
||||||
Listening for events.
|
Listening for events.
|
||||||
FAN_CREATE (file created):
|
FAN_CREATE (file created):
|
||||||
Directory /home/user has been modified.
|
Directory /home/user has been modified.
|
||||||
Entry 'testfile.txt' is not a subdirectory.
|
Entry \(aqtestfile.txt\(aq is not a subdirectory.
|
||||||
All events processed successfully. Program exiting.
|
All events processed successfully. Program exiting.
|
||||||
|
|
||||||
$ \fBtouch /home/user/testfile.txt\fP # In another terminal
|
$ \fBtouch /home/user/testfile.txt\fP # In another terminal
|
||||||
|
@ -1040,7 +1040,7 @@ flag set and with the created directory name.
|
||||||
Listening for events.
|
Listening for events.
|
||||||
FAN_CREATE | FAN_ONDIR (subdirectory created):
|
FAN_CREATE | FAN_ONDIR (subdirectory created):
|
||||||
Directory /home/user has been modified.
|
Directory /home/user has been modified.
|
||||||
Entry 'testdir' is a subdirectory.
|
Entry \(aqtestdir\(aq is a subdirectory.
|
||||||
All events processed successfully. Program exiting.
|
All events processed successfully. Program exiting.
|
||||||
|
|
||||||
$ \fBmkdir \-p /home/user/testdir\fP # In another terminal
|
$ \fBmkdir \-p /home/user/testdir\fP # In another terminal
|
||||||
|
|
|
@ -924,7 +924,7 @@ Listening for events stopped.
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* Read all available inotify events from the file descriptor 'fd'.
|
/* Read all available inotify events from the file descriptor \(aqfd\(aq.
|
||||||
wd is the table of watch descriptors for the directories in argv.
|
wd is the table of watch descriptors for the directories in argv.
|
||||||
argc is the length of wd and argv.
|
argc is the length of wd and argv.
|
||||||
argv is the list of watched directories.
|
argv is the list of watched directories.
|
||||||
|
@ -1043,7 +1043,7 @@ main(int argc, char* argv[])
|
||||||
wd[i] = inotify_add_watch(fd, argv[i],
|
wd[i] = inotify_add_watch(fd, argv[i],
|
||||||
IN_OPEN | IN_CLOSE);
|
IN_OPEN | IN_CLOSE);
|
||||||
if (wd[i] == \-1) {
|
if (wd[i] == \-1) {
|
||||||
fprintf(stderr, "Cannot watch '%s': %s\en",
|
fprintf(stderr, "Cannot watch \(aq%s\(aq: %s\en",
|
||||||
argv[i], strerror(errno));
|
argv[i], strerror(errno));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -1081,7 +1081,7 @@ main(int argc, char* argv[])
|
||||||
|
|
||||||
/* Console input is available. Empty stdin and quit */
|
/* Console input is available. Empty stdin and quit */
|
||||||
|
|
||||||
while (read(STDIN_FILENO, &buf, 1) > 0 && buf != '\en')
|
while (read(STDIN_FILENO, &buf, 1) > 0 && buf != \(aq\en\(aq)
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -524,7 +524,7 @@ in the first shell:
|
||||||
.EX
|
.EX
|
||||||
sh1# \fBmkdir /mntY/c\fP
|
sh1# \fBmkdir /mntY/c\fP
|
||||||
sh1# \fBmount /dev/sda1 /mntY/c\fP
|
sh1# \fBmount /dev/sda1 /mntY/c\fP
|
||||||
sh1# \fBcat /proc/self/mountinfo | grep '/mnt' | sed 's/ \- .*//'\fP
|
sh1# \fBcat /proc/self/mountinfo | grep \(aq/mnt\(aq | sed \(aqs/ \- .*//\(aq\fP
|
||||||
132 83 8:23 / /mntX rw,relatime shared:1
|
132 83 8:23 / /mntX rw,relatime shared:1
|
||||||
133 83 8:22 / /mntY rw,relatime shared:2
|
133 83 8:22 / /mntY rw,relatime shared:2
|
||||||
174 132 8:3 / /mntX/a rw,relatime shared:3
|
174 132 8:3 / /mntX/a rw,relatime shared:3
|
||||||
|
|
|
@ -725,7 +725,7 @@ print_diag(const struct unix_diag_msg *diag, unsigned int len)
|
||||||
if (path_len > sizeof(path) \- 1)
|
if (path_len > sizeof(path) \- 1)
|
||||||
path_len = sizeof(path) \- 1;
|
path_len = sizeof(path) \- 1;
|
||||||
memcpy(path, RTA_DATA(attr), path_len);
|
memcpy(path, RTA_DATA(attr), path_len);
|
||||||
path[path_len] = '\e0';
|
path[path_len] = \(aq\e0\(aq;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -745,7 +745,7 @@ print_diag(const struct unix_diag_msg *diag, unsigned int len)
|
||||||
printf(", name=%s%s", *path ? "" : "@",
|
printf(", name=%s%s", *path ? "" : "@",
|
||||||
*path ? path : path + 1);
|
*path ? path : path + 1);
|
||||||
|
|
||||||
putchar('\en');
|
putchar(\(aq\en\(aq);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1018,7 +1018,7 @@ and group ID
|
||||||
.PP
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
$ \fB./userns_child_exec \-p \-m \-U \-M '0 1000 1' \-G '0 1000 1' bash\fP
|
$ \fB./userns_child_exec \-p \-m \-U \-M \(aq0 1000 1\(aq \-G \(aq0 1000 1\(aq bash\fP
|
||||||
.EE
|
.EE
|
||||||
.in
|
.in
|
||||||
.PP
|
.PP
|
||||||
|
@ -1053,10 +1053,10 @@ and a full set of permitted and effective capabilities:
|
||||||
.PP
|
.PP
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
bash$ \fBcat /proc/$$/status | egrep '\(ha[UG]id'\fP
|
bash$ \fBcat /proc/$$/status | egrep \(aq\(ha[UG]id\(aq\fP
|
||||||
Uid: 0 0 0 0
|
Uid: 0 0 0 0
|
||||||
Gid: 0 0 0 0
|
Gid: 0 0 0 0
|
||||||
bash$ \fBcat /proc/$$/status | egrep '\(haCap(Prm|Inh|Eff)'\fP
|
bash$ \fBcat /proc/$$/status | egrep \(aq\(haCap(Prm|Inh|Eff)\(aq\fP
|
||||||
CapInh: 0000000000000000
|
CapInh: 0000000000000000
|
||||||
CapPrm: 0000001fffffffff
|
CapPrm: 0000001fffffffff
|
||||||
CapEff: 0000001fffffffff
|
CapEff: 0000001fffffffff
|
||||||
|
|
|
@ -375,7 +375,7 @@ subdirectory below the directory containing the program to be executed:
|
||||||
.IP
|
.IP
|
||||||
.in +4n
|
.in +4n
|
||||||
.EX
|
.EX
|
||||||
$ \fBLD_LIBRARY_PATH='$ORIGIN/$LIB' prog\fP
|
$ \fBLD_LIBRARY_PATH=\(aq$ORIGIN/$LIB\(aq prog\fP
|
||||||
.EE
|
.EE
|
||||||
.in
|
.in
|
||||||
.IP
|
.IP
|
||||||
|
|
Loading…
Reference in New Issue