seccomp.2, circleq.3, list.3, malloc_hook.3, slist.3, stailq.3, tailq.3, ip.7, unix.7: tfix

Remove "." at the end of sentence fragments/short single sentences
in comments.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2020-12-23 14:17:30 +01:00
parent d526b40d5b
commit c2e81ff964
9 changed files with 75 additions and 75 deletions

View File

@ -1085,7 +1085,7 @@ install_filter(int syscall_nr, int t_arch, int f_errno)
/* [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

View File

@ -305,7 +305,7 @@ without interfering with the traversal.
struct entry { struct entry {
int data; int data;
CIRCLEQ_ENTRY(entry) entries; /* Queue. */ CIRCLEQ_ENTRY(entry) entries; /* Queue */
}; };
CIRCLEQ_HEAD(circlehead, entry); CIRCLEQ_HEAD(circlehead, entry);
@ -314,33 +314,33 @@ int
main(void) main(void)
{ {
struct entry *n1, *n2, *n3, *np; struct entry *n1, *n2, *n3, *np;
struct circlehead head; /* Queue head. */ struct circlehead head; /* Queue head */
int i; int i;
CIRCLEQ_INIT(&head); /* Initialize the queue. */ CIRCLEQ_INIT(&head); /* Initialize the queue */
n1 = malloc(sizeof(struct entry)); /* Insert at the head. */ n1 = malloc(sizeof(struct entry)); /* Insert at the head */
CIRCLEQ_INSERT_HEAD(&head, n1, entries); CIRCLEQ_INSERT_HEAD(&head, n1, entries);
n1 = malloc(sizeof(struct entry)); /* Insert at the tail. */ n1 = malloc(sizeof(struct entry)); /* Insert at the tail */
CIRCLEQ_INSERT_TAIL(&head, n1, entries); CIRCLEQ_INSERT_TAIL(&head, n1, entries);
n2 = malloc(sizeof(struct entry)); /* Insert after. */ n2 = malloc(sizeof(struct entry)); /* Insert after */
CIRCLEQ_INSERT_AFTER(&head, n1, n2, entries); CIRCLEQ_INSERT_AFTER(&head, n1, n2, entries);
n3 = malloc(sizeof(struct entry)); /* Insert before. */ n3 = malloc(sizeof(struct entry)); /* Insert before */
CIRCLEQ_INSERT_BEFORE(&head, n2, n3, entries); CIRCLEQ_INSERT_BEFORE(&head, n2, n3, entries);
CIRCLEQ_REMOVE(&head, n2, entries); /* Deletion. */ CIRCLEQ_REMOVE(&head, n2, entries); /* Deletion */
free(n2); free(n2);
/* Forward traversal. */ /* Forward traversal */
i = 0; i = 0;
CIRCLEQ_FOREACH(np, &head, entries) CIRCLEQ_FOREACH(np, &head, entries)
np->data = i++; np->data = i++;
/* Reverse traversal. */ /* Reverse traversal */
CIRCLEQ_FOREACH_REVERSE(np, &head, entries) CIRCLEQ_FOREACH_REVERSE(np, &head, entries)
printf("%i\en", np->data); printf("%i\en", np->data);
/* Queue deletion. */ /* Queue deletion */
n1 = CIRCLEQ_FIRST(&head); n1 = CIRCLEQ_FIRST(&head);
while (n1 != (void *)&head) { while (n1 != (void *)&head) {
n2 = CIRCLEQ_NEXT(n1, entries); n2 = CIRCLEQ_NEXT(n1, entries);

View File

@ -300,7 +300,7 @@ without interfering with the traversal.
struct entry { struct entry {
int data; int data;
LIST_ENTRY(entry) entries; /* List. */ LIST_ENTRY(entry) entries; /* List */
}; };
LIST_HEAD(listhead, entry); LIST_HEAD(listhead, entry);
@ -309,30 +309,30 @@ int
main(void) main(void)
{ {
struct entry *n1, *n2, *n3, *np; struct entry *n1, *n2, *n3, *np;
struct listhead head; /* List head. */ struct listhead head; /* List head */
int i; int i;
LIST_INIT(&head); /* Initialize the list. */ LIST_INIT(&head); /* Initialize the list */
n1 = malloc(sizeof(struct entry)); /* Insert at the head. */ n1 = malloc(sizeof(struct entry)); /* Insert at the head */
LIST_INSERT_HEAD(&head, n1, entries); LIST_INSERT_HEAD(&head, n1, entries);
n2 = malloc(sizeof(struct entry)); /* Insert after. */ n2 = malloc(sizeof(struct entry)); /* Insert after */
LIST_INSERT_AFTER(n1, n2, entries); LIST_INSERT_AFTER(n1, n2, entries);
n3 = malloc(sizeof(struct entry)); /* Insert before. */ n3 = malloc(sizeof(struct entry)); /* Insert before */
LIST_INSERT_BEFORE(n2, n3, entries); LIST_INSERT_BEFORE(n2, n3, entries);
i = 0; /* Forward traversal. */ i = 0; /* Forward traversal */
LIST_FOREACH(np, &head, entries) LIST_FOREACH(np, &head, entries)
np->data = i++; np->data = i++;
LIST_REMOVE(n2, entries); /* Deletion. */ LIST_REMOVE(n2, entries); /* Deletion */
free(n2); free(n2);
/* Forward traversal. */ /* Forward traversal */
LIST_FOREACH(np, &head, entries) LIST_FOREACH(np, &head, entries)
printf("%i\en", np->data); printf("%i\en", np->data);
/* List Deletion. */ /* List Deletion */
n1 = LIST_FIRST(&head); n1 = LIST_FIRST(&head);
while (n1 != NULL) { while (n1 != NULL) {
n2 = LIST_NEXT(n1, entries); n2 = LIST_NEXT(n1, entries);

View File

@ -98,14 +98,14 @@ Here is a short example of how to use these variables.
#include <stdio.h> #include <stdio.h>
#include <malloc.h> #include <malloc.h>
/* Prototypes for our hooks. */ /* Prototypes for our hooks */
static void my_init_hook(void); static void my_init_hook(void);
static void *my_malloc_hook(size_t, const void *); static void *my_malloc_hook(size_t, const void *);
/* Variables to save original hooks. */ /* Variables to save original hooks */
static void *(*old_malloc_hook)(size_t, const void *); static void *(*old_malloc_hook)(size_t, const void *);
/* Override initializing hook from the C library. */ /* Override initializing hook from the C library */
void (*__malloc_initialize_hook) (void) = my_init_hook; void (*__malloc_initialize_hook) (void) = my_init_hook;
static void static void
@ -129,7 +129,7 @@ my_malloc_hook(size_t size, const void *caller)
/* Save underlying hooks */ /* Save underlying hooks */
old_malloc_hook = __malloc_hook; old_malloc_hook = __malloc_hook;
/* printf() might call malloc(), so protect it too. */ /* printf() might call malloc(), so protect it too */
printf("malloc(%zu) called from %p returns %p\en", printf("malloc(%zu) called from %p returns %p\en",
size, caller, result); size, caller, result);

View File

@ -305,7 +305,7 @@ without interfering with the traversal.
struct entry { struct entry {
int data; int data;
SLIST_ENTRY(entry) entries; /* Singly linked List. */ SLIST_ENTRY(entry) entries; /* Singly linked List */
}; };
SLIST_HEAD(slisthead, entry); SLIST_HEAD(slisthead, entry);
@ -315,21 +315,21 @@ main(void)
{ {
struct entry *n1, *n2, *n3, *np; struct entry *n1, *n2, *n3, *np;
struct slisthead head; /* Singly linked List struct slisthead head; /* Singly linked List
head. */ head */
SLIST_INIT(&head); /* Initialize the queue. */ SLIST_INIT(&head); /* Initialize the queue */
n1 = malloc(sizeof(struct entry)); /* Insert at the head. */ n1 = malloc(sizeof(struct entry)); /* Insert at the head */
SLIST_INSERT_HEAD(&head, n1, entries); SLIST_INSERT_HEAD(&head, n1, entries);
n2 = malloc(sizeof(struct entry)); /* Insert after. */ n2 = malloc(sizeof(struct entry)); /* Insert after */
SLIST_INSERT_AFTER(n1, n2, entries); SLIST_INSERT_AFTER(n1, n2, entries);
SLIST_REMOVE(&head, n2, entry, entries);/* Deletion. */ SLIST_REMOVE(&head, n2, entry, entries);/* Deletion */
free(n2); free(n2);
n3 = SLIST_FIRST(&head); n3 = SLIST_FIRST(&head);
SLIST_REMOVE_HEAD(&head, entries); /* Deletion from the head. */ SLIST_REMOVE_HEAD(&head, entries); /* Deletion from the head */
free(n3); free(n3);
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
@ -338,11 +338,11 @@ main(void)
n1->data = i; n1->data = i;
} }
/* Forward traversal. */ /* Forward traversal */
SLIST_FOREACH(np, &head, entries) SLIST_FOREACH(np, &head, entries)
printf("%i\en", np->data); printf("%i\en", np->data);
while (!SLIST_EMPTY(&head)) { /* List Deletion. */ while (!SLIST_EMPTY(&head)) { /* List Deletion */
n1 = SLIST_FIRST(&head); n1 = SLIST_FIRST(&head);
SLIST_REMOVE_HEAD(&head, entries); SLIST_REMOVE_HEAD(&head, entries);
free(n1); free(n1);

View File

@ -338,7 +338,7 @@ without interfering with the traversal.
struct entry { struct entry {
int data; int data;
STAILQ_ENTRY(entry) entries; /* Singly linked tail queue. */ STAILQ_ENTRY(entry) entries; /* Singly linked tail queue */
}; };
STAILQ_HEAD(stailhead, entry); STAILQ_HEAD(stailhead, entry);
@ -348,24 +348,24 @@ main(void)
{ {
struct entry *n1, *n2, *n3, *np; struct entry *n1, *n2, *n3, *np;
struct stailhead head; /* Singly linked tail queue struct stailhead head; /* Singly linked tail queue
head. */ head */
STAILQ_INIT(&head); /* Initialize the queue. */ STAILQ_INIT(&head); /* Initialize the queue */
n1 = malloc(sizeof(struct entry)); /* Insert at the head. */ n1 = malloc(sizeof(struct entry)); /* Insert at the head */
STAILQ_INSERT_HEAD(&head, n1, entries); STAILQ_INSERT_HEAD(&head, n1, entries);
n1 = malloc(sizeof(struct entry)); /* Insert at the tail. */ n1 = malloc(sizeof(struct entry)); /* Insert at the tail */
STAILQ_INSERT_TAIL(&head, n1, entries); STAILQ_INSERT_TAIL(&head, n1, entries);
n2 = malloc(sizeof(struct entry)); /* Insert after. */ n2 = malloc(sizeof(struct entry)); /* Insert after */
STAILQ_INSERT_AFTER(&head, n1, n2, entries); STAILQ_INSERT_AFTER(&head, n1, n2, entries);
STAILQ_REMOVE(&head, n2, entry, entries);/* Deletion. */ STAILQ_REMOVE(&head, n2, entry, entries);/* Deletion */
free(n2); free(n2);
n3 = STAILQ_FIRST(&head); n3 = STAILQ_FIRST(&head);
STAILQ_REMOVE_HEAD(&head, entries); /* Deletion from the head. */ STAILQ_REMOVE_HEAD(&head, entries); /* Deletion from the head */
free(n3); free(n3);
n1 = STAILQ_FIRST(&head); n1 = STAILQ_FIRST(&head);
@ -375,10 +375,10 @@ main(void)
STAILQ_INSERT_HEAD(&head, n1, entries); STAILQ_INSERT_HEAD(&head, n1, entries);
n1->data = i; n1->data = i;
} }
/* Forward traversal. */ /* Forward traversal */
STAILQ_FOREACH(np, &head, entries) STAILQ_FOREACH(np, &head, entries)
printf("%i\en", np->data); printf("%i\en", np->data);
/* TailQ Deletion. */ /* TailQ Deletion */
n1 = STAILQ_FIRST(&head); n1 = STAILQ_FIRST(&head);
while (n1 != NULL) { while (n1 != NULL) {
n2 = STAILQ_NEXT(n1, entries); n2 = STAILQ_NEXT(n1, entries);

View File

@ -389,7 +389,7 @@ without interfering with the traversal.
struct entry { struct entry {
int data; int data;
TAILQ_ENTRY(entry) entries; /* Tail queue. */ TAILQ_ENTRY(entry) entries; /* Tail queue */
}; };
TAILQ_HEAD(tailhead, entry); TAILQ_HEAD(tailhead, entry);
@ -398,33 +398,33 @@ int
main(void) main(void)
{ {
struct entry *n1, *n2, *n3, *np; struct entry *n1, *n2, *n3, *np;
struct tailhead head; /* Tail queue head. */ struct tailhead head; /* Tail queue head */
int i; int i;
TAILQ_INIT(&head); /* Initialize the queue. */ TAILQ_INIT(&head); /* Initialize the queue */
n1 = malloc(sizeof(struct entry)); /* Insert at the head. */ n1 = malloc(sizeof(struct entry)); /* Insert at the head */
TAILQ_INSERT_HEAD(&head, n1, entries); TAILQ_INSERT_HEAD(&head, n1, entries);
n1 = malloc(sizeof(struct entry)); /* Insert at the tail. */ n1 = malloc(sizeof(struct entry)); /* Insert at the tail */
TAILQ_INSERT_TAIL(&head, n1, entries); TAILQ_INSERT_TAIL(&head, n1, entries);
n2 = malloc(sizeof(struct entry)); /* Insert after. */ n2 = malloc(sizeof(struct entry)); /* Insert after */
TAILQ_INSERT_AFTER(&head, n1, n2, entries); TAILQ_INSERT_AFTER(&head, n1, n2, entries);
n3 = malloc(sizeof(struct entry)); /* Insert before. */ n3 = malloc(sizeof(struct entry)); /* Insert before */
TAILQ_INSERT_BEFORE(n2, n3, entries); TAILQ_INSERT_BEFORE(n2, n3, entries);
TAILQ_REMOVE(&head, n2, entries); /* Deletion. */ TAILQ_REMOVE(&head, n2, entries); /* Deletion */
free(n2); free(n2);
/* Forward traversal. */ /* Forward traversal */
i = 0; i = 0;
TAILQ_FOREACH(np, &head, entries) TAILQ_FOREACH(np, &head, entries)
np->data = i++; np->data = i++;
/* Reverse traversal. */ /* Reverse traversal */
TAILQ_FOREACH_REVERSE(np, &head, tailhead, entries) TAILQ_FOREACH_REVERSE(np, &head, tailhead, entries)
printf("%i\en", np->data); printf("%i\en", np->data);
/* TailQ Deletion. */ /* TailQ Deletion */
n1 = TAILQ_FIRST(&head); n1 = TAILQ_FIRST(&head);
while (n1 != NULL) { while (n1 != NULL) {
n2 = TAILQ_NEXT(n1, entries); n2 = TAILQ_NEXT(n1, entries);

View File

@ -162,7 +162,7 @@ struct sockaddr_in {
struct in_addr sin_addr; /* internet address */ struct in_addr sin_addr; /* internet address */
}; };
/* Internet address. */ /* Internet address */
struct in_addr { struct in_addr {
uint32_t s_addr; /* address in network byte order */ uint32_t s_addr; /* address in network byte order */
}; };

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) {
@ -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);