ioctl_ns.2, keyctl.2, memfd_create.2, pidfd_send_signal.2, poll.2, seccomp.2, signalfd.2, timerfd_create.2, unshare.2, dlinfo.3, duplocale.3, fopencookie.3, getgrouplist.3, getifaddrs.3, getprotoent_r.3, getservent_r.3, insque.3, printf.3, pthread_attr_init.3, pthread_cancel.3, pthread_create.3, pthread_mutexattr_setrobust.3, pthread_setaffinity_np.3, qsort.3, sem_wait.3, core.5, elf.5, aio.7, epoll.7, pkeys.7, system_data_types.7, unix.7: Use periods more consistently inside code comments

In general, complete sentences in free-standing comments
should be terminated by periods.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2020-12-27 11:42:50 +01:00
parent c6beb8a167
commit 46b20ca1bb
32 changed files with 122 additions and 124 deletions

View File

@ -289,7 +289,7 @@ main(int argc, char *argv[])
} }
/* Obtain a file descriptor for the \(aqns\(aq file specified /* Obtain a file descriptor for the \(aqns\(aq file specified
in argv[1] */ in argv[1]. */
fd = open(argv[1], O_RDONLY); fd = open(argv[1], O_RDONLY);
if (fd == \-1) { if (fd == \-1) {
@ -298,7 +298,7 @@ main(int argc, char *argv[])
} }
/* Obtain a file descriptor for the owning user namespace and /* Obtain a file descriptor for the owning user namespace and
then obtain and display the inode number of that namespace */ then obtain and display the inode number of that namespace. */
if (argc < 3 || strchr(argv[2], \(aqu\(aq)) { if (argc < 3 || strchr(argv[2], \(aqu\(aq)) {
userns_fd = ioctl(fd, NS_GET_USERNS); userns_fd = ioctl(fd, NS_GET_USERNS);
@ -326,7 +326,7 @@ main(int argc, char *argv[])
} }
/* Obtain a file descriptor for the parent namespace and /* Obtain a file descriptor for the parent namespace and
then obtain and display the inode number of that namespace */ then obtain and display the inode number of that namespace. */
if (argc > 2 && strchr(argv[2], \(aqp\(aq)) { if (argc > 2 && strchr(argv[2], \(aqp\(aq)) {
parent_fd = ioctl(fd, NS_GET_PARENT); parent_fd = ioctl(fd, NS_GET_PARENT);

View File

@ -2143,7 +2143,7 @@ main(int argc, char *argv[])
fprintf(fp, "\en"); fprintf(fp, "\en");
/* /*
* Assume the authority to instantiate the key named in argv[2] * Assume the authority to instantiate the key named in argv[2].
*/ */
if (keyctl(KEYCTL_ASSUME_AUTHORITY, key_to_instantiate) == \-1) { if (keyctl(KEYCTL_ASSUME_AUTHORITY, key_to_instantiate) == \-1) {
fprintf(fp, "KEYCTL_ASSUME_AUTHORITY failed: %s\en", fprintf(fp, "KEYCTL_ASSUME_AUTHORITY failed: %s\en",
@ -2152,7 +2152,7 @@ main(int argc, char *argv[])
} }
/* /*
* Fetch the description of the key that is to be instantiated * Fetch the description of the key that is to be instantiated.
*/ */
if (keyctl(KEYCTL_DESCRIBE, key_to_instantiate, if (keyctl(KEYCTL_DESCRIBE, key_to_instantiate,
dbuf, sizeof(dbuf)) == \-1) { dbuf, sizeof(dbuf)) == \-1) {
@ -2164,7 +2164,7 @@ main(int argc, char *argv[])
/* /*
* Fetch the payload of the authorization key, which is * Fetch the payload of the authorization key, which is
* actually the callout data given to request_key() * actually the callout data given to request_key().
*/ */
akp_size = keyctl(KEYCTL_READ, KEY_SPEC_REQKEY_AUTH_KEY, akp_size = keyctl(KEYCTL_READ, KEY_SPEC_REQKEY_AUTH_KEY,
auth_key_payload, sizeof(auth_key_payload)); auth_key_payload, sizeof(auth_key_payload));

View File

@ -445,13 +445,13 @@ main(int argc, char *argv[])
seals_arg = argv[3]; seals_arg = argv[3];
/* Create an anonymous file in tmpfs; allow seals to be /* Create an anonymous file in tmpfs; allow seals to be
placed on the file */ placed on the file. */
fd = memfd_create(name, MFD_ALLOW_SEALING); fd = memfd_create(name, MFD_ALLOW_SEALING);
if (fd == \-1) if (fd == \-1)
errExit("memfd_create"); errExit("memfd_create");
/* Size the file as specified on the command line */ /* Size the file as specified on the command line. */
if (ftruncate(fd, len) == \-1) if (ftruncate(fd, len) == \-1)
errExit("truncate"); errExit("truncate");
@ -460,10 +460,10 @@ main(int argc, char *argv[])
(intmax_t) getpid(), fd, (intmax_t) getpid(), fd); (intmax_t) getpid(), fd, (intmax_t) getpid(), fd);
/* Code to map the file and populate the mapping with data /* Code to map the file and populate the mapping with data
omitted */ omitted. */
/* If a \(aqseals\(aq command\-line argument was supplied, set some /* If a \(aqseals\(aq command\-line argument was supplied, set some
seals on the file */ seals on the file. */
if (seals_arg != NULL) { if (seals_arg != NULL) {
seals = 0; seals = 0;
@ -484,7 +484,7 @@ main(int argc, char *argv[])
} }
/* Keep running, so that the file created by memfd_create() /* Keep running, so that the file created by memfd_create()
continues to exist */ continues to exist. */
pause(); pause();
@ -538,7 +538,7 @@ main(int argc, char *argv[])
printf("\en"); printf("\en");
/* Code to map the file and access the contents of the /* Code to map the file and access the contents of the
resulting mapping omitted */ resulting mapping omitted. */
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }

View File

@ -214,7 +214,7 @@ main(int argc, char *argv[])
sig = atoi(argv[2]); sig = atoi(argv[2]);
/* Obtain a PID file descriptor by opening the /proc/PID directory /* Obtain a PID file descriptor by opening the /proc/PID directory
of the target process */ of the target process. */
snprintf(path, sizeof(path), "/proc/%s", argv[1]); snprintf(path, sizeof(path), "/proc/%s", argv[1]);
@ -225,7 +225,7 @@ main(int argc, char *argv[])
} }
/* Populate a \(aqsiginfo_t\(aq structure for use with /* Populate a \(aqsiginfo_t\(aq structure for use with
pidfd_send_signal() */ pidfd_send_signal(). */
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
info.si_code = SI_QUEUE; info.si_code = SI_QUEUE;
@ -235,7 +235,7 @@ main(int argc, char *argv[])
info.si_pid = getpid(); info.si_pid = getpid();
info.si_value.sival_int = 1234; info.si_value.sival_int = 1234;
/* Send the signal */ /* Send the signal. */
if (pidfd_send_signal(pidfd, sig, &info, 0) == \-1) { if (pidfd_send_signal(pidfd, sig, &info, 0) == \-1) {
perror("pidfd_send_signal"); perror("pidfd_send_signal");

View File

@ -600,7 +600,7 @@ main(int argc, char *argv[])
if (pfds == NULL) if (pfds == NULL)
errExit("malloc"); errExit("malloc");
/* Open each file on command line, and add it \(aqpfds\(aq array */ /* Open each file on command line, and add it \(aqpfds\(aq array. */
for (int j = 0; j < nfds; j++) { for (int j = 0; j < nfds; j++) {
pfds[j].fd = open(argv[j + 1], O_RDONLY); pfds[j].fd = open(argv[j + 1], O_RDONLY);
@ -613,7 +613,7 @@ main(int argc, char *argv[])
} }
/* Keep calling poll() as long as at least one file descriptor is /* Keep calling poll() as long as at least one file descriptor is
open */ open. */
while (num_open_fds > 0) { while (num_open_fds > 0) {
int ready; int ready;
@ -625,7 +625,7 @@ main(int argc, char *argv[])
printf("Ready: %d\en", ready); printf("Ready: %d\en", ready);
/* Deal with array returned by poll() */ /* Deal with array returned by poll(). */
for (int j = 0; j < nfds; j++) { for (int j = 0; j < nfds; j++) {
char buf[10]; char buf[10];

View File

@ -1064,44 +1064,44 @@ 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
\(aqnr\(aq 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 \(aqseccomp_data\(aq 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 \(aqt_arch\(aq */ 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 \(aqseccomp_data\(aq 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))),
/* [3] Check ABI - only needed for x86-64 in deny-list use /* [3] Check ABI - only needed for x86-64 in deny-list use
cases. Use BPF_JGT instead of checking against the bit cases. Use BPF_JGT instead of checking against the bit
mask to avoid having to reload the syscall number */ mask to avoid having to reload the syscall number. */
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 \(aqsyscall_nr\(aq */ 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\(aqt execute /* [5] Matching architecture and system call: don\(aqt execute
the system call, and return \(aqf_errno\(aq in \(aqerrno\(aq */ 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)),
/* [6] Destination of system call number mismatch: allow other /* [6] Destination of system call number mismatch: allow other
system calls */ system calls. */
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW), BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW),
/* [7] Destination of architecture mismatch: kill process */ /* [7] Destination of architecture mismatch: kill process. */
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_KILL_PROCESS), BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_KILL_PROCESS),
}; };

View File

@ -492,7 +492,7 @@ main(int argc, char *argv[])
sigaddset(&mask, SIGQUIT); sigaddset(&mask, SIGQUIT);
/* Block signals so that they aren\(aqt handled /* Block signals so that they aren\(aqt handled
according to their default dispositions */ according to their default dispositions. */
if (sigprocmask(SIG_BLOCK, &mask, NULL) == \-1) if (sigprocmask(SIG_BLOCK, &mask, NULL) == \-1)
handle_error("sigprocmask"); handle_error("sigprocmask");

View File

@ -677,7 +677,7 @@ main(int argc, char *argv[])
handle_error("clock_gettime"); handle_error("clock_gettime");
/* Create a CLOCK_REALTIME absolute timer with initial /* Create a CLOCK_REALTIME absolute timer with initial
expiration and interval as specified in command line */ expiration and interval as specified in command line. */
new_value.it_value.tv_sec = now.tv_sec + atoi(argv[1]); new_value.it_value.tv_sec = now.tv_sec + atoi(argv[1]);
new_value.it_value.tv_nsec = now.tv_nsec; new_value.it_value.tv_nsec = now.tv_nsec;

View File

@ -498,7 +498,7 @@ commands shows that the two shells are in different mount namespaces.
#include <stdio.h> #include <stdio.h>
/* A simple error\-handling function: print an error message based /* A simple error\-handling function: print an error message based
on the value in \(aqerrno\(aq and terminate the calling process */ on the value in \(aqerrno\(aq and terminate the calling process. */
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e #define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e
} while (0) } while (0)

View File

@ -277,7 +277,7 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Obtain a handle for shared object specified on command line */ /* Obtain a handle for shared object specified on command line. */
handle = dlopen(argv[1], RTLD_NOW); handle = dlopen(argv[1], RTLD_NOW);
if (handle == NULL) { if (handle == NULL) {
@ -286,14 +286,14 @@ main(int argc, char *argv[])
} }
/* Discover the size of the buffer that we must pass to /* Discover the size of the buffer that we must pass to
RTLD_DI_SERINFO */ RTLD_DI_SERINFO. */
if (dlinfo(handle, RTLD_DI_SERINFOSIZE, &serinfo) == \-1) { if (dlinfo(handle, RTLD_DI_SERINFOSIZE, &serinfo) == \-1) {
fprintf(stderr, "RTLD_DI_SERINFOSIZE failed: %s\en", dlerror()); fprintf(stderr, "RTLD_DI_SERINFOSIZE failed: %s\en", dlerror());
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Allocate the buffer for use with RTLD_DI_SERINFO */ /* Allocate the buffer for use with RTLD_DI_SERINFO. */
sip = malloc(serinfo.dls_size); sip = malloc(serinfo.dls_size);
if (sip == NULL) { if (sip == NULL) {
@ -302,14 +302,14 @@ main(int argc, char *argv[])
} }
/* Initialize the \(aqdls_size\(aq and \(aqdls_cnt\(aq fields in the newly /* Initialize the \(aqdls_size\(aq and \(aqdls_cnt\(aq fields in the newly
allocated buffer */ allocated buffer. */
if (dlinfo(handle, RTLD_DI_SERINFOSIZE, sip) == \-1) { if (dlinfo(handle, RTLD_DI_SERINFOSIZE, sip) == \-1) {
fprintf(stderr, "RTLD_DI_SERINFOSIZE failed: %s\en", dlerror()); fprintf(stderr, "RTLD_DI_SERINFOSIZE failed: %s\en", dlerror());
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Fetch and print library search list */ /* Fetch and print library search list. */
if (dlinfo(handle, RTLD_DI_SERINFO, sip) == \-1) { if (dlinfo(handle, RTLD_DI_SERINFO, sip) == \-1) {
fprintf(stderr, "RTLD_DI_SERINFO failed: %s\en", dlerror()); fprintf(stderr, "RTLD_DI_SERINFO failed: %s\en", dlerror());

View File

@ -156,7 +156,7 @@ main(int argc, char *argv[])
/* This sequence is necessary, because uselocale() might return /* This sequence is necessary, because uselocale() might return
the value LC_GLOBAL_LOCALE, which can\(aqt be passed as an the value LC_GLOBAL_LOCALE, which can\(aqt be passed as an
argument to toupper_l() */ argument to toupper_l(). */
loc = uselocale((locale_t) 0); loc = uselocale((locale_t) 0);
if (loc == (locale_t) 0) if (loc == (locale_t) 0)

View File

@ -305,7 +305,7 @@ memfile_write(void *c, const char *buf, size_t size)
char *new_buff; char *new_buff;
struct memfile_cookie *cookie = c; struct memfile_cookie *cookie = c;
/* Buffer too small? Keep doubling size until big enough */ /* Buffer too small? Keep doubling size until big enough. */
while (size + cookie\->offset > cookie\->allocated) { while (size + cookie\->offset > cookie\->allocated) {
new_buff = realloc(cookie\->buf, cookie\->allocated * 2); new_buff = realloc(cookie\->buf, cookie\->allocated * 2);
@ -332,7 +332,7 @@ memfile_read(void *c, char *buf, size_t size)
ssize_t xbytes; ssize_t xbytes;
struct memfile_cookie *cookie = c; struct memfile_cookie *cookie = c;
/* Fetch minimum of bytes requested and bytes available */ /* Fetch minimum of bytes requested and bytes available. */
xbytes = size; xbytes = size;
if (cookie\->offset + size > cookie\->endpos) if (cookie\->offset + size > cookie\->endpos)
@ -395,7 +395,7 @@ main(int argc, char *argv[])
size_t nread; size_t nread;
char buf[1000]; char buf[1000];
/* Set up the cookie before calling fopencookie() */ /* Set up the cookie before calling fopencookie(). */
mycookie.buf = malloc(INIT_BUF_SIZE); mycookie.buf = malloc(INIT_BUF_SIZE);
if (mycookie.buf == NULL) { if (mycookie.buf == NULL) {
@ -413,7 +413,7 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Write command\-line arguments to our file */ /* Write command\-line arguments to our file. */
for (int j = 1; j < argc; j++) for (int j = 1; j < argc; j++)
if (fputs(argv[j], stream) == EOF) { if (fputs(argv[j], stream) == EOF) {
@ -421,7 +421,7 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Read two bytes out of every five, until EOF */ /* Read two bytes out of every five, until EOF. */
for (long p = 0; ; p += 5) { for (long p = 0; ; p += 5) {
if (fseek(stream, p, SEEK_SET) == \-1) { if (fseek(stream, p, SEEK_SET) == \-1) {

View File

@ -169,7 +169,7 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Fetch passwd structure (contains first group ID for user) */ /* Fetch passwd structure (contains first group ID for user). */
pw = getpwnam(argv[1]); pw = getpwnam(argv[1]);
if (pw == NULL) { if (pw == NULL) {
@ -177,7 +177,7 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
/* Retrieve group list */ /* Retrieve group list. */
if (getgrouplist(argv[1], pw\->pw_gid, groups, &ngroups) == \-1) { if (getgrouplist(argv[1], pw\->pw_gid, groups, &ngroups) == \-1) {
fprintf(stderr, "getgrouplist() returned \-1; ngroups = %d\en", fprintf(stderr, "getgrouplist() returned \-1; ngroups = %d\en",
@ -185,7 +185,7 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Display list of retrieved groups, along with group names */ /* Display list of retrieved groups, along with group names. */
fprintf(stderr, "ngroups = %d\en", ngroups); fprintf(stderr, "ngroups = %d\en", ngroups);
for (int j = 0; j < ngroups; j++) { for (int j = 0; j < ngroups; j++) {

View File

@ -273,7 +273,7 @@ int main(int argc, char *argv[])
} }
/* Walk through linked list, maintaining head pointer so we /* Walk through linked list, maintaining head pointer so we
can free list later */ can free list later. */
for (struct ifaddrs *ifa = ifaddr; ifa != NULL; for (struct ifaddrs *ifa = ifaddr; ifa != NULL;
ifa = ifa\->ifa_next) { ifa = ifa\->ifa_next) {
@ -283,7 +283,7 @@ int main(int argc, char *argv[])
family = ifa\->ifa_addr\->sa_family; family = ifa\->ifa_addr\->sa_family;
/* Display interface name and family (including symbolic /* Display interface name and family (including symbolic
form of the latter for the common families) */ form of the latter for the common families). */
printf("%\-8s %s (%d)\en", printf("%\-8s %s (%d)\en",
ifa\->ifa_name, ifa\->ifa_name,
@ -292,7 +292,7 @@ int main(int argc, char *argv[])
(family == AF_INET6) ? "AF_INET6" : "???", (family == AF_INET6) ? "AF_INET6" : "???",
family); family);
/* For an AF_INET* interface address, display the address */ /* For an AF_INET* interface address, display the address. */
if (family == AF_INET || family == AF_INET6) { if (family == AF_INET || family == AF_INET6) {
s = getnameinfo(ifa\->ifa_addr, s = getnameinfo(ifa\->ifa_addr,

View File

@ -222,7 +222,7 @@ main(int argc, char *argv[])
erange_cnt++; erange_cnt++;
/* Increment a byte at a time so we can see exactly /* Increment a byte at a time so we can see exactly
what size buffer was required */ what size buffer was required. */
buflen++; buflen++;

View File

@ -224,7 +224,7 @@ main(int argc, char *argv[])
erange_cnt++; erange_cnt++;
/* Increment a byte at a time so we can see exactly /* Increment a byte at a time so we can see exactly
what size buffer was required */ what size buffer was required. */
buflen++; buflen++;

View File

@ -196,7 +196,7 @@ main(int argc, char *argv[])
int circular, opt, errfnd; int circular, opt, errfnd;
/* The "\-c" command\-line option can be used to specify that the /* The "\-c" command\-line option can be used to specify that the
list is circular */ list is circular. */
errfnd = 0; errfnd = 0;
circular = 0; circular = 0;
@ -216,7 +216,7 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Create first element and place it in the linked list */ /* Create first element and place it in the linked list. */
elem = new_element(); elem = new_element();
first = elem; first = elem;
@ -231,7 +231,7 @@ main(int argc, char *argv[])
insque(elem, NULL); insque(elem, NULL);
} }
/* Add remaining command\-line arguments as list elements */ /* Add remaining command\-line arguments as list elements. */
while (++optind < argc) { while (++optind < argc) {
prev = elem; prev = elem;
@ -241,7 +241,7 @@ main(int argc, char *argv[])
insque(elem, prev); insque(elem, prev);
} }
/* Traverse the list from the start, printing element names */ /* Traverse the list from the start, printing element names. */
printf("Traversing completed list:\en"); printf("Traversing completed list:\en");
elem = first; elem = first;

View File

@ -1139,7 +1139,7 @@ make_message(const char *fmt, ...)
char *p = NULL; char *p = NULL;
va_list ap; va_list ap;
/* Determine required size */ /* Determine required size. */
va_start(ap, fmt); va_start(ap, fmt);
n = vsnprintf(p, size, fmt, ap); n = vsnprintf(p, size, fmt, ap);
@ -1148,9 +1148,7 @@ make_message(const char *fmt, ...)
if (n < 0) if (n < 0)
return NULL; return NULL;
/* One extra byte for \(aq\e0\(aq */ size = (size_t) n + 1; /* One extra byte for \(aq\e0\(aq */
size = (size_t) n + 1;
p = malloc(size); p = malloc(size);
if (p == NULL) if (p == NULL)
return NULL; return NULL;

View File

@ -239,7 +239,7 @@ thread_start(void *arg)
/* pthread_getattr_np() is a non\-standard GNU extension that /* pthread_getattr_np() is a non\-standard GNU extension that
retrieves the attributes of the thread specified in its retrieves the attributes of the thread specified in its
first argument */ first argument. */
s = pthread_getattr_np(pthread_self(), &gattr); s = pthread_getattr_np(pthread_self(), &gattr);
if (s != 0) if (s != 0)
@ -263,7 +263,7 @@ main(int argc, char *argv[])
/* If a command\-line argument was supplied, use it to set the /* If a command\-line argument was supplied, use it to set the
stack\-size attribute and set a few other thread attributes, stack\-size attribute and set a few other thread attributes,
and set attrp pointing to thread attributes object */ and set attrp pointing to thread attributes object. */
if (argc > 1) { if (argc > 1) {
size_t stack_size; size_t stack_size;

View File

@ -179,7 +179,7 @@ thread_func(void *ignored_argument)
int s; int s;
/* Disable cancellation for a while, so that we don\(aqt /* Disable cancellation for a while, so that we don\(aqt
immediately react to a cancellation request */ immediately react to a cancellation request. */
s = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); s = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
if (s != 0) if (s != 0)
@ -193,11 +193,11 @@ thread_func(void *ignored_argument)
if (s != 0) if (s != 0)
handle_error_en(s, "pthread_setcancelstate"); handle_error_en(s, "pthread_setcancelstate");
/* sleep() is a cancellation point */ /* sleep() is a cancellation point. */
sleep(1000); /* Should get canceled while we sleep */ sleep(1000); /* Should get canceled while we sleep */
/* Should never get here */ /* Should never get here. */
printf("thread_func(): not canceled!\en"); printf("thread_func(): not canceled!\en");
return NULL; return NULL;
@ -210,7 +210,7 @@ main(void)
void *res; void *res;
int s; int s;
/* Start a thread and then send it a cancellation request */ /* Start a thread and then send it a cancellation request. */
s = pthread_create(&thr, NULL, &thread_func, NULL); s = pthread_create(&thr, NULL, &thread_func, NULL);
if (s != 0) if (s != 0)
@ -223,7 +223,7 @@ main(void)
if (s != 0) if (s != 0)
handle_error_en(s, "pthread_cancel"); handle_error_en(s, "pthread_cancel");
/* Join with thread to see what its exit status was */ /* Join with thread to see what its exit status was. */
s = pthread_join(thr, &res); s = pthread_join(thr, &res);
if (s != 0) if (s != 0)

View File

@ -299,7 +299,7 @@ struct thread_info { /* Used as argument to thread_start() */
}; };
/* Thread start function: display address near top of our stack, /* Thread start function: display address near top of our stack,
and return upper\-cased copy of argv_string */ and return upper\-cased copy of argv_string. */
static void * static void *
thread_start(void *arg) thread_start(void *arg)
@ -328,7 +328,7 @@ main(int argc, char *argv[])
size_t stack_size; size_t stack_size;
void *res; void *res;
/* The "\-s" option specifies a stack size for our threads */ /* The "\-s" option specifies a stack size for our threads. */
stack_size = \-1; stack_size = \-1;
while ((opt = getopt(argc, argv, "s:")) != \-1) { while ((opt = getopt(argc, argv, "s:")) != \-1) {
@ -346,7 +346,7 @@ main(int argc, char *argv[])
num_threads = argc \- optind; num_threads = argc \- optind;
/* Initialize thread creation attributes */ /* Initialize thread creation attributes. */
s = pthread_attr_init(&attr); s = pthread_attr_init(&attr);
if (s != 0) if (s != 0)
@ -358,20 +358,20 @@ main(int argc, char *argv[])
handle_error_en(s, "pthread_attr_setstacksize"); handle_error_en(s, "pthread_attr_setstacksize");
} }
/* Allocate memory for pthread_create() arguments */ /* Allocate memory for pthread_create() arguments. */
struct thread_info *tinfo = calloc(num_threads, sizeof(*tinfo)); struct thread_info *tinfo = calloc(num_threads, sizeof(*tinfo));
if (tinfo == NULL) if (tinfo == NULL)
handle_error("calloc"); handle_error("calloc");
/* Create one thread for each command\-line argument */ /* Create one thread for each command\-line argument. */
for (int tnum = 0; tnum < num_threads; tnum++) { for (int tnum = 0; tnum < num_threads; tnum++) {
tinfo[tnum].thread_num = tnum + 1; tinfo[tnum].thread_num = tnum + 1;
tinfo[tnum].argv_string = argv[optind + tnum]; tinfo[tnum].argv_string = argv[optind + tnum];
/* The pthread_create() call stores the thread ID into /* The pthread_create() call stores the thread ID into
corresponding element of tinfo[] */ corresponding element of tinfo[]. */
s = pthread_create(&tinfo[tnum].thread_id, &attr, s = pthread_create(&tinfo[tnum].thread_id, &attr,
&thread_start, &tinfo[tnum]); &thread_start, &tinfo[tnum]);
@ -380,13 +380,13 @@ main(int argc, char *argv[])
} }
/* Destroy the thread attributes object, since it is no /* Destroy the thread attributes object, since it is no
longer needed */ longer needed. */
s = pthread_attr_destroy(&attr); s = pthread_attr_destroy(&attr);
if (s != 0) if (s != 0)
handle_error_en(s, "pthread_attr_destroy"); handle_error_en(s, "pthread_attr_destroy");
/* Now join with each thread, and display its returned value */ /* Now join with each thread, and display its returned value. */
for (int tnum = 0; tnum < num_threads; tnum++) { for (int tnum = 0; tnum < num_threads; tnum++) {
s = pthread_join(tinfo[tnum].thread_id, &res); s = pthread_join(tinfo[tnum].thread_id, &res);

View File

@ -248,7 +248,7 @@ main(int argc, char *argv[])
sleep(2); sleep(2);
/* "original_owner_thread" should have exited by now */ /* "original_owner_thread" should have exited by now. */
printf("[main] Attempting to lock the robust mutex.\en"); printf("[main] Attempting to lock the robust mutex.\en");
s = pthread_mutex_lock(&mtx); s = pthread_mutex_lock(&mtx);

View File

@ -188,7 +188,7 @@ main(int argc, char *argv[])
thread = pthread_self(); thread = pthread_self();
/* Set affinity mask to include CPUs 0 to 7 */ /* Set affinity mask to include CPUs 0 to 7. */
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
for (int j = 0; j < 8; j++) for (int j = 0; j < 8; j++)
@ -198,7 +198,7 @@ main(int argc, char *argv[])
if (s != 0) if (s != 0)
handle_error_en(s, "pthread_setaffinity_np"); handle_error_en(s, "pthread_setaffinity_np");
/* Check the actual affinity mask assigned to the thread */ /* Check the actual affinity mask assigned to the thread. */
s = pthread_getaffinity_np(thread, sizeof(cpuset), &cpuset); s = pthread_getaffinity_np(thread, sizeof(cpuset), &cpuset);
if (s != 0) if (s != 0)

View File

@ -135,7 +135,7 @@ cmpstringp(const void *p1, const void *p2)
{ {
/* The actual arguments to this function are "pointers to /* The actual arguments to this function are "pointers to
pointers to char", but strcmp(3) arguments are "pointers pointers to char", but strcmp(3) arguments are "pointers
to char", hence the following cast plus dereference */ to char", hence the following cast plus dereference. */
return strcmp(*(const char **) p1, *(const char **) p2); return strcmp(*(const char **) p1, *(const char **) p2);
} }

View File

@ -228,7 +228,7 @@ main(int argc, char *argv[])
if (sem_init(&sem, 0, 0) == \-1) if (sem_init(&sem, 0, 0) == \-1)
handle_error("sem_init"); handle_error("sem_init");
/* Establish SIGALRM handler; set alarm timer using argv[1] */ /* Establish SIGALRM handler; set alarm timer using argv[1]. */
sa.sa_handler = handler; sa.sa_handler = handler;
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
@ -239,7 +239,7 @@ main(int argc, char *argv[])
alarm(atoi(argv[1])); alarm(atoi(argv[1]));
/* Calculate relative interval as current time plus /* Calculate relative interval as current time plus
number of seconds given argv[2] */ number of seconds given argv[2]. */
if (clock_gettime(CLOCK_REALTIME, &ts) == \-1) if (clock_gettime(CLOCK_REALTIME, &ts) == \-1)
handle_error("clock_gettime"); handle_error("clock_gettime");
@ -248,9 +248,9 @@ main(int argc, char *argv[])
printf("main() about to call sem_timedwait()\en"); printf("main() about to call sem_timedwait()\en");
while ((s = sem_timedwait(&sem, &ts)) == \-1 && errno == EINTR) while ((s = sem_timedwait(&sem, &ts)) == \-1 && errno == EINTR)
continue; /* Restart if interrupted by handler */ continue; /* Restart if interrupted by handler. */
/* Check what happened */ /* Check what happened. */
if (s == \-1) { if (s == \-1) {
if (errno == ETIMEDOUT) if (errno == ETIMEDOUT)

View File

@ -657,25 +657,25 @@ main(int argc, char *argv[])
char cwd[PATH_MAX]; char cwd[PATH_MAX];
/* Change our current working directory to that of the /* Change our current working directory to that of the
crashing process */ crashing process. */
snprintf(cwd, PATH_MAX, "/proc/%s/cwd", argv[1]); snprintf(cwd, PATH_MAX, "/proc/%s/cwd", argv[1]);
chdir(cwd); chdir(cwd);
/* Write output to file "core.info" in that directory */ /* Write output to file "core.info" in that directory. */
fp = fopen("core.info", "w+"); fp = fopen("core.info", "w+");
if (fp == NULL) if (fp == NULL)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
/* Display command\-line arguments given to core_pattern /* Display command\-line arguments given to core_pattern
pipe program */ pipe program. */
fprintf(fp, "argc=%d\en", argc); fprintf(fp, "argc=%d\en", argc);
for (int j = 0; j < argc; j++) for (int j = 0; j < argc; j++)
fprintf(fp, "argc[%d]=<%s>\en", j, argv[j]); fprintf(fp, "argc[%d]=<%s>\en", j, argv[j]);
/* Count bytes in standard input (the core dump) */ /* Count bytes in standard input (the core dump). */
tot = 0; tot = 0;
while ((nread = read(STDIN_FILENO, buf, BUF_SIZE)) > 0) while ((nread = read(STDIN_FILENO, buf, BUF_SIZE)) > 0)

View File

@ -1867,19 +1867,19 @@ in memory:
void *memory, *name, *desc; void *memory, *name, *desc;
Elf64_Nhdr *note, *next_note; Elf64_Nhdr *note, *next_note;
/* The buffer is pointing to the start of the section/segment */ /* The buffer is pointing to the start of the section/segment. */
note = memory; note = memory;
/* If the name is defined, it follows the note */ /* If the name is defined, it follows the note. */
name = note->n_namesz == 0 ? NULL : memory + sizeof(*note); name = note->n_namesz == 0 ? NULL : memory + sizeof(*note);
/* If the descriptor is defined, it follows the name /* If the descriptor is defined, it follows the name
(with alignment) */ (with alignment). */
desc = note->n_descsz == 0 ? NULL : desc = note->n_descsz == 0 ? NULL :
memory + sizeof(*note) + ALIGN_UP(note->n_namesz, 4); memory + sizeof(*note) + ALIGN_UP(note->n_namesz, 4);
/* The next note follows both (with alignment) */ /* The next note follows both (with alignment). */
next_note = memory + sizeof(*note) + next_note = memory + sizeof(*note) +
ALIGN_UP(note->n_namesz, 4) + ALIGN_UP(note->n_namesz, 4) +
ALIGN_UP(note->n_descsz, 4); ALIGN_UP(note->n_descsz, 4);

View File

@ -305,7 +305,7 @@ main(int argc, char *argv[])
numReqs = argc \- 1; numReqs = argc \- 1;
/* Allocate our arrays */ /* Allocate our arrays. */
struct ioRequest *ioList = calloc(numReqs, sizeof(*ioList)); struct ioRequest *ioList = calloc(numReqs, sizeof(*ioList));
if (ioList == NULL) if (ioList == NULL)
@ -315,7 +315,7 @@ main(int argc, char *argv[])
if (aiocbList == NULL) if (aiocbList == NULL)
errExit("calloc"); errExit("calloc");
/* Establish handlers for SIGQUIT and the I/O completion signal */ /* Establish handlers for SIGQUIT and the I/O completion signal. */
sa.sa_flags = SA_RESTART; sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
@ -330,7 +330,7 @@ main(int argc, char *argv[])
errExit("sigaction"); errExit("sigaction");
/* Open each file specified on the command line, and queue /* Open each file specified on the command line, and queue
a read request on the resulting file descriptor */ a read request on the resulting file descriptor. */
for (int j = 0; j < numReqs; j++) { for (int j = 0; j < numReqs; j++) {
ioList[j].reqNum = j; ioList[j].reqNum = j;
@ -362,7 +362,7 @@ main(int argc, char *argv[])
openReqs = numReqs; openReqs = numReqs;
/* Loop, monitoring status of I/O requests */ /* Loop, monitoring status of I/O requests. */
while (openReqs > 0) { while (openReqs > 0) {
sleep(3); /* Delay between each monitoring step */ sleep(3); /* Delay between each monitoring step */
@ -371,7 +371,7 @@ main(int argc, char *argv[])
/* On receipt of SIGQUIT, attempt to cancel each of the /* On receipt of SIGQUIT, attempt to cancel each of the
outstanding I/O requests, and display status returned outstanding I/O requests, and display status returned
from the cancellation requests */ from the cancellation requests. */
printf("got SIGQUIT; canceling I/O requests: \en"); printf("got SIGQUIT; canceling I/O requests: \en");
@ -396,7 +396,7 @@ main(int argc, char *argv[])
} }
/* Check the status of each I/O request that is still /* Check the status of each I/O request that is still
in progress */ in progress. */
printf("aio_error():\en"); printf("aio_error():\en");
for (int j = 0; j < numReqs; j++) { for (int j = 0; j < numReqs; j++) {
@ -428,7 +428,7 @@ main(int argc, char *argv[])
printf("All I/O requests completed\en"); printf("All I/O requests completed\en");
/* Check status return of all I/O requests */ /* Check status return of all I/O requests. */
printf("aio_return():\en"); printf("aio_return():\en");
for (int j = 0; j < numReqs; j++) { for (int j = 0; j < numReqs; j++) {

View File

@ -304,7 +304,7 @@ struct epoll_event ev, events[MAX_EVENTS];
int listen_sock, conn_sock, nfds, epollfd; int listen_sock, conn_sock, nfds, epollfd;
/* Code to set up listening socket, \(aqlisten_sock\(aq, /* Code to set up listening socket, \(aqlisten_sock\(aq,
(socket(), bind(), listen()) omitted */ (socket(), bind(), listen()) omitted. */
epollfd = epoll_create1(0); epollfd = epoll_create1(0);
if (epollfd == \-1) { if (epollfd == \-1) {

View File

@ -237,7 +237,7 @@ main(void)
int *buffer; int *buffer;
/* /*
*Allocate one page of memory * Allocate one page of memory.
*/ */
buffer = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, buffer = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, \-1, 0); MAP_ANONYMOUS | MAP_PRIVATE, \-1, 0);
@ -245,7 +245,7 @@ main(void)
errExit("mmap"); errExit("mmap");
/* /*
* Put some random data into the page (still OK to touch) * Put some random data into the page (still OK to touch).
*/ */
*buffer = __LINE__; *buffer = __LINE__;
printf("buffer contains: %d\en", *buffer); printf("buffer contains: %d\en", *buffer);
@ -259,7 +259,7 @@ main(void)
/* /*
* Disable access to any memory with "pkey" set, * Disable access to any memory with "pkey" set,
* even though there is none right now * even though there is none right now.
*/ */
status = pkey_set(pkey, PKEY_DISABLE_ACCESS, 0); status = pkey_set(pkey, PKEY_DISABLE_ACCESS, 0);
if (status) if (status)
@ -278,7 +278,7 @@ main(void)
printf("about to read buffer again...\en"); printf("about to read buffer again...\en");
/* /*
* This will crash, because we have disallowed access * This will crash, because we have disallowed access.
*/ */
printf("buffer contains: %d\en", *buffer); printf("buffer contains: %d\en", *buffer);

View File

@ -1827,30 +1827,30 @@ main (void)
suseconds_t us; suseconds_t us;
intmax_t tmp; intmax_t tmp;
/* Scan the number from the string into the temporary variable */ /* Scan the number from the string into the temporary variable. */
sscanf(str, "%jd", &tmp); sscanf(str, "%jd", &tmp);
/* Check that the value is within the valid range of suseconds_t */ /* Check that the value is within the valid range of suseconds_t. */
if (tmp < \-1 || tmp > 1000000) { if (tmp < \-1 || tmp > 1000000) {
fprintf(stderr, "Scanned value outside valid range!\en"); fprintf(stderr, "Scanned value outside valid range!\en");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Copy the value to the suseconds_t variable \(aqus\(aq */ /* Copy the value to the suseconds_t variable \(aqus\(aq. */
us = tmp; us = tmp;
/* Even though suseconds_t can hold the value \-1, this isn\(aqt /* Even though suseconds_t can hold the value \-1, this isn\(aqt
a sensible number of microseconds */ a sensible number of microseconds. */
if (us < 0) { if (us < 0) {
fprintf(stderr, "Scanned value shouldn\(aqt be negative!\en"); fprintf(stderr, "Scanned value shouldn\(aqt be negative!\en");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Print the value */ /* Print the value. */
printf("There are %jd microseconds in half a second.\en", printf("There are %jd microseconds in half a second.\en",
(intmax_t) us); (intmax_t) us);

View File

@ -978,7 +978,7 @@ main(int argc, char *argv[])
int result; int result;
char buffer[BUFFER_SIZE]; char buffer[BUFFER_SIZE];
/* Create local socket */ /* Create local socket. */
connection_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0); connection_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);
if (connection_socket == \-1) { if (connection_socket == \-1) {
@ -994,7 +994,7 @@ main(int argc, char *argv[])
memset(&name, 0, sizeof(name)); memset(&name, 0, sizeof(name));
/* Bind socket to socket name */ /* Bind socket to socket name. */
name.sun_family = AF_UNIX; name.sun_family = AF_UNIX;
strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) \- 1); strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) \- 1);
@ -1018,11 +1018,11 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* This is the main loop for handling connections */ /* This is the main loop for handling connections. */
for (;;) { for (;;) {
/* Wait for incoming connection */ /* Wait for incoming connection. */
data_socket = accept(connection_socket, NULL, NULL); data_socket = accept(connection_socket, NULL, NULL);
if (data_socket == \-1) { if (data_socket == \-1) {
@ -1033,7 +1033,7 @@ main(int argc, char *argv[])
result = 0; result = 0;
for (;;) { for (;;) {
/* Wait for next data packet */ /* Wait for next data packet. */
ret = read(data_socket, buffer, sizeof(buffer)); ret = read(data_socket, buffer, sizeof(buffer));
if (ret == \-1) { if (ret == \-1) {
@ -1041,11 +1041,11 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Ensure buffer is 0\-terminated */ /* Ensure buffer is 0\-terminated. */
buffer[sizeof(buffer) \- 1] = 0; buffer[sizeof(buffer) \- 1] = 0;
/* Handle commands */ /* Handle commands. */
if (!strncmp(buffer, "DOWN", sizeof(buffer))) { if (!strncmp(buffer, "DOWN", sizeof(buffer))) {
down_flag = 1; down_flag = 1;
@ -1056,12 +1056,12 @@ main(int argc, char *argv[])
break; break;
} }
/* Add received summand */ /* Add received summand. */
result += atoi(buffer); result += atoi(buffer);
} }
/* Send result */ /* Send result. */
sprintf(buffer, "%d", result); sprintf(buffer, "%d", result);
ret = write(data_socket, buffer, sizeof(buffer)); ret = write(data_socket, buffer, sizeof(buffer));
@ -1070,11 +1070,11 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Close socket */ /* Close socket. */
close(data_socket); close(data_socket);
/* Quit on DOWN command */ /* Quit on DOWN command. */
if (down_flag) { if (down_flag) {
break; break;
@ -1083,7 +1083,7 @@ main(int argc, char *argv[])
close(connection_socket); close(connection_socket);
/* Unlink the socket */ /* Unlink the socket. */
unlink(SOCKET_NAME); unlink(SOCKET_NAME);
@ -1111,7 +1111,7 @@ main(int argc, char *argv[])
int data_socket; int data_socket;
char buffer[BUFFER_SIZE]; char buffer[BUFFER_SIZE];
/* Create local socket */ /* Create local socket. */
data_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0); data_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);
if (data_socket == \-1) { if (data_socket == \-1) {
@ -1127,7 +1127,7 @@ main(int argc, char *argv[])
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
/* Connect socket to socket address */ /* Connect socket to socket address. */
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) \- 1); strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) \- 1);
@ -1139,7 +1139,7 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Send arguments */ /* Send arguments. */
for (int i = 1; i < argc; ++i) { for (int i = 1; i < argc; ++i) {
ret = write(data_socket, argv[i], strlen(argv[i]) + 1); ret = write(data_socket, argv[i], strlen(argv[i]) + 1);
@ -1149,7 +1149,7 @@ main(int argc, char *argv[])
} }
} }
/* Request result */ /* Request result. */
strcpy(buffer, "END"); strcpy(buffer, "END");
ret = write(data_socket, buffer, strlen(buffer) + 1); ret = write(data_socket, buffer, strlen(buffer) + 1);
@ -1158,7 +1158,7 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Receive result */ /* Receive result. */
ret = read(data_socket, buffer, sizeof(buffer)); ret = read(data_socket, buffer, sizeof(buffer));
if (ret == \-1) { if (ret == \-1) {
@ -1166,13 +1166,13 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Ensure buffer is 0\-terminated */ /* Ensure buffer is 0\-terminated. */
buffer[sizeof(buffer) \- 1] = 0; buffer[sizeof(buffer) \- 1] = 0;
printf("Result = %s\en", buffer); printf("Result = %s\en", buffer);
/* Close socket */ /* Close socket. */
close(data_socket); close(data_socket);