Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Rewrite types(5) as per perry@'s suggestion from few years b...



details:   https://anonhg.NetBSD.org/src/rev/7ed156084621
branches:  trunk
changeset: 754153:7ed156084621
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Thu Apr 22 06:48:28 2010 +0000

description:
Rewrite types(5) as per perry@'s suggestion from few years back ("XXX this
document is rather musty. It needs a general update."). Also move it to the
right section from section 5. Ok wiz@.

To minimize maintenance costs, the content is mostly jargon around The
Standard. Only few NetBSD-specific types are mentioned as an example.

diffstat:

 distrib/sets/lists/comp/mi |    5 +-
 distrib/sets/lists/man/mi  |    8 +-
 share/man/man3/Makefile    |    4 +-
 share/man/man3/types.3     |  222 +++++++++++++++++++++++++++++++++++++++++++++
 share/man/man5/Makefile    |    4 +-
 share/man/man5/types.5     |  180 ------------------------------------
 6 files changed, 234 insertions(+), 189 deletions(-)

diffs (truncated from 514 to 300 lines):

diff -r 1aa7b954e092 -r 7ed156084621 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Thu Apr 22 04:42:21 2010 +0000
+++ b/distrib/sets/lists/comp/mi        Thu Apr 22 06:48:28 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.1434 2010/04/21 18:04:38 jruoho Exp $
+#      $NetBSD: mi,v 1.1435 2010/04/22 06:48:28 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -8219,6 +8219,7 @@
 ./usr/share/man/cat3/ttyslot.0                 comp-c-catman           .cat
 ./usr/share/man/cat3/ttyunlock.0               comp-c-catman           .cat
 ./usr/share/man/cat3/twalk.0                   comp-c-catman           .cat
+./usr/share/man/cat3/types.0                   comp-c-catman           .cat
 ./usr/share/man/cat3/tzset.0                   comp-c-catman           .cat
 ./usr/share/man/cat3/tzsetwall.0               comp-c-catman           .cat
 ./usr/share/man/cat3/ualarm.0                  comp-c-catman           .cat
@@ -13946,6 +13947,7 @@
 ./usr/share/man/html3/ttyslot.html             comp-c-htmlman          html
 ./usr/share/man/html3/ttyunlock.html           comp-c-htmlman          html
 ./usr/share/man/html3/twalk.html               comp-c-htmlman          html
+./usr/share/man/html3/types.html               comp-c-htmlman          html
 ./usr/share/man/html3/tzset.html               comp-c-htmlman          html
 ./usr/share/man/html3/tzsetwall.html           comp-c-htmlman          html
 ./usr/share/man/html3/ualarm.html              comp-c-htmlman          html
@@ -19743,6 +19745,7 @@
 ./usr/share/man/man3/ttyslot.3                 comp-c-man              .man
 ./usr/share/man/man3/ttyunlock.3               comp-c-man              .man
 ./usr/share/man/man3/twalk.3                   comp-c-man              .man
+./usr/share/man/man3/types.3                   comp-c-man              .man
 ./usr/share/man/man3/tzset.3                   comp-c-man              .man
 ./usr/share/man/man3/tzsetwall.3               comp-c-man              .man
 ./usr/share/man/man3/ualarm.3                  comp-c-man              .man
diff -r 1aa7b954e092 -r 7ed156084621 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Thu Apr 22 04:42:21 2010 +0000
+++ b/distrib/sets/lists/man/mi Thu Apr 22 06:48:28 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1203 2010/04/10 20:52:14 pooka Exp $
+# $NetBSD: mi,v 1.1204 2010/04/22 06:48:28 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1896,7 +1896,7 @@
 ./usr/share/man/cat5/transport.0               man-postfix-catman      postfix,.cat
 ./usr/share/man/cat5/ttyaction.0               man-sys-catman          .cat
 ./usr/share/man/cat5/ttys.0                    man-sys-catman          .cat
-./usr/share/man/cat5/types.0                   man-c-catman            .cat
+./usr/share/man/cat5/types.0                   man-obsolete            obsolete
 ./usr/share/man/cat5/tzfile.0                  man-sys-catman          .cat
 ./usr/share/man/cat5/ucontext.0                        man-obsolete            obsolete
 ./usr/share/man/cat5/usermgmt.conf.0           man-sys-catman          .cat
