On Thu, Dec 22, 2022 at 10:49:06PM -0500, Paul Tagliamonte wrote: > > Updated patch attached with your feedback, thank you Crystal >
i've committed the bits of this that i though correct. i'll note below anything rejected from the /lib parts. i've finished with this diff now. jmc > Index: lib/libc/sys/Makefile.inc > =================================================================== > RCS file: /cvs/src/lib/libc/sys/Makefile.inc,v > retrieving revision 1.167 > diff -u -p -r1.167 Makefile.inc > --- lib/libc/sys/Makefile.inc 19 Dec 2022 18:13:50 -0000 1.167 > +++ lib/libc/sys/Makefile.inc 22 Dec 2022 21:14:09 -0000 > @@ -23,7 +23,7 @@ SRCS+= ptrace.c semctl.c \ > # stack protector helper functions > SRCS+= stack_protector.c > > -# cancelation details > +# cancellation details > SRCS+= canceled.c > > # syscalls that would be normal...except for cancellation or SIGTHR i've not taken cancelation->cancellation parts. US english seems to prefer cancel/canceling, and i couldn;t convince myself that this change was correct. so i've not taken it. Index: lib/libagentx/ax.c =================================================================== RCS file: /cvs/src/lib/libagentx/ax.c,v retrieving revision 1.8 diff -u -p -r1.8 ax.c --- lib/libagentx/ax.c 24 Oct 2021 17:43:38 -0000 1.8 +++ lib/libagentx/ax.c 22 Dec 2022 21:14:07 -0000 @@ -862,7 +862,7 @@ ax_varbind2string(struct ax_varbind *vb) if (inet_ntop(PF_INET, vb->avb_data.avb_ostring.aos_string, tmpbuf, sizeof(tmpbuf)) == NULL) { snprintf(buf, sizeof(buf), "%s: (ipaddress)" - "<unparseable>: %s", + "<unparsable>: %s", ax_oid2string(&(vb->avb_oid)), strerror(errno)); break; we have "parseable" all over the tree. the verb is "parse". i didn;t take this. Index: lib/libc/include/cancel.h =================================================================== RCS file: /cvs/src/lib/libc/include/cancel.h,v retrieving revision 1.5 diff -u -p -r1.5 cancel.h --- lib/libc/include/cancel.h 5 Sep 2017 02:40:54 -0000 1.5 +++ lib/libc/include/cancel.h 22 Dec 2022 21:14:09 -0000 @@ -61,8 +61,8 @@ PROTO_NORMAL(_thread_canceled); } /* - * Enter or leave a cancelation point, optionally processing pending - * cancelation requests. Note that ENTER_CANCEL_POINT opens a block + * Enter or leave a cancellation point, optionally processing pending + * cancellation requests. Note that ENTER_CANCEL_POINT opens a block * and LEAVE_CANCEL_POINT must close that same block. */ #define ENTER_CANCEL_POINT(can_cancel) \ cancelation -> cancellation Index: lib/libc/gen/errno.c =================================================================== RCS file: /cvs/src/lib/libc/gen/errno.c,v retrieving revision 1.6 diff -u -p -r1.6 errno.c --- lib/libc/gen/errno.c 7 May 2016 19:05:22 -0000 1.6 +++ lib/libc/gen/errno.c 22 Dec 2022 21:14:08 -0000 @@ -27,7 +27,7 @@ DEF_STRONG(__errno); * syscall. Rather than pay that cost for single-threaded programs, * the syscall stubs will invoke the tc_errnoptr callback to set errno * and other code will invoke the tc_tcb callback to get the TCB - * for cancelation checks, etc. The default callbacks will just + * for cancellation checks, etc. The default callbacks will just * work from the cached location of the initial thread's TCB; * libpthread can override them to the necessary more expensive * versions that use __get_tcb(). cancelation -> cancellation Index: lib/libutil/imsg_init.3 =================================================================== RCS file: /cvs/src/lib/libutil/imsg_init.3,v retrieving revision 1.25 diff -u -p -r1.25 imsg_init.3 --- lib/libutil/imsg_init.3 19 May 2022 08:05:23 -0000 1.25 +++ lib/libutil/imsg_init.3 22 Dec 2022 21:14:14 -0000 @@ -348,7 +348,7 @@ On success returns a pointer to the buffer; on failure it returns NULL. .Pp .Fn ibuf_dynamic -allocates a resizeable buffer of initial length +allocates a resizable buffer of initial length .Fa len and maximum size .Fa max . i'm fairly sure sizable and sizeable are both ok. did not take. Index: lib/libc/db/mpool/mpool.c =================================================================== RCS file: /cvs/src/lib/libc/db/mpool/mpool.c,v retrieving revision 1.21 diff -u -p -r1.21 mpool.c --- lib/libc/db/mpool/mpool.c 1 Nov 2015 03:45:28 -0000 1.21 +++ lib/libc/db/mpool/mpool.c 22 Dec 2022 21:14:08 -0000 @@ -449,7 +449,7 @@ mpool_stat(MPOOL *mp) (void)fprintf(stderr, "%lu pages in the file\n", mp->npages); (void)fprintf(stderr, - "page size %lu, cacheing %lu pages of %lu page max cache\n", + "page size %lu, caching %lu pages of %lu page max cache\n", mp->pagesize, mp->curcache, mp->maxcache); (void)fprintf(stderr, "%lu page puts, %lu page gets, %lu page new\n", mp->pageput, mp->pageget, mp->pagenew); as noted previously about "cache" Index: lib/libpthread/man/pthread_cancel.3 =================================================================== RCS file: /cvs/src/lib/libpthread/man/pthread_cancel.3,v retrieving revision 1.13 diff -u -p -r1.13 pthread_cancel.3 --- lib/libpthread/man/pthread_cancel.3 5 Jun 2013 03:44:50 -0000 1.13 +++ lib/libpthread/man/pthread_cancel.3 22 Dec 2022 21:14:13 -0000 @@ -19,7 +19,7 @@ The function requests that .Fa thread be cancelled. -The target thread's cancelability state and type determines +The target thread's cancellability state and type determines when the cancellation takes effect. When the cancellation is acted on, the cancellation cleanup handlers for .Fa thread one thousand howls. did not take. Index: lib/libpthread/man/pthread_testcancel.3 =================================================================== RCS file: /cvs/src/lib/libpthread/man/pthread_testcancel.3,v retrieving revision 1.17 diff -u -p -r1.17 pthread_testcancel.3 --- lib/libpthread/man/pthread_testcancel.3 19 Dec 2022 03:49:42 -0000 1.17 +++ lib/libpthread/man/pthread_testcancel.3 22 Dec 2022 21:14:13 -0000 @@ -10,7 +10,7 @@ .Nm pthread_setcancelstate , .Nm pthread_setcanceltype , .Nm pthread_testcancel -.Nd set cancelability state +.Nd set cancellability state .Sh SYNOPSIS .In pthread.h .Ft int @@ -22,14 +22,14 @@ .Sh DESCRIPTION The .Fn pthread_setcancelstate -function atomically both sets the calling thread's cancelability state +function atomically both sets the calling thread's cancellability state to the indicated .Fa state and, if .Fa oldstate is not .Dv NULL , -returns the previous cancelability state at the location referenced by +returns the previous cancellability state at the location referenced by .Fa oldstate . Legal values for .Fa state @@ -40,14 +40,14 @@ and .Pp The .Fn pthread_setcanceltype -function atomically both sets the calling thread's cancelability type +function atomically both sets the calling thread's cancellability type to the indicated .Fa type and, if .Fa oldtype is not .Dv NULL , -returns the previous cancelability type at the location referenced by +returns the previous cancellability type at the location referenced by .Fa oldtype . Legal values for .Fa type @@ -56,7 +56,7 @@ are and .Dv PTHREAD_CANCEL_ASYNCHRONOUS . .Pp -The cancelability state and type of any newly created threads, including the +The cancellability state and type of any newly created threads, including the thread in which .Fn main was first invoked, are @@ -70,31 +70,31 @@ The function creates a cancellation point in the calling thread. The .Fn pthread_testcancel -function has no effect if cancelability is disabled. -.Ss Cancelability States -The cancelability state of a thread determines the action taken upon +function has no effect if cancellability is disabled. +.Ss Cancellability States +The cancellability state of a thread determines the action taken upon receipt of a cancellation request. The thread may control cancellation in a number of ways. .Pp Each thread maintains its own -.Dq cancelability state +.Dq cancellability state which may be encoded in two bits: .Bl -hang -.It Em Cancelability Enable -When cancelability is +.It Em Cancellability Enable +When cancellability is .Dv PTHREAD_CANCEL_DISABLE , cancellation requests against the target thread are held pending. -.It Em Cancelability Type -When cancelability is enabled and the cancelability type is +.It Em Cancellability Type +When cancellability is enabled and the cancellability type is .Dv PTHREAD_CANCEL_ASYNCHRONOUS , new or pending cancellation requests may be acted upon at any time. -When cancelability is enabled and the cancelability type is +When cancellability is enabled and the cancellability type is .Dv PTHREAD_CANCEL_DEFERRED , cancellation requests are held pending until a cancellation point (see below) is reached. -If cancelability is disabled, the setting of the -cancelability type has no immediate effect as all cancellation requests -are held pending; however, once cancelability is enabled again the new +If cancellability is disabled, the setting of the +cancellability type has no immediate effect as all cancellation requests +are held pending; however, once cancellability is enabled again the new type will be in effect. .El .Ss Cancellation Points @@ -180,27 +180,27 @@ It is a set of procedures and global var a unit and called by clients not known by the object. Objects may depend on other objects. .Pp -First, cancelability should only be disabled on entry to an object, never +First, cancellability should only be disabled on entry to an object, never explicitly enabled. -On exit from an object, the cancelability state should +On exit from an object, the cancellability state should always be restored to its value on entry to the object. .Pp This follows from a modularity argument: if the client of an object (or the -client of an object that uses that object) has disabled cancelability, it is +client of an object that uses that object) has disabled cancellability, it is because the client doesn't want to have to worry about how to clean up if the thread is cancelled while executing some sequence of actions. If an object -is called in such a state and it enables cancelability and a cancellation +is called in such a state and it enables cancellability and a cancellation request is pending for that thread, then the thread will be cancelled, contrary to the wish of the client that disabled. .Pp -Second, the cancelability type may be explicitly set to either +Second, the cancellability type may be explicitly set to either .Em deferred or .Em asynchronous upon entry to an object. -But as with the cancelability state, on exit from -an object that cancelability type should always be restored to its value on +But as with the cancellability state, on exit from +an object that cancellability type should always be restored to its value on entry to the object. .Pp Finally, only functions that are cancel-safe may be called from a thread that cancelation -> cancellation Index: lib/libpthread/man/pthreads.3 =================================================================== RCS file: /cvs/src/lib/libpthread/man/pthreads.3,v retrieving revision 1.44 diff -u -p -r1.44 pthreads.3 --- lib/libpthread/man/pthreads.3 6 Feb 2022 00:29:02 -0000 1.44 +++ lib/libpthread/man/pthreads.3 22 Dec 2022 21:14:13 -0000 @@ -264,11 +264,11 @@ Dynamic package initialisation. .It Fn pthread_self Get the calling thread's ID. .It Fn pthread_setcancelstate -Set cancelability state. +Set cancellability state. .It Fn pthread_setcanceltype -Set cancelability state. +Set cancellability state. .It Fn pthread_testcancel -Set cancelability state. +Set cancellability state. .It Fn pthread_sigmask Examine/change a thread's signal mask. .It Fn pthread_getcpuclockid cancelation -> cancellation Index: lib/libc/thread/rthread.c =================================================================== RCS file: /cvs/src/lib/libc/thread/rthread.c,v retrieving revision 1.9 diff -u -p -r1.9 rthread.c --- lib/libc/thread/rthread.c 12 Oct 2020 22:06:51 -0000 1.9 +++ lib/libc/thread/rthread.c 22 Dec 2022 21:14:09 -0000 @@ -129,7 +129,7 @@ pthread_exit(void *retval) if (tib->tib_cantcancel & CANCEL_DYING) { /* - * Called pthread_exit() from destructor or cancelation + * Called pthread_exit() from destructor or cancellation * handler: blow up. XXX write something to stderr? */ abort(); Index: lib/librthread/rthread_sem.c =================================================================== RCS file: /cvs/src/lib/librthread/rthread_sem.c,v retrieving revision 1.33 diff -u -p -r1.33 rthread_sem.c --- lib/librthread/rthread_sem.c 14 May 2022 14:52:20 -0000 1.33 +++ lib/librthread/rthread_sem.c 22 Dec 2022 21:14:13 -0000 @@ -74,7 +74,7 @@ _sem_wait(sem_t sem, int can_eintr, cons break; error = _twait(&sem->value, 0, CLOCK_REALTIME, abstime); - /* ignore interruptions other than cancelation */ + /* ignore interruptions other than cancellation */ if ((error == ECANCELED && *delayed_cancel == 0) || (error == EINTR && !can_eintr) || error == EAGAIN) error = 0; cancelation -> cancellation Index: lib/librthread/rthread_sem_compat.c =================================================================== RCS file: /cvs/src/lib/librthread/rthread_sem_compat.c,v retrieving revision 1.2 diff -u -p -r1.2 rthread_sem_compat.c --- lib/librthread/rthread_sem_compat.c 14 May 2022 14:52:20 -0000 1.2 +++ lib/librthread/rthread_sem_compat.c 22 Dec 2022 21:14:13 -0000 @@ -73,7 +73,7 @@ _sem_wait(sem_t sem, int can_eintr, cons r = __thrsleep(ident, CLOCK_REALTIME, abstime, &sem->lock, delayed_cancel); _spinlock(&sem->lock); - /* ignore interruptions other than cancelation */ + /* ignore interruptions other than cancellation */ if ((r == ECANCELED && *delayed_cancel == 0) || (r == EINTR && !can_eintr)) r = 0; cancelation -> cancellation