Module Name: src Committed By: jruoho Date: Tue Aug 9 17:58:28 UTC 2011
Modified Files: src/distrib/sets/lists/comp: mi src/share/man/man3: Makefile Added Files: src/share/man/man3: limits.3 Log Message: Add a summary page for <limits.h>. To generate a diff of this commit: cvs rdiff -u -r1.1659 -r1.1660 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.78 -r1.79 src/share/man/man3/Makefile cvs rdiff -u -r0 -r1.1 src/share/man/man3/limits.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.1659 src/distrib/sets/lists/comp/mi:1.1660 --- src/distrib/sets/lists/comp/mi:1.1659 Mon Aug 8 12:08:52 2011 +++ src/distrib/sets/lists/comp/mi Tue Aug 9 17:58:27 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1659 2011/08/08 12:08:52 manu Exp $ +# $NetBSD: mi,v 1.1660 2011/08/09 17:58:27 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -7649,6 +7649,7 @@ ./usr/share/man/cat3/libsaslc.0 comp-c-catman crypto,.cat ./usr/share/man/cat3/libusb.0 comp-obsolete obsolete ./usr/share/man/cat3/libusbhid.0 comp-c-catman .cat +./usr/share/man/cat3/limits.0 comp-c-catman .cat ./usr/share/man/cat3/link_addr.0 comp-c-catman .cat ./usr/share/man/cat3/link_field.0 comp-c-catman .cat ./usr/share/man/cat3/link_fieldtype.0 comp-c-catman .cat @@ -13738,6 +13739,7 @@ ./usr/share/man/html3/libradius.html comp-c-htmlman html ./usr/share/man/html3/libsaslc.html comp-c-htmlman crypto,html ./usr/share/man/html3/libusbhid.html comp-c-htmlman html +./usr/share/man/html3/limits.html comp-c-htmlman html ./usr/share/man/html3/link_addr.html comp-c-htmlman html ./usr/share/man/html3/link_field.html comp-c-htmlman html ./usr/share/man/html3/link_fieldtype.html comp-c-htmlman html @@ -19788,6 +19790,7 @@ ./usr/share/man/man3/libsaslc.3 comp-c-man crypto,.man ./usr/share/man/man3/libusb.3 comp-obsolete obsolete ./usr/share/man/man3/libusbhid.3 comp-c-man .man +./usr/share/man/man3/limits.3 comp-c-man .man ./usr/share/man/man3/link_addr.3 comp-c-man .man ./usr/share/man/man3/link_field.3 comp-c-man .man ./usr/share/man/man3/link_fieldtype.3 comp-c-man .man Index: src/share/man/man3/Makefile diff -u src/share/man/man3/Makefile:1.78 src/share/man/man3/Makefile:1.79 --- src/share/man/man3/Makefile:1.78 Sun Jul 17 20:54:34 2011 +++ src/share/man/man3/Makefile Tue Aug 9 17:58:27 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.78 2011/07/17 20:54:34 joerg Exp $ +# $NetBSD: Makefile,v 1.79 2011/08/09 17:58:27 jruoho Exp $ # @(#)Makefile 8.2 (Berkeley) 12/13/93 MAN= _DIAGASSERT.3 __CONCAT.3 __UNCONST.3 CMSG_DATA.3 \ @@ -9,7 +9,7 @@ assert.3 attribute.3 bitops.3 bits.3 bitstring.3 \ cdefs.3 dirent.3 dlfcn.3 dl_iterate_phdr.3 end.3 \ fast_divide32.3 ffs32.3 gcq.3 \ - ilog2.3 intro.3 inttypes.3 iso646.3 \ + ilog2.3 intro.3 inttypes.3 iso646.3 limits.3 \ makedev.3 offsetof.3 param.3 paths.3 queue.3 rbtree.3 sigevent.3 \ stdarg.3 stdbool.3 stddef.3 stdint.3 stdlib.3 sysexits.3 \ tgmath.3 timeradd.3 timeval.3 tm.3 tree.3 typeof.3 types.3 \ Added files: Index: src/share/man/man3/limits.3 diff -u /dev/null src/share/man/man3/limits.3:1.1 --- /dev/null Tue Aug 9 17:58:28 2011 +++ src/share/man/man3/limits.3 Tue Aug 9 17:58:27 2011 @@ -0,0 +1,171 @@ +.\" $NetBSD: limits.3,v 1.1 2011/08/09 17:58:27 jruoho Exp $ +.\" +.\" Copyright (c) 2011 Jukka Ruohonen <jruoho...@iki.fi> +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Jukka Ruohonen. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd August 9, 2011 +.Os +.Dt LIMITS 3 +.Sh NAME +.Nm limits +.Nd standard limits +.Sh SYNOPSIS +.In limits.h +.Sh DESCRIPTION +The +.In limits.h +header defines various compile-time and runtime limits. +These can be grouped into three categories: +.Bl -enum -offset indent +.It +Compile-time limits defined in a header file. +.It +Runtime system limits that are not associated with a file or directory; see +.Xr sysconf 3 . +.It +Runtime limits that are associated with a file or directory; see +.Xr pathconf 2 . +.El +.Pp +The +.In limits.h +header has been standardized by at least three entities. +.Ss ISO Limits +The limits defined by the +.St -isoC-99 +standard are all compile-time limits. +The numerical (integer) limits are: +.Bl -column -offset indent \ +"Constant " " Type " "either SCHAR_MAX or UCHAR_MAX " +.It Sy "Constant" Ta Sy "Type" Ta Sy " Minimum value" +.It Dv CHAR_BIT Ta Va char Ta " 8" +.It Dv SCHAR_MAX Ta Va signed char Ta " 127" +.It Dv SCHAR_MIN Ta Va signed char Ta "\-127" +.It Dv UCHAR_MAX Ta Va unsigned char Ta " 255" +.Pp +.It Dv INT_MAX Ta Va int Ta " 32767" +.It Dv INT_MIN Ta Va int Ta "\-32767" +.It Dv UINT_MAX Ta Va unsigned int Ta " 65535" +.Pp +.It Dv SHRT_MIN Ta Va short Ta "\-32767" +.It Dv SHRT_MAX Ta Va short Ta " 32767" +.It Dv USHRT_MAX Ta Va unsigned short Ta " 65535" +.Pp +.It Dv LONG_MAX Ta Va long int Ta " 2147483647" +.It Dv LONG_MIN Ta Va long int Ta "\-2147483647" +.It Dv ULONG_MAX Ta Va unsigned long int Ta " 4294967295" +.Pp +.It Dv LLONG_MAX Ta Va long long int Ta " 9223372036854775807" +.It Dv LLONG_MIN Ta Va long long int Ta "\-9223372036854775807" +.It Dv ULLONG_MAX Ta Va unsigned long long int Ta " 18446744073709551615" +.Pp +.It Dv MB_LEN_MAX Ta - Ta 1 +.El +.Pp +All listed limits may vary across machines and operating systems. +The standard guarantees only that the implementation-defined values are +equal or greater in absolute value to those shown. +The values permit a system with 16-bit integers +using one's complement arithmetic. +.Pp +Depending whether the system defines +.Va char +as signed or unsigned, the maximum and minimum values are: +.Bl -column -offset indent \ +"Constant " " Type " "either SCHAR_MAX or UCHAR_MAX " +.It Sy "Constant" Ta Sy "Type" Ta Sy "Minimum value" +.It Dv CHAR_MAX Ta Va char Ta either Dv SCHAR_MAX or Dv UCHAR_MAX +.It Dv CHAR_MIN Ta Va char Ta either Dv SCHAR_MIN or 0 +.El +.Pp +The two special cases, +.Dv CHAR_BIT +and +.Dv MB_LEN_MAX , +define the number of bits in +.Va char +and the maximum number of bytes in a multibyte character constant, +respectively. +.Ss POSIX Limits +The +.Dv POSIX.1 +standard specifies numerous limits related to the operating system. +For each limit, a separate constant prefixed with +.Dq Dv _POSIX_ +defines the +.Em lowest +value that the limit is allowed to have on +.Em any +.Tn POSIX +compliant system. +For instance, +.Dv _POSIX_OPEN_MAX +defines the minimum upper bound permitted by +.Tn POSIX +for the number of files that a single process may have open at any time. +This ensures that a portable program can safely reach these limits without +prior knowledge about the actual limits used in a particular system. +.Pp +As the limits are not necessary invariant, +.Xr pathconf 2 +and +.Xr sysconf 3 +should be used to determine the actual value of a limit at runtime. +The manual pages of these two functions also contain a more detailed +description of the limits available in +.Nx . +.Ss XSI Limits +Also the X/Open System Interface Extension +.Pq Dv XSI +specifies few limits. +In +.Nx +these are limited to +.Dv LONG_BIT +(the number of bits in +.Vt long ) , +.Dv WORD_BIT +(the number of bits in a +.Dq word ) , +and few limits related to +.Vt float +and +.Vt double . +.Sh SEE ALSO +.Xr getconf 1 , +.Xr pathconf 2 , +.Xr sysconf 3 , +.Xr types 3 , +.Xr unistd 3 +.Rs +.%A Richard W. Stevens +.%A Stephen A. Rago +.%B Advanced Programming in the UNIX Environment +.%V Second Edition +.%D 2005 +.%I Addison-Wesley +.Re