@@ -4456,7 +4456,7 @@
 ./usr/share/man/html5/transport.html           man-postfix-htmlman     postfix,html
 ./usr/share/man/html5/ttyaction.html           man-sys-htmlman         html
 ./usr/share/man/html5/ttys.html                        man-sys-htmlman         html
-./usr/share/man/html5/types.html               man-c-htmlman           html
+./usr/share/man/html5/types.html               man-obsolete            obsolete
 ./usr/share/man/html5/tzfile.html              man-sys-htmlman         html
 ./usr/share/man/html5/usermgmt.conf.html       man-sys-htmlman         html
 ./usr/share/man/html5/utmp.html                        man-sys-htmlman         html
@@ -6986,7 +6986,7 @@
 ./usr/share/man/man5/transport.5               man-postfix-man         postfix,.man
 ./usr/share/man/man5/ttyaction.5               man-sys-man             .man
 ./usr/share/man/man5/ttys.5                    man-sys-man             .man
-./usr/share/man/man5/types.5                   man-c-man               .man
+./usr/share/man/man5/types.5                   man-obsolete            obsolete
 ./usr/share/man/man5/tzfile.5                  man-sys-man             .man
 ./usr/share/man/man5/ucontext.5                        man-obsolete            obsolete
 ./usr/share/man/man5/usermgmt.conf.5           man-sys-man             .man
diff -r 1aa7b954e092 -r 7ed156084621 share/man/man3/Makefile
--- a/share/man/man3/Makefile   Thu Apr 22 04:42:21 2010 +0000
+++ b/share/man/man3/Makefile   Thu Apr 22 06:48:28 2010 +0000
@@ -1,11 +1,11 @@
-#      $NetBSD: Makefile,v 1.48 2010/04/21 18:04:38 jruoho Exp $
+#      $NetBSD: Makefile,v 1.49 2010/04/22 06:48:29 jruoho Exp $
 #      @(#)Makefile    8.2 (Berkeley) 12/13/93
 
 MAN=   _DIAGASSERT.3 __CONCAT.3 __UNCONST.3 CMSG_DATA.3 \
        __arraycount.3 assert.3 bits.3 bitstring.3 dlfcn.3 end.3 \
        fast_divide32.3 gcq.3 intro.3 inttypes.3 iso646.3 offsetof.3 queue.3 \
        rb.3 stdarg.3 stdbool.3 stddef.3 stdint.3 stdlib.3 sysexits.3 \
-       tgmath.3 timeradd.3 tree.3 varargs.3
+       tgmath.3 timeradd.3 tree.3 types.3 varargs.3
 
 USETBL=        # used by queue.3
 
