1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Lots of man page fixes and some other minor fixes (#284)

Noteworthy changes:
- The man pages have been updated to fix a ton of instances of
  runaway underlining (this was done with `sed -i 's/\\f5/\\f3/g'`
  commands). This commit dramatically increased in size because
  of this change.
- The documentation for spawnveg(3) has been extended with
  information about its usage of posix_spawn(3) and vfork(2).
- The documentation for tmfmt(3) has been updated with the changes
  previously made to the man pages for the printf and date builtins
  (though the latter builtin is disabled by default).
- The shell's tracked alias tree (hash table) is now documented in
  the shell(3) man page.
- Removed the commented out regression test for an ERRNO variable
  as the COMPATIBILITY file states it was removed in ksh93.
This commit is contained in:
Johnothan King 2021-04-23 14:02:30 -07:00 committed by GitHub
parent 2c22ace1e6
commit 086d504393
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 2195 additions and 2094 deletions

View file

@ -63,30 +63,30 @@ special purpose libraries such as
The
.B libast
related header files are installed in the directories
.LR include/ast .
.BR include/ast .
Routines that do not advertize their own headers are prototyped in
.LR <ast.h> .
.L <ast.h>
.BR <ast.h> .
.B <ast.h>
is ANSI, K&R and C++ compatible and includes or defines the equivalent of
.LR <limits.h> ,
.LR <stddef.h> ,
.LR <stdlib.h> ,
.LR <sys/types.h> ,
.L <string.h>
.BR <limits.h> ,
.BR <stddef.h> ,
.BR <stdlib.h> ,
.BR <sys/types.h> ,
.B <string.h>
and
.LR <unistd.h> .
.BR <unistd.h> .
Other libraries that depend on
.B libast
may also have headers installed in the
.L include/ast
.B include/ast
directories.
.SH FILES
.nf
include/ast the \fBast\fP package header directory
lib/libast.a the \fBlibast\fP library
lib/libast-g.a the \fBlibast\fP library compiled for debugging
lib/libast-pg.a the \fBlibast\fP library compiled for profiling
lib/libast.so.4.0 the \fBlibast\fP shared library
include/ast the \fBast\fP package header directory
lib/libast.a the \fBlibast\fP library
lib/libast-g.a the \fBlibast\fP library compiled for debugging
lib/libast-pg.a the \fBlibast\fP library compiled for profiling
lib/libast.so.4.0 the \fBlibast\fP shared library
.fi
.SH "SEE ALSO"
intro(3),

View file

@ -107,71 +107,71 @@ int asorelax(long);
.SH DESCRIPTION
.PP
\fIASO\fP provides functions to perform atomic scalar operations.
The functions on the type \f5uint32_t\fP will be fully described below.
The functions on the type \f3uint32_t\fP will be fully described below.
Other functions work similarly on their respective types.
Some of the functions may be macros that call other functions.
64 bit operations are provided if the compiler supports 64 bit integers and/or pointers.
.PP
.Ss "TYPES"
.PP
\f5uint8_t, uint16_t, uint32_t, uint64_t\fP
\f3uint8_t, uint16_t, uint32_t, uint64_t\fP
These are \fIunsigned integer\fP types of different sizes in bits.
For example, \f5uint32_t\fP represents the type of unsigned integer with 32 bits or 4 bytes.
For example, \f3uint32_t\fP represents the type of unsigned integer with 32 bits or 4 bytes.
.PP
.Ss "OPERATIONS"
.PP
.Ss " uint32_t asoget32(uint32_t* from);"
This function returns the value \f5*from\fP.
This function returns the value \f3*from\fP.
.PP
.Ss " uint32_t asoinc32(uint32_t* dest);"
.Ss " uint32_t asodec32(uint32_t* dest);"
These functions increment \f5*dest\fP by 1 and decrement \f5*dest\fP by 1 in an atomic step.
The return value is the old value in \f5*dest\fP.
These functions increment \f3*dest\fP by 1 and decrement \f3*dest\fP by 1 in an atomic step.
The return value is the old value in \f3*dest\fP.
Consider an example where two concurrent threads/processes call \f5asoinc32()\fP
on the same \f5dest\fP with values, say \fIv1\fP and \fIv2\fP.
The eventual value in \f5dest\fP
will be as if \f5*dest += 2\fP was performed in a single-threaded execution.
Consider an example where two concurrent threads/processes call \f3asoinc32()\fP
on the same \f3dest\fP with values, say \fIv1\fP and \fIv2\fP.
The eventual value in \f3dest\fP
will be as if \f3*dest += 2\fP was performed in a single-threaded execution.
That should be contrasted with a situation where, instead of \f5asoinc32()\fP or \f5asodec32()\fP,
That should be contrasted with a situation where, instead of \f3asoinc32()\fP or \f3asodec32()\fP,
only normal increment (++) or decrement (--) were used.
Then, the end result could be either \f5*dest += 1\fP or \f5*dest += 2\fP,
Then, the end result could be either \f3*dest += 1\fP or \f3*dest += 2\fP,
depending on states of the hardware cache and process scheduling.
.PP
.Ss " uint32_t asocas32(uint32_t* dest, uint32_t tstval, uint32_t newval);"
This function provides the atomic \fIcompare-and-swap\fP operation.
If the current content of \f5dest\fP is equal to \f5tstval\fP then it will be set to \f5newval\fP.
If the current content of \f3dest\fP is equal to \f3tstval\fP then it will be set to \f3newval\fP.
If multiple threads/processes are performing the same operations only one will succeed with a
return value of \f5tstval\fP.
The return value is the old value in \f5*dest\fP.
return value of \f3tstval\fP.
The return value is the old value in \f3*dest\fP.
.PP
.Ss " void asorelax(long nsec)"
This function causes the calling process or thread to briefly pause
for \f5nsec\fP nanoseconds.
for \f3nsec\fP nanoseconds.
It is useful to implement tight loops that occasionally yield control.
.PP
.Ss " int asolock(unsigned int* lock, unsigned int key, int type)"
This function uses \f5key\fP, a non-zero unsigned integer, to lock or unlock the \f5lock\fP.
It returns \f50\fP on success and \f5-1\fP on failure.
The argument \f5type\fP can take one of the following values:
This function uses \f3key\fP, a non-zero unsigned integer, to lock or unlock the \f3lock\fP.
It returns \f30\fP on success and \f3-1\fP on failure.
The argument \f3type\fP can take one of the following values:
.Tp
\f5ASO_UNLOCK\fP:
This unlocks the lock if it was locked with \f5key\fP. It is an error to try
\f3ASO_UNLOCK\fP:
This unlocks the lock if it was locked with \f3key\fP. It is an error to try
unlocking a lock of a different key.
.Tp
\f5ASO_TRYLOCK\fP:
This makes a single attempt to use the given \f5key\fP to acquire a lock.
\f3ASO_TRYLOCK\fP:
This makes a single attempt to use the given \f3key\fP to acquire a lock.
An error will result if the lock is already locked with a different key.
.Tp
\f5ASO_LOCK\fP:
\f3ASO_LOCK\fP:
This is a regular locking call. If the lock is locked with a different key,
this call will wait until the lock is open, then lock it with the given \f5key\fP.
this call will wait until the lock is open, then lock it with the given \f3key\fP.
.Tp
\f5ASO_SPINLOCK\fP:
\f3ASO_SPINLOCK\fP:
Regardless of what key is currently locking the lock,
this call will always wait until the lock is open, then lock it with the given \f5key\fP.
Note that, if the lock is already locked with \f5key\fP, this call can result
this call will always wait until the lock is open, then lock it with the given \f3key\fP.
Note that, if the lock is already locked with \f3key\fP, this call can result
in a deadlock unless that lock can be opened by some other mechanism, e.g.,
by a different process or thread.
.PP
@ -186,108 +186,108 @@ for (;;) {
/* an error occurred */;
}
.Ce
The value of \f5iteration\fP should be \f51\fP (\fInot\fP \f50\fP) for the first loop iteration.
\f50\fP is returned on success, \f5-1\fP on failure.
If \f5iteration mod 4\fP is \f50\fP then \f5asorelax(1)\fP is called to temporarily relinquish
The value of \f3iteration\fP should be \f31\fP (\fInot\fP \f30\fP) for the first loop iteration.
\f30\fP is returned on success, \f3-1\fP on failure.
If \f3iteration mod 4\fP is \f30\fP then \f3asorelax(1)\fP is called to temporarily relinquish
the processor.
If \f5Asodisc_t.hung != 0\fP and \f5Asodisc_t.errorf != 0\fP and
\f5iteration mod (2**Asodisc_t.hung-1)\fP is \f50\fP,
then \f5Asodisc_t.errorf\fP is called with type \f5ASO_HUNG\fP
and \f5-1\fP is returned.
If \f3Asodisc_t.hung != 0\fP and \f3Asodisc_t.errorf != 0\fP and
\f3iteration mod (2**Asodisc_t.hung-1)\fP is \f30\fP,
then \f3Asodisc_t.errorf\fP is called with type \f3ASO_HUNG\fP
and \f3-1\fP is returned.
.PP
.Ss "DISCIPLINE"
.PP
The Asodisc_t discipline structure allows the caller to modify default behavior.
The \fIASO\fP discipline is global for all threads and forked children of the current process.
The discipline is set and modified by the \f5asoinit()\fP function, described below.
The discipline is set and modified by the \f3asoinit()\fP function, described below.
The structure members are:
.Tp
\f5uint32_t version;\fP
This must be set to \f5ASO_VERSION\fP by the caller and is used by the implementation to detect
\f3uint32_t version;\fP
This must be set to \f3ASO_VERSION\fP by the caller and is used by the implementation to detect
release differences between the caller and the implementation.
The version is integer of the form \fIYYYYMMDD\fP where \fIYYYY\fP is the release year, \fIMM\fP
is the release month, and \fIDD\fP is the release day of month.
This allows the implementation to be forwards and backwards binary compatible with all releases.
.Tp
\f5unsigned int hung;\fP
An error occurs if \f5asoloop\fP() is called \f52**Asometh_t.hung\fP times without gaining access to the loop resource.
The default value \f50\fP disables the test.
\f3unsigned int hung;\fP
An error occurs if \f3asoloop\fP() is called \f32**Asometh_t.hung\fP times without gaining access to the loop resource.
The default value \f30\fP disables the test.
.Tp
\f5Asoerror_f errorf;\fP
\f5int (*errorf)(int type, const char* mesg);\fP
If \f5errorf\fP != \f50\fP then it is called for each \fIASO\fP fatal library condition.
\f5type\fP may be one of: \f5ASO_METHOD\fP - a method error; \f5ASO_HUNG\fP - \f5asoloop\fP() was called
\f52**Asometh_t.hung\fP times with no access to the loop resource.
\f5mesg\fP is a 0-terminated message description.
\f3Asoerror_f errorf;\fP
\f3int (*errorf)(int type, const char* mesg);\fP
If \f3errorf\fP != \f30\fP then it is called for each \fIASO\fP fatal library condition.
\f3type\fP may be one of: \f3ASO_METHOD\fP - a method error; \f3ASO_HUNG\fP - \f3asoloop\fP() was called
\f32**Asometh_t.hung\fP times with no access to the loop resource.
\f3mesg\fP is a 0-terminated message description.
.Ss " void ASODISC(Asodisc_t* disc, Asoerror_f errorf);"
.PP
This function-like-macro initializes \f5disc->version = ASO_VERSION\fP, \f5disc->errorf = errorf\fP,
and the remaining \f5disc\fP members to \f50\fP.
This function-like-macro initializes \f3disc->version = ASO_VERSION\fP, \f3disc->errorf = errorf\fP,
and the remaining \f3disc\fP members to \f30\fP.
.PP
.Ss "METHODS"
.PP
Several atomic locking methods are implemented for atomic operations
not supported by \fIintrinsic\fP functions or assembly instructions.
Methods are controlled by the \f5asometh()\fP and \f5asoinit()\fP
Methods are controlled by the \f3asometh()\fP and \f3asoinit()\fP
functions, described below.
The \fIASO\fP method is global for all threads and forked children of the current process.
A given method may have multiple types.
The methods types are:
.Tp
\f5ASO_INTRINSIC\fP:
\f3ASO_INTRINSIC\fP:
Some hardware platforms provide machine instructions to implement these operations directly.
In that case, if a local compiler permits, calls to these \fIintrinsic\fP functions
may be translated directly into their corresponding machine instructions.
When necessary the implementation can use only the intrinsic \fIcompare-and-swap\fP
function on the largest integer type to emulate all other \fIASO\fP operations.
The \f5ASO_INTRINSIC\fP method type is the default when supported by the compiler.
The \f3ASO_INTRINSIC\fP method type is the default when supported by the compiler.
It may be used for single-process single-thread, multi-thread, and
multi-process applications.
When supported by the hardware / compiler, the library provides the "\fBintrinsic\fP" method with type
\f5ASO_INTRINSIC|ASO_PROCESS|ASO_THREAD|ASO_SIGNAL\fP.
\f3ASO_INTRINSIC|ASO_PROCESS|ASO_THREAD|ASO_SIGNAL\fP.
.Tp
\f5ASO_SIGNAL\fP:
\f3ASO_SIGNAL\fP:
This method type is suitable only for single-process single-thread applications.
It can be used to provide locking between asynchronous \fBsignal\fP(2) handlers
and the main program.
The library provides the "\fBsignal\fP" method with type \f5ASO_SIGNAL\fP.
This is the default method type when \f5ASO_INTRINSIC\fP is not supported.
The library provides the "\fBsignal\fP" method with type \f3ASO_SIGNAL\fP.
This is the default method type when \f3ASO_INTRINSIC\fP is not supported.
.Tp
\f5ASO_THREAD\fP:
\f3ASO_THREAD\fP:
This method type is suitable for single-process single-thread, and multi-thread applications.
It typically requires thread library support, and since the default \f5aso\fP library
is not linked with a thread library, no \f5ASO_THREAD\fP method is provided by default.
It typically requires thread library support, and since the default \f3aso\fP library
is not linked with a thread library, no \f3ASO_THREAD\fP method is provided by default.
Threaded applications must link with \fB-ltaso\fP (before \fB-laso\fP or \fB-last\fP)
in order to access \f5ASO_THREAD\fP methods.
in order to access \f3ASO_THREAD\fP methods.
The \fB-ltaso\fP library provides the "\fBspin\fP" (using \fBpthread_spin_lock\fP(3)) and
"\fBmutex"\fP (using \fBpthread_mutex_lock\fP(3)) methods with type \f5ASO_THREAD|ASO_SIGNAL\fP.
"\fBmutex"\fP (using \fBpthread_mutex_lock\fP(3)) methods with type \f3ASO_THREAD|ASO_SIGNAL\fP.
.Tp
\f5ASO_PROCESS\fP:
\f3ASO_PROCESS\fP:
This method type is suitable for single-process single-thread, and multi-process applications.
Some \f5ASO_PROCESS\fP methods may also be suitable for multi-thread applications (if they have the \f5ASO_THREAD\fP type.)
Some \f3ASO_PROCESS\fP methods may also be suitable for multi-thread applications (if they have the \f3ASO_THREAD\fP type).
These methods are typically and noticeably \fIslow\fP, up to 2 orders of magnitude slower than
\f5ASO_INTRINSIC\fP for some applications.
\f3ASO_INTRINSIC\fP for some applications.
They are provided as a last resort when other methods are not available.
The library provides the "\fBsemaphore\fP" method with type \f5ASO_PROCESS|ASO_THREAD|ASO_SIGNAL\fP
and the "\fBfcntl\fP" method with type \f5ASO_PROCESS|ASO_SIGNAL\fP.
The library provides the "\fBsemaphore\fP" method with type \f3ASO_PROCESS|ASO_THREAD|ASO_SIGNAL\fP
and the "\fBfcntl\fP" method with type \f3ASO_PROCESS|ASO_SIGNAL\fP.
.Ss " Asometh_t* asometh(int type, void* data);"
This function looks up methods by type or name.
If type is \f50\fP and \f5data\fP is \f50\fP then the current method is returned; a valid method
If type is \f30\fP and \f3data\fP is \f30\fP then the current method is returned; a valid method
will always be returned for this call.
If type is \f50\fP then \f5data\fP is treated as a \f50\fP-terminated string method name;
\f50\fP is returned if no matching method is found.
The pseudo-type \f5ASO_NEXT\fP generates the list of all methods in successive calls:
If type is \f30\fP then \f3data\fP is treated as a \f30\fP-terminated string method name;
\f30\fP is returned if no matching method is found.
The pseudo-type \f3ASO_NEXT\fP generates the list of all methods in successive calls:
.Cs
Asometh_t* meth;
meth = 0;
while (meth = asometh(ASO_NEXT, meth))
/* examine meth->... */
.Ce
Otherwise if \f5type\fP is not \f50\fP and not \f5ASO_NEXT\fP it is treated as a combination of the ordered types
\f5ASO_THREAD\fP, \f5ASO_SIGNAL\fP, \f5ASO_INTRINSIC\fP, \f5ASO_PROCESS\fP:
the first method with \f5(meth->type & type) != 0\fP is returned;
\f50\fP is returned if no matching method is found.
Otherwise if \f3type\fP is not \f30\fP and not \f3ASO_NEXT\fP it is treated as a combination of the ordered types
\f3ASO_THREAD\fP, \f3ASO_SIGNAL\fP, \f3ASO_INTRINSIC\fP, \f3ASO_PROCESS\fP:
the first method with \f3(meth->type & type) != 0\fP is returned;
\f30\fP is returned if no matching method is found.
Method names are treated as a name, optionally followed by a list of
\fB,\fP\fIname\fP=\fIvalue\fP details, and optionally ending with \fB,\fP\fIpathname\fP.
@ -295,25 +295,25 @@ The \fBsemaphore\fP method uses \fBsize\fP=\fInumber\fP to specify
the number of semaphores and hashes \fIpathname\fP to determine the semaphore IPC key.
The \fBfcntl\fP method uses \fBsize\fP=\fInumber\fP to specify
the number of 1 byte file locks and uses \fIpathname\fP as the
file to lock using \f5fcntl(F_SETLCK[W])\fP.
file to lock using \f3fcntl(F_SETLCK[W])\fP.
.Ss " int asoinit(const char* details, Asometh_t* meth, Asodisc_t* disc);"
This function sets the global discipline to \f5disc\fP,
This function sets the global discipline to \f3disc\fP,
closes the current method (releasing its resources),
temporarily instantiates the default method
(either \f5ASO_INTRINSIC\fP if available or \f5AS_SIGNAL\fP otherwise),
and initializes \f5meth\fP and instantiates it as the new method.
If \f5disc\fP is \f50\fP then the global discipline is not modified.
If \f5meth\fP is \f50\fP then \f51\fP is returned if \f5asoinit()\fP has
already been called to initialize a method, otherwise \f50\fP is returned.
If \f5meth->lockf\fP is \f50\fP and \f5(meth->type & ASO_INTRINSIC) != 0\fP
then \f5-1\fP is returned and the current method is not changed.
If an error occurs instantiating \f5meth\fP then the current method is
set to the default and \f5-1\fP is returned.
Otherwise \f50\fP is returned on success.
(either \f3ASO_INTRINSIC\fP if available or \f3AS_SIGNAL\fP otherwise),
and initializes \f3meth\fP and instantiates it as the new method.
If \f3disc\fP is \f30\fP then the global discipline is not modified.
If \f3meth\fP is \f30\fP then \f31\fP is returned if \f3asoinit()\fP has
already been called to initialize a method, otherwise \f30\fP is returned.
If \f3meth->lockf\fP is \f30\fP and \f3(meth->type & ASO_INTRINSIC) != 0\fP
then \f3-1\fP is returned and the current method is not changed.
If an error occurs instantiating \f3meth\fP then the current method is
set to the default and \f3-1\fP is returned.
Otherwise \f30\fP is returned on success.
Method resources are released by the next \f5asometh()\fP call,
or by an \fIASO\fP cleanup function called via \f5atexit\fP(2).
Method resources are released by the next \f3asometh()\fP call,
or by an \fIASO\fP cleanup function called via \f3atexit\fP(2).
System global method resources are released on last use;
this includes removing semaphore keys or
physical files that may be used by some methods.
@ -334,8 +334,8 @@ if (data || !(asometh(0, 0)->type & (ASO_INTRINSIC|ASO_THREAD))) {
}
/* ready for \fIASO\fP operations */
.Ce
A multi-process application would check for \f5(ASO_INTRINSIC|ASO_PROCESS)\fP
instead of \f5(ASO_INTRINSIC|ASO_THREAD)\fP.
A multi-process application would check for \f3(ASO_INTRINSIC|ASO_PROCESS)\fP
instead of \f3(ASO_INTRINSIC|ASO_THREAD)\fP.
.PP
.SH IMPLEMENTATION NOTES
@ -344,13 +344,13 @@ multiple discipline/method handles within a single process, the \fIASO\fP
library allows only one discipline and method to be set at a time, with the additional
restriction that it may only be set by the main and only thread of the calling process.
For this reason there is no open/close interface with an instantiation handle;
instead the global discipline/method is simply initialized by \f5asoinit()\fP.
instead the global discipline/method is simply initialized by \f3asoinit()\fP.
\f5ASO_THREAD\fP and \f5ASO_PROCESS\fP methods rely on the \f5Asometh_t.lockf()\fP
\f3ASO_THREAD\fP and \f3ASO_PROCESS\fP methods rely on the \f3Asometh_t.lockf()\fP
being sufficiently "heavy" to flush the calling thread/process memory cache
so the subsequent \fIASO\fP operation operates on the physical memory location
instead of the cached location. There is currently no other portable mechanism
that guarantees this other than the \f5ASO_INTRINSIC\fP method.
that guarantees this other than the \f3ASO_INTRINSIC\fP method.
.PP
.SH AUTHOR

View file

@ -74,7 +74,7 @@ In this case if
is
.L 0
then
\f5"/"\fP
\f3"/"\fP
is used.
Otherwise if
.I path
@ -92,7 +92,7 @@ If
is
.L 0
then a valid string is always returned;
\f5""\fP
\f3""\fP
is returned if
.I name
has no configuration value.
@ -179,7 +179,7 @@ If
.I path
is
.L 0
then \f5"/"\fP is used where appropriate.
then \f3"/"\fP is used where appropriate.
If
.I flags
is

View file

@ -133,20 +133,20 @@ to the end offset of the \fIi\fP-th parenthesized subexpression.
\fInsub\fP is 1/2 the number of elements in \fIsub\fP.
\fIflags\fP controls the matching:
.Tp
\f5STR_MAXIMAL\fP:
\f3STR_MAXIMAL\fP:
Maximal match.
The default is minimal (first) match.
.Tp
\f5STR_LEFT\fP:
\f3STR_LEFT\fP:
Implicit left anchor.
.Tp
\f5STR_RIGHT\fP:
\f3STR_RIGHT\fP:
Implicit right anchor.
.Tp
\f5STR_ICASE\fP:
\f3STR_ICASE\fP:
Ignore case.
.Tp
\f5STR_GROUP\fP:
\f3STR_GROUP\fP:
(|&) inside [@|*|+{n,m}](...) only.
.Ss "int strmatch(const char* \fIstring\fP, const char* \fIpattern\fP, int* \fIsub\fP, int \fInsub\fP, int \fIflags\fP)"
Equivalent to strgrpmatch(\fIstring\fP,\fIpattern\fP,0,0,STR_MAXIMAL|STR_LEFT|STR_RIGHT).

File diff suppressed because it is too large Load diff

View file

@ -53,7 +53,7 @@ void liberror(const char* \fIlibrary\fP, int \fIlevel\fP, ...);
debug(\fIstatement\fP)
message((int \fIlevel\fP, ...))
libmessage((const char* \fIlibrary\fI, int \fIlevel\fP, ...))
libmessage((const char* \fIlibrary\fP, int \fIlevel\fP, ...))
.EE
.SH DESCRIPTION
.L error

View file

@ -6,7 +6,7 @@
.ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i
.PP
.nf
\f5
\f3
#include <ftwalk.h>
int ftwalk(char* path, int (*userf)(struct FTW* ftw), int options,
@ -226,7 +226,7 @@ preferences specified by
the routine \fIftw\fR provided in System V.
However, it is more general than \fIftw\fR
and suitable for use as a base in implementing
popular tools such as \fIls, find, tar, du,\fR and \fIrm\fR.
popular tools such as \fIls\fR, \fIfind\fR, \fItar\fR, \fIdu\fR, and \fIrm\fR.
\fIFtwalk\fR also handles symbolic links and hard links gracefully.
.SH AUTHORS
Phong Vo, Glenn Fowler, Dave Korn

View file

@ -360,7 +360,7 @@ The basic operations may be qualified by the following
the parenthesized list):
.RS
.TP
.L "HASH_BUCKET (HASH_CREATE,HASH_DELETE,HASH_LOOKUP)"
.L "HASH_BUCKET (HASH_CREATE, HASH_DELETE, HASH_LOOKUP)"
.L name
is a pointer to a bucket that has already been entered into the table.
.TP
@ -379,7 +379,7 @@ is a pointer to a bucket that has not been entered into the table.
.L "HASH_NOSCOPE (HASH_LOOKUP)"
The lookup is restricted to the top level scope.
.TP
.L "HASH_OPAQUE (HASH_CREATE,HASH_DELETE)"
.L "HASH_OPAQUE (HASH_CREATE, HASH_DELETE)"
Sets
.L (HASH_CREATE)
or clears
@ -389,13 +389,13 @@ the
property for the bucket.
An opaque bucket is not visible in lower scopes.
.TP
.L "HASH_SCOPE (HASH_CREATE,HASH_DELETE)"
.L "HASH_SCOPE (HASH_CREATE, HASH_DELETE)"
All scopes are searched for the bucket.
If the bucket is not found for
.L HASH_CREATE
then a new bucket is created in the lowest scope.
.TP
.L "HASH_VALUE (HASH_CREATE,HASH_LOOKUP)"
.L "HASH_VALUE (HASH_CREATE, HASH_LOOKUP)"
For
.L HASH_CREATE
the bucket

View file

@ -38,7 +38,7 @@
..
.TH IP6 3
.SH NAME
ip6 \- IP V6 address support
ip6 \- IPv6 address support
.SH SYNOPSIS
.EX
#include <ip6.h>
@ -49,7 +49,7 @@ int strtoip6(const char* str, char** end, unsigned char* addr, unsigned c
.SH DESCRIPTION
.L fmtip6()
formats the IPV6 address
formats the IPv6 address
.L addr
with optional prefix bits
.L bits
@ -58,9 +58,9 @@ to the formatted value.
.PP
.L strtoip6()
converts a formatted IPV6 address from the 0-terminated string
converts a formatted IPv6 address from the 0-terminated string
.L str
into a host order IPV6 address in
into a host order IPv6 address in
.L addr
which must be a buffer of at least
.L IP6ADDR

View file

@ -63,7 +63,7 @@ command magic file.
.L magicopen
returns a magic session handle that is passed to all of the other routines.
.I flags
may be
may be:
.TP
.L MAGIC_MIME
Return the MIME type string rather than the magic file description.
@ -209,7 +209,7 @@ and
.L }
records have no other fields.
.TP
\fIid\f5{\fR
\fIid\f3{\fR
A function declaration and call for the single character identifier
.IR id .
The function return is a nesting block end record
@ -217,7 +217,7 @@ The function return is a nesting block end record
Function may be redefined.
Functions have no arguments or return value.
.TP
\fIid\f5()\fR
\fIid\f3()\fR
A call to the function
.IR id .
.PP
@ -414,7 +414,7 @@ may be an integral constant or one of the following builtin function calls:
A recursive call to the magic algorithm starting with the data at
.LR offset .
.TP
\f5loop(\fIfunction\fP,\fIoffset\fP,\fIincrement\fP)\fR
\f3loop(\fIfunction\fP, \fIoffset\fP, \fIincrement\fP)\fR
Call
.I function
starting at
@ -446,7 +446,7 @@ then a
.I space
is placed between the descriptions
(most optional descriptions start with
.IR comma .)
.IR comma ).
The data value at
.L offset
can be referenced in the description using

View file

@ -40,6 +40,7 @@
.SH NAME
modecanon \- canonical file mode representation
.SH SYNOPSIS
.EX
#include <modex.h>
int modei(int \fIexternal\fP);
@ -70,7 +71,7 @@ takes an internal mode representation
.I internal
and returns the equivalent external representation.
.PP
The traditional bit access macro (\f5S_\fP prefix changes to \f5X_\fP) are:
The traditional bit access macro (\f3S_\fP prefix changes to \f3X_\fP) are:
.L X_IFMT ,
.L X_IFSOCK ,
.L X_IFLNK ,

View file

@ -117,7 +117,7 @@ is equivalent to
calls
.IR execvp (3)
as
.L "execvp(a\fIrgv\fP[0],\fIargv\fP)"
.L "execvp(a\fIrgv\fP[0], \fIargv\fP)"
with the process preroot set to
.IR dir .
.I argv

View file

@ -122,13 +122,13 @@ and
for the child and parent process context respectively.
Valid operations are:
.TP
\f5PROC_FD_CLOSE(\fIfd\fP,\fIcontext\fP)\fR
\f3PROC_FD_CLOSE(\fIfd\fP, \fIcontext\fP)\fR
The file descriptor
.I fd
is closed in
.IR context .
.TP
\f5PROC_FD_DUP(\fIfrom\fP,\fIto\fP,\fIcontext\fP)\fR
\f3PROC_FD_DUP(\fIfrom\fP, \fIto\fP, \fIcontext\fP)\fR
The file descriptor
.I from
is
@ -138,21 +138,21 @@ into the file descriptor
in
.IR context .
.TP
\f5PROC_SIG_DFL(\fIsig\fP)\fR
\f3PROC_SIG_DFL(\fIsig\fP)\fR
The signal handler for
.I sig
is set to
.L SIG_DFL
in the child context.
.TP
\f5PROC_SIG_IGN(\fIsig\fP)\fR
\f3PROC_SIG_IGN(\fIsig\fP)\fR
The signal handler for
.I sig
is set to
.L SIG_IGN
in the child context.
.TP
\f5PROC_SYS_PGRP(\fIpgid\fP)\fR
\f3PROC_SYS_PGRP(\fIpgid\fP)\fR
The child process group is set to
.IR pgid .
.I pgid
@ -171,7 +171,7 @@ The child process becomes a process group leader.
The child process joins the process group
.IR pgid .
.TP
\f5PROC_SYS_UMASK(\fImask\fP)\fR
\f3PROC_SYS_UMASK(\fImask\fP)\fR
The child process group file creation mask is set to
.IR mask .
.PP

View file

@ -41,69 +41,69 @@ extern int dcdelunion(Sfdisc_t* disc);
.PP
I/O disciplines are used to extend the data processing power of
\fIsfio\fP streams. The convention for using the disciplines
in this package is to use the call \f5dcnewXXX()\fP to create
a discipline of the type \f5XXX\fP and to use \f5dcdelXXX()\fP
in this package is to use the call \f3dcnewXXX()\fP to create
a discipline of the type \f3XXX\fP and to use \f3dcdelXXX()\fP
to destroy it.
A discipline is enable by inserting it into the desired
stream using the \f5sfdisc()\fP call. A discipline can be used on only
stream using the \f3sfdisc()\fP call. A discipline can be used on only
one stream. It is unsafe to share a discipline on two or more streams
since the discipline may maintain states between successive IO calls.
For multiple uses, \f5dcnewXXX()\fP should be used
For multiple uses, \f3dcnewXXX()\fP should be used
to create a distinct discipline for each stream.
Each discipline structure is equipped with an exception handler
that causes self-destruction when the associated stream is closed.
.PP
.Ss " Sfdisc_t* dcnewskable(Sfio_t* f);"
.Ss " int dcdelskable(Sfdisc_t* disc);"
\f5dcnewskable()\fP creates a discipline that when inserted
on the stream \f5f\fP will ensure that \f5f\fP is seekable.
If \f5f\fP is originally unseekable, data will be shadowed
\f3dcnewskable()\fP creates a discipline that when inserted
on the stream \f3f\fP will ensure that \f3f\fP is seekable.
If \f3f\fP is originally unseekable, data will be shadowed
in a temporary file stream to allow seekability.
\f5dcnewskable()\fP returns the discipline on success and \f5NULL\fP on failure.
\f3dcnewskable()\fP returns the discipline on success and \f3NULL\fP on failure.
.Ss " Sfdisc_t* dcnewtee(Sfio_t* tee);"
.Ss " int dcdeltee(Sfdisc_t* disc);"
\f5dcnewtee()\fP creates a discipline that
when inserted into a stream \f5f\fP will duplicate to the stream \f5tee\fP
any data written to \f5f\fP.
\f5dcnewtee()\fP returns the discipline on success and \f5NULL\fP on failure.
\f3dcnewtee()\fP creates a discipline that
when inserted into a stream \f3f\fP will duplicate to the stream \f3tee\fP
any data written to \f3f\fP.
\f3dcnewtee()\fP returns the discipline on success and \f3NULL\fP on failure.
.Ss " Sfdisc_t* dcnewfilter(char* cmd);"
.Ss " int dcdelfilter(Sfdisc_t* disc);"
\f5dcnewfilter()\fP creates a discipline that
when inserted into a stream \f5f\fP will run the command \f5cmd\fP
\f3dcnewfilter()\fP creates a discipline that
when inserted into a stream \f3f\fP will run the command \f3cmd\fP
to process any input data before making it available to the application.
For example, \f5dcnewfilter("uncompress")\fP is an equivalent but slower
For example, \f3dcnewfilter("uncompress")\fP is an equivalent but slower
alternative to the lzw discipline below.
\f5dcnewfilter()\fP returns the discipline on success and \f5NULL\fP on failure.
\f3dcnewfilter()\fP returns the discipline on success and \f3NULL\fP on failure.
.Ss " Sfdisc_t* dcnewsubstream(Sfio_t* base, long offset, long extent);"
.Ss " int dcdelsubstream(Sfdisc_t* disc);"
\f5dcnewsubstream()\fP creates a discipline that
reserves a portion of the stream \f5base\fP starting at \f5offset\fP
with length \f5extent\fP and makes this portion appear as if it is
\f3dcnewsubstream()\fP creates a discipline that
reserves a portion of the stream \f3base\fP starting at \f3offset\fP
with length \f3extent\fP and makes this portion appear as if it is
a stream. When this discipline is inserted into a stream, it will make
cause all IO operations on this stream to take place in the reserved
portion of the \f5base\fP stream.
\f5dcnewsubstream()\fP returns the discipline on success and \f5NULL\fP on failure.
portion of the \f3base\fP stream.
\f3dcnewsubstream()\fP returns the discipline on success and \f3NULL\fP on failure.
.Ss " Sfdisc_t* dcnewlzw(void);
.Ss " int dcdellzw(Sfdisc_t* disc);"
\f5dcnewlzw()\fP creates a discipline that when inserted into
a stream \f5f\fP will run the \fBuncompress\fP algorithm
on input data from \f5f\fP before making it available to the
\f3dcnewlzw()\fP creates a discipline that when inserted into
a stream \f3f\fP will run the \fBuncompress\fP algorithm
on input data from \f3f\fP before making it available to the
application. This is useful to allow applications to process
data from a file packed with the UNIX \fBcompress\fP utility
as if the data is in plain text.
\f5dcnewlzw()\fP returns the discipline on success and \f5NULL\fP on failure.
\f3dcnewlzw()\fP returns the discipline on success and \f3NULL\fP on failure.
.Ss " Sfdisc_t* dcnewunion(Sfio_t** list, int n);
.Ss " int dcdelunion(Sfdisc_t* disc);"
\f5dcnewunion()\fP creates a discipline that concatenates
input data from all \f5n\fP streams in \f5list\fP.
When inserted into a stream \f5f\fP, this discipline will cause
all input operations on \f5f\fP to come from the merged data stream.
\f5dcnewunion()\fP returns the discipline on success and \f5NULL\fP on failure.
\f3dcnewunion()\fP creates a discipline that concatenates
input data from all \f3n\fP streams in \f3list\fP.
When inserted into a stream \f3f\fP, this discipline will cause
all input operations on \f3f\fP to come from the merged data stream.
\f3dcnewunion()\fP returns the discipline on success and \f3NULL\fP on failure.
.SH ACKNOWLEDGMENTS
Dave Korn contributed the substream discipline.

File diff suppressed because it is too large Load diff

View file

@ -40,36 +40,37 @@
.SH NAME
sig \- signal interface routines
.SH SYNOPSIS
.EX
.L "#include <ast.h>"
.L "#include <sig.h>"
.sp
.L "int sigunblock(int sig);"
.L "int sigcritical(int op);"
.SH DESCRIPTION
.L sigunblock
.B sigunblock
is called to
unblocks the signal
.L sig
.B sig
from within a handler currently servicing
.LR sig .
.BR sig .
.PP
.L sigcritical
.B sigcritical
controls a critical region for the
.LR SIGINT ,
.L SIGQUIT
.BR SIGINT ,
.B SIGQUIT
and
.L SIGHUP
.B SIGHUP
signals.
.L "op > 0"
.B "op > 0"
pushes the region,
.L "op == 0"
.B "op == 0"
pops the region, and
.L "op < 0"
.B "op < 0"
returns non-zero if any signals are being held in the current
critical region.
Signal critical regions may be nested.
The current critical region level is returned,
.L \-1
.B \-1
on error.
.SH "SEE ALSO"
signal(2)

View file

@ -44,7 +44,7 @@ spawnveg \- process spawn with process group and session control
.sp
.L "int spawnveg(const char* command, char** argv, char** envv, pid_t pgid);"
.SH DESCRIPTION
.L spwanveg
.L spawnveg
combines
.IR fork (2),
.IR exec (2),
@ -52,6 +52,12 @@ combines
and
.IR setsid (2)
into a single call.
If one of either
.IR posix_spawn (3)
or
.IR vfork (2)
is available, those functions are preferred over
.IR fork .
.PP
.LR command ,
.L argv
@ -75,5 +81,10 @@ The new process becomes a process group leader.
.L >1
The new process joins the process group
.IR pgid .
.SH CAVEATS
The
.L spawnveg
function cannot set the terminal process group.
As a result, it is incompatible with job control when used with terminals.
.SH "SEE ALSO"
fork(2), exec(2), setpgid(2), setsid(2), spawnve(2)

View file

@ -6,7 +6,7 @@
.ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i
.PP
.nf
\f5
\f3
#include <stak.h>
Stak_t *stakcreate(int \fIflags\fP);
@ -29,13 +29,13 @@ char *stakfreeze(unsigned \fIextra\fP);
.fi
.SH DESCRIPTION
.PP
\f5stak\fP is a package of routines designed to provide efficient
\f3stak\fP is a package of routines designed to provide efficient
stack oriented dynamic storage.
A stack abstraction consists of an ordered list of contiguous
memory regions, called stack frames, that can hold objects of
arbitrary size.
A stack is represented by the type \f5Stak_t\fP
defined in header \f5<stak.h>\fP.
A stack is represented by the type \f3Stak_t\fP
defined in header \f3<stak.h>\fP.
At any instant there is one active stack.
Variable size objects can be
added to the active stack
@ -53,36 +53,36 @@ relative offsets ranging from zero to the current offset of the object.
There is a preset initial active stack.
To use an additional stack, it is necessary to create it and to
install it as the active stack.
A stack is created with the \f5stakcreate\fP() function.
A \fIflags\fP argument of \f5STAK_SMALL\fP indicates that unused
A stack is created with the \f3stakcreate\fP() function.
A \fIflags\fP argument of \f3STAK_SMALL\fP indicates that unused
space on the stack should be freed whenever this stack ceases
to be the active stack.
If successful,
\f5stakcreate\fP() returns a pointer to a stack whose reference
\f3stakcreate\fP() returns a pointer to a stack whose reference
count is 1.
Otherwise, \f5stakcreate\fP() returns a null pointer.
The \f5staklink\fP() function increases the reference count for the
Otherwise, \f3stakcreate\fP() returns a null pointer.
The \f3staklink\fP() function increases the reference count for the
given \fIstack\fP and returns the increased count.
The \f5stakinstall\fP() function
The \f3stakinstall\fP() function
makes the specified \fIstack\fP the active stack and returns a pointer
to the previous active stack.
When the \fIoverflow\fP argument is not null,
it specifies a function that will
be called whenever \f5malloc\fP(3) fails while trying to grow the
be called whenever \f3malloc\fP(3) fails while trying to grow the
stack.
The \fIoverflow\fP function will be called with the size that was passed
to \f5malloc\fP(3).
The \fIoverflow\fP function can call \f5exit\fP(3), call \f5longjmp\fP(3)
to \f3malloc\fP(3).
The \fIoverflow\fP function can call \f3exit\fP(3), call \f3longjmp\fP(3)
or return.
If the \f5overflow\fP function returns,
If the \f3overflow\fP function returns,
it must return a pointer to a memory region of the given size.
The default action is to write an error to standard error and to
call \f5exit\fP(2) with a non-zero exit value.
call \f3exit\fP(2) with a non-zero exit value.
When \fIstack\fP is a null pointer,
the active stack is not changed
but the \fIoverflow\fP function for the active stack can be changed
and a pointer to the active stack is returned.
The \f5stakdelete\fP() function decrements the reference count and
The \f3stakdelete\fP() function decrements the reference count and
frees the memory associated with
the specified stack
when the reference count is zero.
@ -90,20 +90,20 @@ The effect of subsequent references to objects
on the stack are undefined.
.PP
The
\f5stakalloc\fP() function returns an aligned pointer to space on the
\f3stakalloc\fP() function returns an aligned pointer to space on the
active stack that can be used to hold any object of the given \fIsize\fP.
\f5stakalloc\fP() is similar to \f5malloc\fP(3) except that individual
items returned by \f5stakalloc\fP() can not be freed.
\f5stakalloc\fP() causes the offset of the current object to be set to
\f3stakalloc\fP() is similar to \f3malloc\fP(3) except that individual
items returned by \f3stakalloc\fP() can not be freed.
\f3stakalloc\fP() causes the offset of the current object to be set to
zero.
.PP
The
\f5stakcopy\fP() function copies the given string onto the stack
\f3stakcopy\fP() function copies the given string onto the stack
and returns a pointer to the \fIstring\fP on the stack.
\f5stakcopy\fP() causes the offset of the current object to be set to
\f3stakcopy\fP() causes the offset of the current object to be set to
zero.
.PP
The \f5stakset\fP() function finds the frame containing the given
The \f3stakset\fP() function finds the frame containing the given
\fIaddress\fP, frees all frames that were created after the one containing
the given \fIaddress\fP, and sets the current object to the given
\fIaddress\fP.
@ -116,39 +116,39 @@ stack, the program aborts and dumps core.
The remaining functions are used to build the current object incrementally.
An object that is built incrementally on the stack will
always occupy contiguous memory within a stack frame but
until \f5stakfreeze\fP() is called,
until \f3stakfreeze\fP() is called,
the location in memory for the object can change.
There is a current offset associated with the current object that
determines where subsequent operations apply.
Initially, this offset is zero, and the offset changes as a result
of the operations you specify.
The \f5stakseek\fP() function is used set the offset for the
The \f3stakseek\fP() function is used set the offset for the
current object.
The \fIoffset\fP argument to \f5stakseek\fP() specifies the new
The \fIoffset\fP argument to \f3stakseek\fP() specifies the new
offset for the current object.
The frame will be extended or moved
if \f5offset\fP causes the new current offset to extend beyond the
if \f3offset\fP causes the new current offset to extend beyond the
current frame.
\f5stakseek\fP() returns a pointer to the beginning of the current object.
The \f5staktell\fP() function gives the offset of the current object.
\f3stakseek\fP() returns a pointer to the beginning of the current object.
The \f3staktell\fP() function gives the offset of the current object.
.PP
The \f5stakputc\fP() function adds a given character to the current object
The \f3stakputc\fP() function adds a given character to the current object
on the stack.
The current offset is advanced by 1.
The \f5stakputs\fP() function appends the given \fIstring\fP onto the current
The \f3stakputs\fP() function appends the given \fIstring\fP onto the current
object in the stack and returns the length of the string.
The current offset is advanced by the length of the string.
The \f5stakwrite\fP() function appends the given \fIsize\fP byte memory
The \f3stakwrite\fP() function appends the given \fIsize\fP byte memory
region starting at \fIaddress\fP onto the current
object in the stack and advances the current offset by \fIsize\fP.
The current offset is returned.
.PP
The \f5stakptr\fP() function converts the given \f5offset\fP
The \f3stakptr\fP() function converts the given \f3offset\fP
for the current object into a memory address on the stack.
This address is only valid until another stack operation is given.
The result is not defined if \fIoffset\fP exceeds the size of the current
object.
The \f5stakfreeze\fP()
The \f3stakfreeze\fP()
function terminates the current object on the
stack and returns a pointer to the beginning of this object.
If \fIextra\fP is non-zero, \fIextra\fP bytes are added to the stack
@ -157,7 +157,7 @@ contain zero and the contents of the remaining bytes are undefined.
.PP
.SH HISTORY
The
\f5stak\fP
\f3stak\fP
interface was derived from similar routines in the KornShell code
that is used for building parse trees and carrying out expansions.
It provides an efficient mechanism for grouping dynamically allocated
@ -165,6 +165,6 @@ objects so that they can be freed all at once rather than individually.
.SH AUTHOR
David Korn
.SH SEE ALSO
\f5exit(2)\fP
\f5longjmp(3)\fP
\f5malloc(3)\fP
\f3exit(2)\fP
\f3longjmp(3)\fP
\f3malloc(3)\fP

View file

@ -6,7 +6,7 @@
.ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i
.PP
.nf
\f5
\f3
#include <stk.h>
Stk_t *stkopen(int \fIflags\fP);
@ -27,17 +27,17 @@ int stkon(Stk *\fIstack\fP, char* \fIaddr\fP)
.fi
.SH DESCRIPTION
.PP
\f5stk\fP is a package of routines designed to provide efficient
\f3stk\fP is a package of routines designed to provide efficient
stack oriented dynamic storage.
A stack abstraction consists of an ordered list of contiguous
memory regions, called stack frames, that can hold objects of
arbitrary size.
A stack is represented by the type \f5Stk_t\fP
defined in header \f5<stk.h>\fP.
The type \f5Stk_t\fP is compatible with the type \f5Sfio_t\fP
defined by the \f5sfio\fP(3) library.
A stack is represented by the type \f3Stk_t\fP
defined in header \f3<stk.h>\fP.
The type \f3Stk_t\fP is compatible with the type \f3Sfio_t\fP
defined by the \f3sfio\fP(3) library.
At any instant there is one active stack which can be referenced
by the constant \f5stkstd\fP.
by the constant \f3stkstd\fP.
Variable size objects can be
added to the active stack
and programs can reference these objects directly with pointers.
@ -54,36 +54,36 @@ relative offsets ranging from zero to the current offset of the object.
There is a preset initial active stack.
To use an additional stack, it is necessary to create it and to
install it as the active stack.
A stack is created with the \f5stkopen\fP() function.
A \fIflags\fP argument of \f5STK_SMALL\fP indicates that unused
A stack is created with the \f3stkopen\fP() function.
A \fIflags\fP argument of \f3STK_SMALL\fP indicates that unused
space on the stack should be freed whenever this stack ceases
to be the active stack.
If successful,
\f5stkopen\fP() returns a pointer to a stack whose reference
\f3stkopen\fP() returns a pointer to a stack whose reference
count is 1.
Otherwise, \f5stkopen\fP() returns a null pointer.
The \f5stklink\fP() function increases the reference count for the
Otherwise, \f3stkopen\fP() returns a null pointer.
The \f3stklink\fP() function increases the reference count for the
given \fIstack\fP and returns the increased count.
The \f5stkinstall\fP() function
The \f3stkinstall\fP() function
makes the specified \fIstack\fP the active stack and returns a pointer
to the previous active stack.
When the \fIoverflow\fP argument is not null,
it specifies a function that will
be called whenever \f5malloc\fP(3) fails while trying to grow the
be called whenever \f3malloc\fP(3) fails while trying to grow the
stack.
The \fIoverflow\fP function will be called with the size that was passed
to \f5malloc\fP(3).
The \fIoverflow\fP function can call \f5exit\fP(3), call \f5longjmp\fP(3)
to \f3malloc\fP(3).
The \fIoverflow\fP function can call \f3exit\fP(3), call \f3longjmp\fP(3)
or return.
If the \f5overflow\fP function returns,
If the \f3overflow\fP function returns,
it must return a pointer to a memory region of the given size.
The default action is to write an error to standard error and to
call \f5exit\fP(2) with a non-zero exit value.
call \f3exit\fP(2) with a non-zero exit value.
When \fIstack\fP is a null pointer,
the active stack is not changed
but the \fIoverflow\fP function for the active stack can be changed
and a pointer to the active stack is returned.
The \f5stkclose\fP() function decrements the reference count and
The \f3stkclose\fP() function decrements the reference count and
frees the memory associated with
the specified stack
when the reference count is zero.
@ -91,20 +91,20 @@ The effect of subsequent references to objects
on the stack are undefined.
.PP
The
\f5stkalloc\fP() function returns an aligned pointer to space on the
\f3stkalloc\fP() function returns an aligned pointer to space on the
active stack that can be used to hold any object of the given \fIsize\fP.
\f5stkalloc\fP() is similar to \f5malloc\fP(3) except that individual
items returned by \f5stkalloc\fP() can not be freed.
\f5stkalloc\fP() causes the offset of the current object to be set to
\f3stkalloc\fP() is similar to \f3malloc\fP(3) except that individual
items returned by \f3stkalloc\fP() can not be freed.
\f3stkalloc\fP() causes the offset of the current object to be set to
zero.
.PP
The
\f5stkcopy\fP() function copies the given string onto the stack
\f3stkcopy\fP() function copies the given string onto the stack
and returns a pointer to the \fIstring\fP on the stack.
\f5stkcopy\fP() causes the offset of the current object to be set to
\f3stkcopy\fP() causes the offset of the current object to be set to
zero.
.PP
The \f5stkset\fP() function finds the frame containing the given
The \f3stkset\fP() function finds the frame containing the given
\fIaddress\fP, frees all frames that were created after the one containing
the given \fIaddress\fP, and sets the current object to the given
\fIaddress\fP.
@ -114,45 +114,45 @@ If \fIaddress\fP is null, the stack is reset to the beginning.
If it is non-null, but is not the address of an object on the
stack, the program aborts and dumps core.
.PP
The \f5sfio\fP(3) output functions can be used to build
The \f3sfio\fP(3) output functions can be used to build
current object incrementally.
An object that is built incrementally on the stack will
always occupy contiguous memory within a stack frame but
until \f5stkfreeze\fP() is called,
until \f3stkfreeze\fP() is called,
the location in memory for the object can change.
There is a current offset associated with the current object that
determines where subsequent operations apply.
Initially, this offset is zero, and the offset changes as a result
of the operations you specify.
The \f5stkseek\fP() function is used set the offset for the
The \f3stkseek\fP() function is used set the offset for the
current object.
The \fIoffset\fP argument to \f5stkseek\fP() specifies the new
The \fIoffset\fP argument to \f3stkseek\fP() specifies the new
offset for the current object.
The frame will be extended or moved
if \f5offset\fP causes the new current offset to extend beyond the
if \f3offset\fP causes the new current offset to extend beyond the
current frame.
\f5stkseek\fP() returns a pointer to the beginning of the current object.
The \f5stktell\fP() function gives the offset of the current object.
\f3stkseek\fP() returns a pointer to the beginning of the current object.
The \f3stktell\fP() function gives the offset of the current object.
.PP
The \f5stkptr\fP() function converts the given \f5offset\fP
The \f3stkptr\fP() function converts the given \f3offset\fP
for the current object into a memory address on the stack.
This address is only valid until another stack operation is given.
The result is not defined if \fIoffset\fP exceeds the size of the current
object.
The \f5stkfreeze\fP()
The \f3stkfreeze\fP()
function terminates the current object on the
stack and returns a pointer to the beginning of this object.
If \fIextra\fP is non-zero, \fIextra\fP bytes are added to the stack
before the current object is terminated. The first added byte will
contain zero and the contents of the remaining bytes are undefined.
.PP
The \f5stkon\fP()
The \f3stkon\fP()
function returns non-zero if the address given by \fIaddr\fP is
on the stack \fIstack\fP and \f50\fP otherwise.
on the stack \fIstack\fP and \f30\fP otherwise.
.PP
.SH HISTORY
The
\f5stk\fP
\f3stk\fP
interface was derived from similar routines in the KornShell code
that is used for building parse trees and carrying out expansions.
It provides an efficient mechanism for grouping dynamically allocated
@ -160,7 +160,7 @@ objects so that they can be freed all at once rather than individually.
.SH AUTHOR
David Korn
.SH SEE ALSO
\f5exit(2)\fP
\f5longjmp(3)\fP
\f5malloc(3)\fP
\f5sfio(3)\fP
\f3exit(2)\fP
\f3longjmp(3)\fP
\f3malloc(3)\fP
\f3sfio(3)\fP

View file

@ -109,7 +109,7 @@ environment variable.
Times are relative to
.B UTC
(universal coordinated time, i.e.,
.BR GMT .)
.BR GMT ).
Otherwise times are relative to the local time zone.
Set by
.L tminit()
@ -232,7 +232,7 @@ may also be preceded by
.B E
for alternate era representation or
.B O
for alternate digit representation (if supported by the current locale.)
for alternate digit representation (if supported by the current locale).
Finally, an integral
.I width
preceding
@ -262,6 +262,9 @@ Full weekday name.
.B b
Abbreviated month name.
.TP
.B B
Full month name.
.TP
.B c
.BR ctime (3)
style date without the trailing
@ -285,26 +288,27 @@ Blank padded day of month number.
Unpadded day of month number.
.TP
.B f
Locale default override date format.
Date as
.IR %Y.%m.%d-%H:%M:%S .
.TP
.B F
Locale default date format
.RL ( tm_info.format[40] .)
ISO 8601:2000 standard date format; equivalent to
.IR %Y-%m-%d .
.TP
.B h
Abbreviated month name.
.TP
.B H
24-hour clock hour.
24-hour clock hour, zero-padded.
.TP
.B i
International
.BR date (1)
date that includes the time zone type name
.RL ( tm_info.format[107] .)
.RL ( tm_info.format[107] ).
.TP
.B I
12-hour clock hour.
12-hour clock hour, zero-padded.
.TP
.B j
1-offset Julian date.
@ -313,9 +317,7 @@ date that includes the time zone type name
0-offset Julian date.
.TP
.B k
.BR date (1)
style date
.RL ( tm_info.format[106] .)
24-hour clock hour, blank-padded.
.TP
.B K
Language neutral, all numeric, no embedded space date
@ -324,12 +326,7 @@ suitable for sorting:
.LR '"%Y-%m-%d+%H:%M:%S"' .
.TP
.B l
.BR ls (1)
.B \-l
date that lists recent dates with
.L %g
and distant dates with
.BR %G .
12-hour clock hour, blank-padded.
.TP
.B m
Month number.
@ -342,16 +339,22 @@ Minutes.
character.
.TP
.B N
The time zone type or nation code.
Nanoseconds 000000000-999999999.
.TP
.B p
Meridian (e.g.,
.B AM
or
.BR PM .)
.BR PM ).
.TP
.B P
Lowercase meridian (e.g.,
.B am
or
.BR pm ).
.TP
.B q
The nanosecond part of the time.
The quarter of the year.
.TP
\fB%Q\fP\fI<delim>recent<delim>distant<delim>\fP
Recent dates are formatted with
@ -406,7 +409,7 @@ Weekday number with 1 for Monday, 7 for Sunday.
Week number with Sunday as the first day.
.TP
.B V
ISO week number (i18n is \fIfun\fP.)
ISO week number (i18n is \fIfun\fP).
.TP
.B w
Weekday number with 0 for Sunday, 6 for Saturday.
@ -425,7 +428,7 @@ Local time style, using
that includes the hours and minutes.
.TP
.B y
2-digit year (you'll be sorry.)
2-digit year (you'll be sorry).
.TP
.B Y
4-digit year.
@ -478,7 +481,7 @@ Equivalent to
.BR %s .
.TP
\fP?\fP\fIalternate\fP
Use
The
.I alternate
format is a default format override has not been specified.
e.g.,
@ -486,7 +489,7 @@ e.g.,
uses
.BR %?%l .
Export
\f5TM_OPTIONS="format='\fP\fIoverride\fP\f5'"\fP
\f3TM_OPTIONS="format='\fP\fIoverride\fP\f3'"\fP
to override the default.
.PD
.RE

View file

@ -229,13 +229,16 @@ Full weekday name.
.B b
Abbreviated month name.
.TP
.B B
Full month name.
.TP
.B c
.IR ctime (3)
.BR ctime (3)
style date without the trailing
.BR newline .
.TP
.B C
.IR date (1)
.BR date (1)
style date.
.TP
.B d
@ -251,19 +254,28 @@ Blank padded day of month number.
.B E
Unpadded day of month number.
.TP
.B f
Date as
.IR %Y.%m.%d-%H:%M:%S .
.TP
.B F
ISO 8601:2000 standard date format; equivalent to
.IR %Y-%m-%d .
.TP
.B h
Abbreviated month name.
.TP
.B H
24-hour clock hour.
24-hour clock hour, zero-padded.
.TP
.B i
International
.IR date (1)
date that includes the time zone type name.
.BR date (1)
date that includes the time zone type name
.RL ( tm_info.format[107] ).
.TP
.B I
12-hour clock hour.
12-hour clock hour, zero-padded.
.TP
.B j
1-offset Julian date.
@ -271,13 +283,17 @@ date that includes the time zone type name.
.B J
0-offset Julian date.
.TP
.B k
24-hour clock hour, blank-padded.
.TP
.B K
Language neutral, all numeric, no embedded space date
with larger to smaller time units from left to right,
suitable for sorting:
.LR '"%Y-%m-%d+%H:%M:%S"' .
.TP
.B l
.IR ls (1)
.B \-l
date that lists recent dates with
.IR hh : mm
and distant dates with
.IR yyyy .
12-hour clock hour, blank-padded.
.TP
.B m
Month number.
@ -289,12 +305,36 @@ Minutes.
.B newline
character.
.TP
.B N
Nanoseconds 000000000-999999999.
.TP
.B p
Meridian (e.g.,
.B AM
or
.BR PM ).
.TP
.B P
Lowercase meridian (e.g.,
.B am
or
.BR pm ).
.TP
.B q
The quarter of the year.
.TP
\fB%Q\fP\fI<delim>recent<delim>distant<delim>\fP
Recent dates are formatted with
.I recent
and distant dates are formatted with
.IR distant ,
where
.I <delim>
is any character not appearing in
.I recent
or
.IR distant .
.TP
.B r
12-hour time as
.IR hh : mm : ss
@ -304,8 +344,22 @@ or
24-hour time as
.IR hh : mm .
.TP
.B s
Seconds since the epoch.
.RI . prec
preceding
.B s
appends
.I prec
nanosecond digits,
.B 9
if
.I prec
is omitted.
.TP
.B S
Seconds.
.I seconds.subseconds
since the epoch.
.TP
.B t
.B tab
@ -315,11 +369,17 @@ character.
24-hour time as
.IR hh : mm : ss .
.TP
.B u
Weekday number with 1 for Monday, 7 for Sunday.
.TP
.B U
Week number with Sunday as the first day.
.TP
.B V
ISO week number (i18n is \fIfun\fP).
.TP
.B w
Weekday number.
Weekday number with 0 for Sunday, 6 for Saturday.
.TP
.B W
Week number with Monday as the first day.
@ -335,37 +395,69 @@ Local time style, using
that includes the hours and minutes.
.TP
.B y
2-digit year.
2-digit year (you'll be sorry).
.TP
.B Y
4-digit year.
.TP
.B z
Time zone type name.
Time zone
.I SHHMM
west of UTC offset where
.I S
is
.B +
or
.BR - .
.TP
.B Z
Time zone name.
.TP
.BI + flag
.TP
.BI \- flag
Temporarily (until
.L tmform()
returns) sets (+) or clears (\-) the
=[=]][-+]]\fIflag\fP
Set (default or +) or clear (-)
.I flag
in
.L tm_info.flags
flags specified by
.IR flag :
for the remainder of
.IR format ,
or for the remainder of the process if
.B ==
is specified.
.I flag
may be:
.RS
.TP
.B l
.L TM_LEAP
.L (TM_LEAP)
Enable leap second adjustments.
.TP
.B s
.L (TM_SUBSECOND)
Append nanosecond
.B .%N
to
.BR %S .
.TP
.B u
.L TM_UTC
.L (TM_UTC)
UTC time zone.
.RE
.TP
.B #
Number of seconds since the epoch.
Equivalent to
.BR %s .
.TP
\fP?\fP\fIalternate\fP
The
.I alternate
format is a default format override has not been specified.
e.g.,
.BR ls (1)
uses
.BR %?%l .
Export
\f3TM_OPTIONS="format='\fP\fIoverride\fP\f3'"\fP
to override the default.
.PD
.RE
.TP
@ -568,6 +660,8 @@ values may get clobbered by the
.I tm
library routines as the
.IR ctime (3)
and
.IR localtime (3)
routines typically return pointers to a single static
.L "struct tm"
area.

View file

@ -155,7 +155,7 @@ argument vector and the maximum number of elements in the vector.
and
.L %v
data may also be counted length strings of the form
\f5(\fIcount\fP:\fIdata\fP)\fR
\f3(\fIcount\fP:\fIdata\fP)\fR
where
.I count
is the number of characters in

View file

@ -120,7 +120,7 @@ and
to modify its arguments on startup.
Its a handy way to override default options on a directory by directory basis
without modify the standard control files
(\f5Makefile\fP in this case.)
(\f3Makefile\fP in this case).
.SH CAVEATS
This paradigm is not recommended for all commands; only a few exceptions
make sense.

View file

@ -1,6 +1,6 @@
.fp 5 CW
.de MW
\f5\\$1\fP
\f3\\$1\fP
..
.TH VMALLOC 3 "1 May 1998"
.SH NAME
@ -75,18 +75,18 @@ for parceling out blocks of storage and a
Automatic locking prevents interference by reentrant
access to a region.
.PP
Pointers to space have type \f5Void_t*\fP
where \f5Void_t\fP is \f5#define\fPd as \f5void\fP if possible, otherwise \f5char\fP.
Space is counted in type \f5size_t\fP.
Pointers to space have type \f3Void_t*\fP
where \f3Void_t\fP is \f3#define\fPd as \f3void\fP if possible, otherwise \f3char\fP.
Space is counted in type \f3size_t\fP.
.ne 4
.SS Regions
Regions have type \f5Vmalloc_t\fP.
Regions have type \f3Vmalloc_t\fP.
Two predefined regions are pointed to by:
.TP
.MW Vmheap
A general-purpose region, with best-fit
allocation, and system memory discipline \f5Vmdcsystem\fP.
allocation, and system memory discipline \f3Vmdcsystem\fP.
.PP
These functions manipulate regions:
.PP
@ -94,7 +94,7 @@ These functions manipulate regions:
creates a region with memory discipline \fIdisc\fP,
allocation method \fImeth\fP,
and a setting for control \fIflags\fP.
It returns a pointer to the region on success and \f5NULL\fP on failure.
It returns a pointer to the region on success and \f3NULL\fP on failure.
The flags, represented by bit values or-ed together, are:
.TP
.MW VM_SHARE
@ -104,7 +104,7 @@ This region may be accessed concurrently by multiple threads or processes.
Place tracing messages for each allocation event
on the tracing file established by \fIvmtrace\fP.
.TP
\f5VM_DBCHECK\fP, \f5VM_DBABORT\fP
\f3VM_DBCHECK\fP, \f3VM_DBABORT\fP
.br
See \fBDebugging\fP below.
.PP
@ -112,7 +112,7 @@ See \fBDebugging\fP below.
closes a \fIregion\fP and releases all associated memory
according to the region's discipline.
The first segment obtained from the discipline's
\f5memoryf\fP function (see `Disciplines' below) will be the last released.
\f3memoryf\fP function (see `Disciplines' below) will be the last released.
\fIvmclose\fP returns \-1 on failure and a non-negative value otherwise.
.PP
.I vmclear
@ -121,7 +121,7 @@ It returns \-1 on failure and a non-negative value otherwise.
.PP
.I vmcompact
releases as much of a \fIregion\fP's
free space to its discipline's \f5memoryf\fP
free space to its discipline's \f3memoryf\fP
function as possible.
It returns a nonnegative value on success and \-1 on failure.
.PP
@ -129,17 +129,17 @@ It returns a nonnegative value on success and \-1 on failure.
adjusts and queries a \fIregion\fP's \fIflags\fP.
The indicated flags are turned on if \fItype\fP is nonzero, off if zero.
\fIvmset\fP returns the previous value of all flags.
Thus, \f5vmset(region,0,0)\fP queries the flags without changing them.
Thus, \f3vmset(region,0,0)\fP queries the flags without changing them.
In addition to the settable flags, one of
\f5VM_MTBEST\fP, \f5VM_MTDEBUG\fP, \f5VM_MTPROFILE\fP,
\f5VM_MTPOOL\fP, or \f5VM_MTLAST\fP
\f3VM_MTBEST\fP, \f3VM_MTDEBUG\fP, \f3VM_MTPROFILE\fP,
\f3VM_MTPOOL\fP, or \f3VM_MTLAST\fP
is returned to indicate the method used in creating the \fIregion\fP.
.PP
.I vmdisc
changes the discipline of \fIregion\fP to the given new discipline
\fIdisc\fP if \fIdisc\fP is not \f5NULL\fP and its \f5memoryf\fP function
\fIdisc\fP if \fIdisc\fP is not \f3NULL\fP and its \f3memoryf\fP function
is the same as the current discipline. If the current discipline
has an \f5exceptf\fP function, it will be called with event \f5VM_DISC\fP.
has an \f3exceptf\fP function, it will be called with event \f3VM_DISC\fP.
This function always returns the current discipline.
.PP
.I vmmopen
@ -173,11 +173,11 @@ to create their own memory allocation regions.
.PP
.I vmmvalue
manages pairs of \fIkey\fP and \fIvalue\fP in a region opened via \fIvmopen()\fP.
If \fIop\fP is \f5VM_MMGET\fP, the value associated with \f5key\fP is returned.
If \fIop\fP is \f5VM_MMSET\fP, the value associated with \f5key\fP will be
If \fIop\fP is \f3VM_MMGET\fP, the value associated with \f3key\fP is returned.
If \fIop\fP is \f3VM_MMSET\fP, the value associated with \f3key\fP will be
set to \fIvalue\fP.
If \fIop\fP is \f5VM_MMADD\fP, the value associated with \f5key\fP will be
treated as a signed long value to which \f5val\fP (also treated as a signed long value)
If \fIop\fP is \f3VM_MMADD\fP, the value associated with \f3key\fP will be
treated as a signed long value to which \f3val\fP (also treated as a signed long value)
will be added.
The call always returns the updated data value associated with \fIkey\fP.
.PP
@ -196,7 +196,7 @@ for dynamically linked libraries, etc.
returns a pointer to a block of the requested \fIsize\fP
in a \fIregion\fP, aligned to the \fIstrictest alignment\fP
that is suitable for the needs of any basic data type.
It returns \f5NULL\fP on failure.
It returns \f3NULL\fP on failure.
.PP
.I vmalign
works like \fIvmalloc\fP, but returns a block aligned to a common
@ -206,27 +206,27 @@ multiple of \fIalign\fP and the \fIstrictest alignment\fP.
attempts to change the length of the block pointed to by
\fIaddr\fP to the specified \fIsize\fP.
If that is impossible and \fItype\fP has
at least one of \f5VM_RSMOVE\fP and \f5VM_RSCOPY\fP,
at least one of \f3VM_RSMOVE\fP and \f3VM_RSCOPY\fP,
a new block is allocated and the old block is freed.
The bit \f5VM_RSCOPY\fP also causes
The bit \f3VM_RSCOPY\fP also causes
the new block to be initialized with
as much of the old contents as will fit.
When a resized block gets larger, the new space will be cleared
if \fItype\fP has the bit \f5VM_RSZERO\fP.
if \fItype\fP has the bit \f3VM_RSZERO\fP.
\fIvmresize\fP
returns a pointer to the final block, or \f5NULL\fP on failure.
If \fIaddr\fP is \f5NULL\fP, \fIvmresize\fP behaves like \fIvmalloc\fP;
returns a pointer to the final block, or \f3NULL\fP on failure.
If \fIaddr\fP is \f3NULL\fP, \fIvmresize\fP behaves like \fIvmalloc\fP;
otherwise, if \fIsize\fP is 0, it behaves like \fIvmfree\fP.
.PP
.I vmfree
makes the currently allocated block pointed to by
\fIaddr\fP available for future allocations in its \fIregion\fP.
If \fIaddr\fP is \f5NULL\fP, \fIvmfree\fP does nothing.
If \fIaddr\fP is \f3NULL\fP, \fIvmfree\fP does nothing.
It returns \-1 on error, and nonnegative otherwise.
.PP
.I vmnewof
is a macro function that attempts to change the length of
the block pointed to by \fIaddr\fP to the size \f5n*sizeof(type)+x\fP.
the block pointed to by \fIaddr\fP to the size \f3n*sizeof(type)+x\fP.
If the block is moved, new space will be initialized with as much of the
old content as will fit.
Additional space will be set to zero.
@ -242,21 +242,21 @@ based on chunks of memory obtained from the heap region \fIVmheap\fP.
This call opens a new region.
.TP
.MW "vmgetmem(region, 0, 0)"
This call closes the given \f5region\fP.
This call closes the given \f3region\fP.
.TP
.MW "vmgetmem(region,0,n)"
This call allocates a block of length \f5n\fP and clears it to zeros.
This call allocates a block of length \f3n\fP and clears it to zeros.
.TP
.MW "vmgetmem(region,p,0)"
This call frees the block \f5p\fP.
This call frees the block \f3p\fP.
.TP
.MW "vmgetmem(region,p,n)"
This call resizes the block \f5p\fP to length \f5n\fP
This call resizes the block \f3p\fP to length \f3n\fP
and clears the new memory to zeros if the block grows.
The block may be moved as deemed necessary by the allocator.
.PP
.SS "Memory disciplines"
Memory disciplines have type \f5Vmdisc_t\fP,
Memory disciplines have type \f3Vmdisc_t\fP,
a structure with these members:
.in +.5i
.nf
@ -270,32 +270,32 @@ a structure with these members:
.TP
.MW round
If this value is positive, all size arguments to the
\f5memoryf\fP function will be multiples of it.
\f3memoryf\fP function will be multiples of it.
.TP
.MW memoryf
Points to a function to get or release segments of space for the
\fIregion\fP.
.TP
.MW exceptf
If this pointer is not \f5NULL\fP,
If this pointer is not \f3NULL\fP,
the function it points to is called to announce
events in a \fIregion\fP.
.PP
There are two standard disciplines, both with \f5round\fP being 0 and \f5exceptf\fP being \f5NULL\fP.
There are two standard disciplines, both with \f3round\fP being 0 and \f3exceptf\fP being \f3NULL\fP.
.TP
.MW Vmdcsystem
A discipline whose \f5memoryf\fP function gets space from the operation system
A discipline whose \f3memoryf\fP function gets space from the operation system
via different available methods which include \fImmap(2)\fP, \fIsbrk(2)\fP and
functions from the WIN32 API.
For historical reason, \fIVmdcsbrk\fP is also available and functions like \fIVmdcsystem\fP.
.TP
.MW Vmdcheap
A discipline whose \f5memoryf\fP function gets space from the region \f5Vmheap\fP.
A region with \f5Vmdcheap\fP discipline and \f5Vmlast\fP
A discipline whose \f3memoryf\fP function gets space from the region \f3Vmheap\fP.
A region with \f3Vmdcheap\fP discipline and \f3Vmlast\fP
allocation is good for building throwaway data structures.
.PP
A \fImemoryf\fP
function returns a pointer to a memory segment on success, and \f5NULL\fP on failure.
function returns a pointer to a memory segment on success, and \f3NULL\fP on failure.
When \fInsz >= 0\fP and \fIcsz > 0\fP,
the function first attempts to change the current segment \fIaddr\fP to fit \fInsz\fP
(for example, \fInsz == 0\fP means deleting the segment \fIaddr\fP).
@ -309,26 +309,26 @@ function is called for events identified by \fItype\fP, which is coded thus:
.TP
.MW VM_OPEN
This event is raised at the start of the process to open a new region.
Argument \fIobj\fP will be a pointer to an object of type \f5Void_t*\fP
Argument \fIobj\fP will be a pointer to an object of type \f3Void_t*\fP
initialized to NULL before the call. The return value of \fIexceptf\fP
is significant as follows:
On a negative return value, \fIvmopen\fP will terminate with failure.
On a zero return value, \fIexceptf\fP may set \f5*((Void_t**)obj)\fP
On a zero return value, \fIexceptf\fP may set \f3*((Void_t**)obj)\fP
to some non-NULL value to tell \fIvmopen\fP
to allocate the region handle itself via \fImemoryf\fP. Otherwise,
the region handle will be allocated from the \f5Vmheap\fP region.
the region handle will be allocated from the \f3Vmheap\fP region.
On a positive return value,
the new region is being reconstructed
based on existing states of some previous region.
In this case, \fIexceptf\fP should set \f5*(Void_t**)\fP\fIobj\fP to point to
the field \f5Vmalloc_t.data\fP of the corresponding previous region
(see \f5VM_CLOSE\fP below).
In this case, \fIexceptf\fP should set \f3*(Void_t**)\fP\fIobj\fP to point to
the field \f3Vmalloc_t.data\fP of the corresponding previous region
(see \f3VM_CLOSE\fP below).
If the handle of the previous region was allocated
via \fImemoryf\fP as discussed above in the case of the zero return value,
then it will be exactly restored. Otherwise, a new handle will be allocated from \f5Vmheap\fP.
then it will be exactly restored. Otherwise, a new handle will be allocated from \f3Vmheap\fP.
The ability to create regions sharing the same states allows for
managing shared and/or persistent memory.
.TP
@ -342,13 +342,13 @@ The return value of \fIexceptf\fP is significant as follows:
On a negative return value, \fIvmclose\fP immediately returns with failure.
On a zero return value, \fIvmclose\fP proceeds normally by calling \f5memoryf\fP to free
On a zero return value, \fIvmclose\fP proceeds normally by calling \f3memoryf\fP to free
all allocated memory segments and also freeing the region itself.
On a positive return value, \fIvmclose\fP will only free the region
without deallocating the associated memory segments. That is,
the field \fIVmalloc_t.data\fP of the region handle remains intact.
This is useful for managing shared and/or persistent memory (see \f5VM_OPEN\fP above).
This is useful for managing shared and/or persistent memory (see \f3VM_OPEN\fP above).
.TP
.MW VM_ENDCLOSE
This event is raised at the end of the process to close a region.
@ -356,7 +356,7 @@ The return value of \fIexceptf\fP will be ignored.
.TP
.MW VM_NOMEM
An attempt to extend the region by the amount
\f5(size_t)\fP\fIobj\fP failed. The region is unlocked, so the
\f3(size_t)\fP\fIobj\fP failed. The region is unlocked, so the
\fIexceptf\fP function may free blocks.
If the function returns a positive value the memory
request will be repeated.
@ -365,7 +365,7 @@ request will be repeated.
The discipline structure is being changed.
.SS "Allocation methods"
Methods are of type \f5Vmethod_t*\fP.
Methods are of type \f3Vmethod_t*\fP.
.TP
.MW Vmbest
An approximately best-fit allocation strategy.
@ -373,7 +373,7 @@ An approximately best-fit allocation strategy.
.MW Vmlast
A strategy for building structures that are only deleted in whole.
Only the latest allocated block can be freed.
This means that as soon as a block \f5a\fP is allocated,
This means that as soon as a block \f3a\fP is allocated,
\fIvmfree\fP calls on blocks other than \c5a\fP are ignored.
.TP
.MW Vmpool
@ -391,15 +391,15 @@ freeing a block twice.
An allocation method that records and prints summaries of memory usage.
.SS Debugging
The method \f5Vmdebug\fP is used to debug common memory violation problems.
The method \f3Vmdebug\fP is used to debug common memory violation problems.
When a problem is found,
a warning message is written to file descriptor 2 (standard error).
In addition, if flag \f5VM_DBABORT\fP is on,
In addition, if flag \f3VM_DBABORT\fP is on,
the program is terminated by calling \fIabort\fP(2).
Each message is a line of self-explanatory fields separated by colons.
The optional flag \f5-DVMFL\fP, if used during compilation,
The optional flag \f3-DVMFL\fP, if used during compilation,
enables recording of file names and line numbers.
The following functions work with method \f5Vmdebug\fP.
The following functions work with method \f3Vmdebug\fP.
.PP
.I vmdebug
resets the file descriptor to write out warnings to the given argument.
@ -407,10 +407,10 @@ By default, this file descriptor is 2, the standard error.
\fIvmdebug\fP returns the previous file descriptor.
.PP
.I vmdbcheck
checks a region using \f5Vmdebug\fP or \f5Vmbest\fP for integrity.
If \f5Vmdebug\fP, this also checks for block overwriting errors.
checks a region using \f3Vmdebug\fP or \f3Vmbest\fP for integrity.
If \f3Vmdebug\fP, this also checks for block overwriting errors.
On errors, \fIvmdbwarn\fP is called.
If flag \f5VM_DBCHECK\fP is on,
If flag \f3VM_DBCHECK\fP is on,
\fIvmdbcheck\fP is called at each invocation of
\fIvmalloc\fP, \fIvmfree\fP, or \fIvmresize\fP.
.PP
@ -420,10 +420,10 @@ to be watched, and reported whenever met in
\fIvmalloc\fP, \fIvmresize\fP or \fIvmfree\fP.
The watch list has finite size and if it becomes full,
watches will be removed in a first-in-first-out fashion.
If \fIaddr\fP is \f5NULL\fP,
If \fIaddr\fP is \f3NULL\fP,
all current watches are canceled.
\fIvmdbwatch\fP returns the watch bumped out due to an insertion
into a full list or \f5NULL\fP otherwise.
into a full list or \f3NULL\fP otherwise.
.PP
.I vmdbwarn
is an internal function that processes
@ -433,17 +433,17 @@ but is a good place to plant debugger traps because
control goes there at every trouble.
.SS "Profiling"
The method \f5Vmprofile\fP is used to profile memory usage.
The method \f3Vmprofile\fP is used to profile memory usage.
Profiling data are maintained in private memory of a process so
\f5Vmprofile\fP should be avoided from regions manipulating
\f3Vmprofile\fP should be avoided from regions manipulating
persistent or shared memory.
The optional flag \f5-DVMFL\fP, if used during compilation,
The optional flag \f3-DVMFL\fP, if used during compilation,
enables recording of file names and line numbers.
.PP
.I vmprofile
prints memory usage summary.
The summary is restricted to region \fIvm\fP if \fIvm\fP is not \f5NULL\fP;
otherwise, it is for all regions created with \f5Vmprofile\fP.
The summary is restricted to region \fIvm\fP if \fIvm\fP is not \f3NULL\fP;
otherwise, it is for all regions created with \f3Vmprofile\fP.
Summary records are written to file descriptor \fIfd\fP as lines with
colon-separated fields. Here are some of the fields:
.TP
@ -468,15 +468,15 @@ A region is busy if some allocation operation is accessing it.
returns the region to which the block pointed to by
\fIaddr\fP belongs.
This works only in regions that allocate with
\f5Vmbest\fP, \f5Vmdebug\fP or \f5Vmprofile\fP.
\f3Vmbest\fP, \f3Vmdebug\fP or \f3Vmprofile\fP.
.PP
.I vmsegment
finds if some segment of memory in \fIregion\fP
contains the address \fIaddr\fP.
It returns the address of a found segment or \f5NULL\fP if none found.
It returns the address of a found segment or \f3NULL\fP if none found.
.PP
.I vmwalk
walks all segments in \fIregion\fP or if \fIregion\fP is \f5NULL\fP,
walks all segments in \fIregion\fP or if \fIregion\fP is \f3NULL\fP,
all segments in all regions.
At each segment, \fI(*walkf)(vm,addr,size,disc)\fP
is called where \fIvm\fP is the region, \fIaddr\fP is the segment,
@ -489,7 +489,7 @@ checks whether \fIaddr\fP
points to an address within some allocated block of the given region.
If not, it returns \-1.
If so, it returns the offset from the beginning of the block.
The function does not work for a \f5Vmlast\fP region except
The function does not work for a \f3Vmlast\fP region except
on the latest allocated block.
.PP
.I vmsize
@ -498,12 +498,12 @@ It returns \-1 if \fIaddr\fP
does not point to a valid block in the region.
Sizes may be padded beyond that requested; in
particular no block has size 0.
The function does not work for a \f5Vmlast\fP region except
The function does not work for a \f3Vmlast\fP region except
on the latest allocated block.
.PP
.I vmstat
gathers statistics on the given \fIregion\fP.
If \f5region\fP is NULL, it computes statistics for the \fIMalloc\fP calls.
If \f3region\fP is NULL, it computes statistics for the \fIMalloc\fP calls.
This may include summing statistics from more than one regions constructed to avoid blocking
due to parallel or asynchronous operations.
If \fIstatb\fP is not NULL, \fIvmstat\fP computes and stores the statistics in \fIstatb\fP then returns 0.
@ -511,27 +511,27 @@ If \fIstatb\fP is NULL, no statistics will be computed and
the returned value is either 1 if the region is busy, i.e.,
being accessed by some allocation call or 0 otherwise.
A \f5Vmstat_t\fP structure has at least these members:
A \f3Vmstat_t\fP structure has at least these members:
.in +.5i
.nf
.ta \w'\f5size_t \fP'u +\w'\f5extent \fP'u
.MW "int n_busy; /* # of busy blocks */
.MW "int n_free; /* # of free blocks */
.MW "size_t s_busy; /* total busy space */
.MW "size_t s_free; /* total free space */
.MW "size_t m_busy; /* maximum busy block size */
.MW "size_t m_free; /* maximum free block size */
.MW "int n_seg; /* count of segments */
.MW "size_t extent; /* memory extent of region */
.ta \w'\f3size_t \fP'u +\w'\f3extent \fP'u
.MW "int n_busy; /* # of busy blocks */
.MW "int n_free; /* # of free blocks */
.MW "size_t s_busy; /* total busy space */
.MW "size_t s_free; /* total free space */
.MW "size_t m_busy; /* maximum busy block size */
.MW "size_t m_free; /* maximum free block size */
.MW "int n_seg; /* count of segments */
.MW "size_t extent; /* memory extent of region */
.MW "int n_region; /* total Malloc regions */
.MW "int n_open; /* non-blocked operations */
.MW "int n_lock; /* blocked operations */
.MW "int n_probe; /* region searches */
.MW "int n_open; /* non-blocked operations */
.MW "int n_lock; /* blocked operations */
.MW "int n_probe; /* region searches */
.fi
.in -.5i
.PP
Bookkeeping overhead is counted in \f5extent\fP,
but not in \f5s_busy\fP or \f5s_free\fP.
Bookkeeping overhead is counted in \f3extent\fP,
but not in \f3s_busy\fP or \f3s_free\fP.
.PP
.I vmtrace
establishes file descriptor \fIfd\fP
@ -539,7 +539,7 @@ as the trace file and returns
the previous value of the trace file descriptor.
The trace descriptor is initially invalid.
Output is sent to the trace file by successful allocation
events when flag \f5VM_TRACE\fP is on.
events when flag \f3VM_TRACE\fP is on.
.PP
Tools for analyzing traces are described in \fImtreplay\fP(1).
The trace record for an allocation event
@ -563,11 +563,11 @@ The address of the affected region.
.TP
.I method
A string that tells the region's method:
\f5best\fP, \f5last\fP, \f5pool\fP, \f5profile\fP, or \f5debug\fP.
\f3best\fP, \f3last\fP, \f3pool\fP, \f3profile\fP, or \f3debug\fP.
.PP
.I vmtrbusy
outputs a trace of all currently busy blocks in region \f5vm\fP.
This only works with the \f5Vmbest\fP, \f5Vmdebug\fP and \f5Vmprofile\fP methods.
outputs a trace of all currently busy blocks in region \f3vm\fP.
This only works with the \f3Vmbest\fP, \f3Vmdebug\fP and \f3Vmprofile\fP methods.
.PP
.I vmdata
returns the core data of the given region.
@ -592,7 +592,7 @@ set the maximum number of these extra regions to \fIregmax\fP.
.PP
These functions are instrumented for run-time debugging, profiling and tracing.
For accurate reporting of files and line numbers,
application code should include \f5vmalloc.h\fP and compile with \f5-DVMFL\fP.
application code should include \f3vmalloc.h\fP and compile with \f3-DVMFL\fP.
The \fBVMALLOC_OPTIONS\fP environment variable, checked once before the first
memory allocation, controls the memory allocation method, debugging and tracing;
its value is a comma or space separated list of
@ -649,7 +649,7 @@ combines the features of these obsolete environment variables:
{ \fBVMCHECK VMDEBUG VMETHOD VMPROFILE VMTRACE\fP }.
.SH RECENT CHANGES
\f5Vmlast\fP: allocated blocks are now allowed to be resized (09/1998).
\f3Vmlast\fP: allocated blocks are now allowed to be resized (09/1998).
.SH SEE ALSO
\fImtreplay\fP(1), \fImalloc\fP(3).

View file

@ -953,7 +953,7 @@ astlicense(char* p, int size, char* file, char* options, int cc1, int cc2, int c
comment(&notice, &buf, NiL, 0, 0);
COMMENT(&notice, &buf, "You should have received a copy of the", 0);
COMMENT(&notice, &buf, "GNU General Public License", 0);
COMMENT(&notice, &buf, "along with this software (see the file COPYING.)", 0);
COMMENT(&notice, &buf, "along with this software (see the file COPYING).", 0);
COMMENT(&notice, &buf, "If not, a copy is available at", 0);
COMMENT(&notice, &buf, "http://www.gnu.org/copyleft/gpl.html", 0);
comment(&notice, &buf, NiL, 0, 0);

View file

@ -201,7 +201,7 @@ large_gam(x)
return (u);
}
/*
* Good to < 1 ulp. (provably .90 ulp; .87 ulp on 1,000,000 runs.)
* Good to < 1 ulp. (Provably .90 ulp; .87 ulp on 1,000,000 runs.)
* It also has correct monotonicity.
*/
static double

View file

@ -82,7 +82,7 @@ extern long int random();
state information will give 7 longs worth of state information, which will
allow a degree seven polynomial. (Note: The zeroeth word of state
information also has some other information stored in it; see setstate
for details). The random number generation technique is a linear feedback
for details.) The random number generation technique is a linear feedback
shift register approach, employing trinomials (since there are fewer terms
to sum up that way). In this approach, the least significant bit of all
the numbers in the state table will act as a linear feedback shift register,
@ -170,7 +170,7 @@ static long int randtbl[DEG_3 + 1] =
pointer. These two pointers are always rand_sep places aparts, as they
cycle through the state information. (Yes, this does mean we could get
away with just one pointer, but the code for random is more efficient
this way). The pointers are left positioned as they would be from the call:
this way.) The pointers are left positioned as they would be from the call:
initstate(1, randtbl, 128);
(The position of the rear pointer, rptr, is really 0 (as explained above
in the initialization of randtbl) because the state table pointer is set