diff -r 1aa7b954e092 -r 7ed156084621 share/man/man3/types.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man3/types.3    Thu Apr 22 06:48:28 2010 +0000
@@ -0,0 +1,222 @@
+.\"    $NetBSD: types.3,v 1.1 2010/04/22 06:48:29 jruoho Exp $
+.\"
+.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
+.\" 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.
+.\"
+.\" Copyright (c) 1980, 1991, 1993
+.\"    The Regents of the University of California.  All rights reserved.
+.\"
+.\" 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.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+.\"
+.\"     @(#)types.5    8.1 (Berkeley) 6/5/93
+.\"
+.Dd March 22, 2010
+.Dt TYPES 3
+.Os
+.Sh NAME
+.Nm types
+.Nd standard system data types
+.Sh SYNOPSIS
+.In sys/types.h
+.Sh DESCRIPTION
+The
+.In sys/types.h
+header contains the common data types used in the system.
+Although these are meant to be used within the kernel,
+most of the system data types are accessible also to user code.
+A companion header
+.In sys/param.h ,
+typically used in the kernel,
+includes
+.In sys/types.h
+and provides additional types as well as other facilities.
+.Ss Standard Types
+The following standards-compliant data types are defined:
+.Pp
+.Bl -column -offset indent \
+"suseconds_t " "file system block counts " "clock_settime(3) "
+.It Sy Type Ta Sy Typical use Ta Sy Example
+.It Va blkcnt_t Ta file block counts Ta Xr stat 2
+.It Va blksize_t Ta block sizes Ta Xr stat 2
+.It Va clock_t Ta system clock ticks Ta Xr clock 3
+.It Va clockid_t Ta clock IDs Ta Xr clock_settime 2
+.It Va dev_t Ta device IDs Ta Xr devname 3
+.It Va fsblkcnt_t Ta file system block counts Ta -
+.It Va fsfilcnt_t Ta file system file counts Ta -
+.It Va gid_t Ta group IDs Ta Xr getgid 2
+.It Va id_t Ta general identifier Ta Xr pset 3
+.It Va ino_t Ta file serial numbers Ta Xr fs 5
+.It Va key_t Ta interprocess communication Ta Xr ftok 3
+.It Va mode_t Ta file attributes Ta Xr stat 2
+.It Va nlink_t Ta link counts Ta Xr stat 2
+.It Va off_t Ta file sizes Ta Xr fseek 3
+.It Va pid_t Ta process and group IDs Ta Xr getpid 2
+.It Va size_t Ta size of objects Ta Xr stddef 3
+.It Va ssize_t Ta a count of bytes Ta Xr write 2
+.It Va suseconds_t Ta microseconds Ta Xr gettimeofday 2
+.It Va time_t Ta time in seconds Ta Xr time 3
+.It Va timer_t Ta timer IDs Ta Xr timer_create 2
+.\"
+.\" XXX: Following are undefined in NetBSD at the time of writing:
+.\"
+.\".It Va trace_attr_t Ta trace stream attributes Ta -
+.\".It Va trace_event_id_t Ta trace event type Ta -
+.\".It Va trace_event_set_t Ta trace event type set Ta -
+.\".It Va trace_id_t Ta trace stream ID Ta -
+.It Va uid_t Ta user IDs Ta Xr setuid 2
+.It Va useconds_t Ta time in microseconds Ta Xr usleep 3
+.El
+.Pp
+In addition, when included in user applications,
+.In sys/types.h
+includes
+.In pthread.h ,
+and thus it defines also the types used in the
+.Tn POSIX
+Threads Library,
+.Xr pthread 3 .
+.Pp
+Each described type may vary across machines and operating systems.
+Only the following properties are guaranteed by the
+.St -p1003.1-2001
+standard:
+.Bl -enum -offset indent
+.It
+The type
+.Em ssize_t
+is capable of storing integer values at least in the range [ -1,
+.Dv SSIZE_MAX
+].
+.It
+The type
+.Em useconds_t
+is an unsigned integer capable of storing
+values at least in the range [ 0, 1000000 ].
+.It
+The type
+.Em suseconds_t
+is a signed integer capable of storing
+values at least in the range [ -1, 1000000 ].
+.It
+The
+.Em time_t
+and
+.Em clock_t
+types are either integers or real-floating types.
+.It
+The following types are integers:
+.Em gid_t ,
+.Em id_t ,
+.Em mode_t ,
+.Em nlink_t ,
+and
+.Em uid_t .
+.It
+The following types are signed integers:
+.Em blkcnt_t ,
+.Em blksize_t ,
+.Em off_t ,
+.Em pid_t ,
+and
+.Em ssize_t .
+.It
+The following types are unsigned integers:
+.Em fsblkcnt_t ,
+.Em fsfilcnt_t ,
+.Em ino_t ,
+and
+.Em size_t .
+.El
+.Sh NetBSD-specific Types
+In addition to the standard types, the
+.In sys/types.h
+defines some data types specific to
+.Nx .
+These are mostly used in the kernel.
+A portable implementation should not rely
+on these types to be available in other systems.
+Examples include:
+.Bl -column -offset indent \
+"suseconds_t " "file system block counts " "clock_settime(3) "
+.It Sy Type Ta Sy Typical use Ta Sy Example
+.It Va cpuid_t Ta CPU ID Ta Xr cpuset 3
+.It Va daddr_t Ta disk address Ta Xr buffercache 9
+.It Va devmajor_t Ta major device number Ta Xr getdevmajor 3
+.It Va lwp_t Ta typedef of Va struct lwp Ta Xr kthread 9
+.It Va u_quad_t Ta synonym for Va uint64_t Ta Xr strtouq 3
+.El
+.Pp
+It can be noted that the standard
+.Dq C99 types
+described in
+.Xr stdint 3
+are preferred to the older fixed size integer types prefixed with an
+.Dq u_
+(in another words,
+.Va uint32_t
+should be used instead of
+.Va u_int32_t ) .
+.Sh SEE ALSO
+.Xr stdbool 3 ,
+.Xr stddef 3 ,
+.Xr stdint 3 ,
+.Xr stdlib 3
+.Sh STANDARDS



Home | Main Index | Thread Index | Old Index