Index: Makefile =================================================================== RCS file: /cvs/src/share/man/man9/Makefile,v retrieving revision 1.289 diff -u -p -r1.289 Makefile --- Makefile 19 Apr 2018 22:46:21 -0000 1.289 +++ Makefile 20 Apr 2018 03:28:38 -0000 @@ -13,16 +13,16 @@ MAN= aml_evalnode.9 atomic_add_int.9 ato cpumem_get.9 crypto.9 \ delay.9 disk.9 disklabel.9 dma_alloc.9 dohooks.9 \ dostartuphooks.9 \ - evcount.9 extent.9 fb_setup.9 file.9 fork1.9 \ - getdevvp.9 getnewvnode.9 hashinit.9 \ + evcount.9 extent.9 fb_setup.9 file.9 fork1.9 ffs.9 \ + getdevvp.9 getnewvnode.9 getsn.9 hashinit.9 \ hardclock.9 hook_establish.9 hz.9 idgen32.9 \ ieee80211.9 ieee80211_crypto.9 ieee80211_input.9 ieee80211_ioctl.9 \ ieee80211_node.9 ieee80211_output.9 ieee80211_proto.9 \ ieee80211_radiotap.9 if_get.9 if_rxr_init.9 ifq_enqueue.9 \ - ifq_deq_begin.9 iic.9 intro.9 inittodr.9 intr_barrier.9 \ - KASSERT.9 kern.9 km_alloc.9 knote.9 kthread.9 ktrace.9 \ + ifq_deq_begin.9 imax.9 iic.9 intro.9 inittodr.9 intr_barrier.9 \ + KASSERT.9 km_alloc.9 knote.9 kthread.9 ktrace.9 \ loadfirmware.9 log.9 \ - malloc.9 membar_sync.9 mbuf.9 mbuf_tags.9 md5.9 mi_switch.9 \ + malloc.9 membar_sync.9 memcmp.9 mbuf.9 mbuf_tags.9 md5.9 mi_switch.9 \ microtime.9 ml_init.9 mq_init.9 mutex.9 \ namei.9 \ panic.9 pci_conf_read.9 pci_intr_map.9 physio.9 pmap.9 \ @@ -33,7 +33,7 @@ MAN= aml_evalnode.9 atomic_add_int.9 ato rtlabel_id2name.9 rtrequest.9 rwlock.9 SRPL_EMPTY_LOCKED.9 SipHash24.9 \ sensor_attach.9 \ spl.9 srp_enter.9 srpl_rc_init.9 startuphook_establish.9 \ - socreate.9 sosplice.9 style.9 syscall.9 sysctl_int.9 \ + socreate.9 sosplice.9 strcmp.9 style.9 syscall.9 sysctl_int.9 \ task_add.9 tc_init.9 tfind.9 thread_fork.9 \ time_second.9 timeout.9 tsleep.9 tvtohz.9 \ uiomove.9 uvm.9 usb_add_task.9 usbd_close_pipe.9 usbd_open_pipe.9 \ Index: ffs.9 =================================================================== RCS file: ffs.9 diff -N ffs.9 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ffs.9 20 Apr 2018 03:28:38 -0000 @@ -0,0 +1,68 @@ +.\" $OpenBSD: kern.9,v 1.24 2018/04/19 22:46:21 dlg Exp $ +.\" +.\" Copyright (c) 2002, 2003 CubeSoft Communications, Inc. +.\" +.\" +.\" 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 AUTHOR ``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 AUTHOR 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 $Mdocdate: April 19 2018 $ +.Dt FFS 9 +.Os +.Sh NAME +.Nm ffs , +.Nm fls , +.Nm flsl +.Nd kernel library find bit routines +.Sh SYNOPSIS +.In lib/libkern/libkern.h +.Ft int +.Fn ffs "int value" +.Ft int +.Fn fls "int value" +.Ft int +.Fn flsl "long value" +.Sh DESCRIPTION +The +.Fn ffs +function finds the first bit set in +.Fa value . +It has the same semantics as it's libc counterpart +.Xr ffs 3 . +.Pp +The +.Fn fls +and +.Fn flsl +functions find the last bit set in +.Fa value +and return the index of that bit. +.Sh SEE ALSO +.Xr ffs 3 +.Sh STANDARDS +The +.Fn ffs +function conforms to +.St -p1003.1-2008 . +.Sh HISTORY +The +.Fn ffs +function is based on a vax instruction of the same name. Index: getsn.9 =================================================================== RCS file: getsn.9 diff -N getsn.9 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ getsn.9 20 Apr 2018 03:28:38 -0000 @@ -0,0 +1,48 @@ +.\" $OpenBSD: kern.9,v 1.24 2018/04/19 22:46:21 dlg Exp $ +.\" +.\" Copyright (c) 2002, 2003 CubeSoft Communications, Inc. +.\" +.\" +.\" 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 AUTHOR ``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 AUTHOR 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 $Mdocdate: April 19 2018 $ +.Dt GETSN 9 +.Os +.Sh NAME +.Nm getsn +.Nd read user input from the console +.Sh SYNOPSIS +.In lib/libkern/libkern.h +.Ft int +.Fn getsn "char *cp" "int size" +.Sh DESCRIPTION +The +.Fn getsn +function reads user input from the console and returns on newline. +The result is written into +.Fa cp , +which is assumed to be +.Fa size +bytes long. +.Sh RETURN VALUES +.Fn getsn +returns the total length of the string it tried to create. Index: imax.9 =================================================================== RCS file: imax.9 diff -N imax.9 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ imax.9 20 Apr 2018 03:28:38 -0000 @@ -0,0 +1,93 @@ +.\" $OpenBSD: kern.9,v 1.24 2018/04/19 22:46:21 dlg Exp $ +.\" +.\" Copyright (c) 2002, 2003 CubeSoft Communications, Inc. +.\" +.\" +.\" 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 AUTHOR ``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 AUTHOR 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 $Mdocdate: April 19 2018 $ +.Dt IMAX 9 +.Os +.Sh NAME +.Nm imax , +.Nm imin , +.Nm lmax , +.Nm lmin , +.Nm max , +.Nm min , +.Nm ulmax , +.Nm ulmin , +.Nm abs , +.Nd kernel library math routines +.Sh SYNOPSIS +.In lib/libkern/libkern.h +.Ft int +.Fn imax "int a" "int b" +.Ft int +.Fn imin "int a" "int b" +.Ft long +.Fn lmax "long a" "long b" +.Ft long +.Fn lmin "long a" "long b" +.Ft u_int +.Fn max "u_int a" "u_int b" +.Ft u_int +.Fn min "u_int a" "u_int b" +.Ft u_long +.Fn ulmax "u_long a" "u_long b" +.Ft u_long +.Fn ulmin "u_long a" "u_long b" +.Ft int +.Fn abs "int j" +.Sh DESCRIPTION +The +.Fn min , +.Fn imin , +.Fn lmin +and +.Fn ulmin +functions return the smallest integer between +.Fa a +and +.Fa b , +inclusive. +The +.Fn max , +.Fn imax , +.Fn lmax +and +.Fn ulmax +functions return the largest integer between +.Fa a +and +.Fa b , +inclusive. +.Pp +The +.Fn abs +function computes the absolute value of integer +.Fa j . +.Sh STANDARDS +The +.Fn abs +function conform to +.St -ansiC . Index: kern.9 =================================================================== RCS file: kern.9 diff -N kern.9 --- kern.9 19 Apr 2018 22:46:21 -0000 1.24 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,242 +0,0 @@ -.\" $OpenBSD: kern.9,v 1.24 2018/04/19 22:46:21 dlg Exp $ -.\" -.\" Copyright (c) 2002, 2003 CubeSoft Communications, Inc. -.\" -.\" -.\" 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 AUTHOR ``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 AUTHOR 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 $Mdocdate: April 19 2018 $ -.Dt IMAX 9 -.Os -.Sh NAME -.Nm imax , -.Nm imin , -.Nm lmax , -.Nm lmin , -.Nm max , -.Nm min , -.Nm ulmax , -.Nm ulmin , -.Nm abs , -.Nm skpc , -.Nm scanc , -.Nm bcmp , -.Nm timingsafe_bcmp , -.Nm memchr , -.Nm memcmp , -.Nm ffs , -.Nm fls , -.Nm flsl , -.Nm strlen , -.Nm strnlen , -.Nm strncpy , -.Nm strlcpy , -.Nm strlcat , -.Nm strcmp , -.Nm strncmp , -.Nm strncasecmp , -.Nm getsn -.Nd kernel library routines -.Sh SYNOPSIS -.In lib/libkern/libkern.h -.Sh DESCRIPTION -The -.Nm -library implements a set of useful functions and macros inside the kernel. -.Sh MATH -.nr nS 1 -.Ft int -.Fn imax "int a" "int b" -.Ft int -.Fn imin "int a" "int b" -.Ft long -.Fn lmax "long a" "long b" -.Ft long -.Fn lmin "long a" "long b" -.Ft u_int -.Fn max "u_int a" "u_int b" -.Ft u_int -.Fn min "u_int a" "u_int b" -.Ft u_long -.Fn ulmax "u_long a" "u_long b" -.Ft u_long -.Fn ulmin "u_long a" "u_long b" -.Ft int -.Fn abs "int j" -.nr nS 0 -.Pp -The -.Fn min , -.Fn imin , -.Fn lmin -and -.Fn ulmin -functions return the smallest integer between -.Fa a -and -.Fa b , -inclusive. -The -.Fn max , -.Fn imax , -.Fn lmax -and -.Fn ulmax -functions return the largest integer between -.Fa a -and -.Fa b , -inclusive. -.Pp -The -.Fn abs -function computes the absolute value of integer -.Fa j . -.Sh BYTE STRINGS -.nr nS 1 -.Ft int -.Fn skpc "int mask" "size_t size" "u_char *cp" -.Ft int -.Fn scanc "u_int size" "const u_char *cp" "const u_char *table" "int mask" -.Ft int -.Fn bcmp "const void *b1" "const void *b2" "size_t len" -.Ft int -.Fn timingsafe_bcmp "const void *b1" "const void *b2" "size_t len" -.Ft void * -.Fn memchr "const void *b" "int c" "size_t len" -.Ft int -.Fn memcmp "const void *b1" "const void *b2" "size_t len" -.Ft int -.Fn ffs "int value" -.Ft int -.Fn fls "int value" -.Ft int -.Fn flsl "long value" -.nr nS 0 -.Pp -The -.Fn skpc -function locates the first unsigned character of value different than -.Fa mask -inside the string -.Fa cp . -.Pp -The -.Fn scanc -function expects a string of indexes into the table -.Fa table . -Each table element is bitwise ANDed against -.Fa mask . -.Pp -.Fn skpc -and -.Fn scanc -expect the string to be of size -.Fa size , -and return the index relative to the end of the string where the match -occurred, or zero if -.Fa mask -is not present in the string. -.Pp -The -.Fn fls -and -.Fn flsl -functions find the last bit set in -.Fa value -and return the index of that bit. -.Pp -The remaining functions have the same semantics as their libc counterparts, -.Xr bcmp 3 , -.Xr timingsafe_bcmp 3 , -.Xr memchr 3 , -.Xr memcmp 3 -and -.Xr ffs 3 . -.Sh CHARACTER STRINGS -.nr nS 1 -.Ft size_t -.Fn strlen "const char *s" -.Ft size_t -.Fn strnlen "const char *s" "size_t maxlen" -.Ft char * -.Fn strncpy "char *dst" "const char *src" "size_t len" -.Ft size_t -.Fn strlcpy "char *dst" "const char *src" "size_t size" -.Ft size_t -.Fn strlcat "char *dst" "const char *src" "size_t size" -.Ft int -.Fn strcmp "const char *s1" "const char *s2" -.Ft int -.Fn strncmp "const char *s1" "const char *s2" "size_t len" -.Ft int -.Fn strncasecmp "const char *s1" "const char *s2" "size_tlen" -.nr nS 0 -.Pp -Those functions have the same semantics as their libc counterparts, -.Xr strlen 3 , -.Xr strncpy 3 , -.Xr strnlen 3 , -.Xr strlcpy 3 , -.Xr strlcat 3 , -.Xr strcmp 3 , -.Xr strncmp 3 -and -.Xr strncasecmp 3 . -.Sh MISCELLANEOUS -.nr nS 1 -.Ft int -.Fn getsn "char *cp" "int size" -.nr nS 0 -.Pp -The -.Fn getsn -function reads user input from the console and returns on newline. -The result is written into -.Fa cp , -which is assumed to be -.Fa size -bytes long. -.Sh SEE ALSO -.Xr bcmp 3 , -.Xr ffs 3 , -.Xr memchr 3 , -.Xr memcmp 3 -.Sh STANDARDS -The -.Fn abs , -.Fn memchr , -.Fn memcmp , -.Fn strlen , -.Fn strncpy , -.Fn strcmp , -.Fn strncmp -and -.Fn strcasecmp -functions conform to -.St -ansiC . -.Sh HISTORY -The -.Fn skpc -and -.Fn scanc -functions are based on vax instructions of the same name. Index: memcmp.9 =================================================================== RCS file: memcmp.9 diff -N memcmp.9 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ memcmp.9 20 Apr 2018 03:28:38 -0000 @@ -0,0 +1,95 @@ +.\" $OpenBSD: kern.9,v 1.24 2018/04/19 22:46:21 dlg Exp $ +.\" +.\" Copyright (c) 2002, 2003 CubeSoft Communications, Inc. +.\" +.\" +.\" 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 AUTHOR ``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 AUTHOR 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 $Mdocdate: April 19 2018 $ +.Dt MEMCMP 9 +.Os +.Sh NAME +.Nm skpc , +.Nm scanc , +.Nm bcmp , +.Nm timingsafe_bcmp , +.Nm memchr , +.Nm memcmp +.Nd kernel library byte string routines +.Sh SYNOPSIS +.In lib/libkern/libkern.h +.Ft int +.Fn skpc "int mask" "size_t size" "u_char *cp" +.Ft int +.Fn scanc "u_int size" "const u_char *cp" "const u_char *table" "int mask" +.Ft int +.Fn bcmp "const void *b1" "const void *b2" "size_t len" +.Ft int +.Fn timingsafe_bcmp "const void *b1" "const void *b2" "size_t len" +.Ft void * +.Fn memchr "const void *b" "int c" "size_t len" +.Ft int +.Fn memcmp "const void *b1" "const void *b2" "size_t len" +.Sh DESCRIPTION +The +.Fn skpc +function locates the first unsigned character of value different than +.Fa mask +inside the string +.Fa cp . +.Pp +The +.Fn scanc +function expects a string of indexes into the table +.Fa table . +Each table element is bitwise ANDed against +.Fa mask . +.Pp +.Fn skpc +and +.Fn scanc +expect the string to be of size +.Fa size , +and return the index relative to the end of the string where the match +occurred, or zero if +.Fa mask +is not present in the string. +.Pp +The remaining functions have the same semantics as their libc counterparts, +.Xr bcmp 3 , +.Xr timingsafe_bcmp 3 , +.Xr memchr 3 , +and +.Xr memcmp 3 . +.Sh STANDARDS +The +.Fn memchr +and +.Fn memcmp +functions conform to +.St -ansiC . +.Sh HISTORY +The +.Fn skpc +and +.Fn scanc +functions are based on vax instructions of the same name. Index: strcmp.9 =================================================================== RCS file: strcmp.9 diff -N strcmp.9 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ strcmp.9 20 Apr 2018 03:28:38 -0000 @@ -0,0 +1,86 @@ +.\" $OpenBSD: kern.9,v 1.24 2018/04/19 22:46:21 dlg Exp $ +.\" +.\" Copyright (c) 2002, 2003 CubeSoft Communications, Inc. +.\" +.\" +.\" 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 AUTHOR ``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 AUTHOR 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 $Mdocdate: April 19 2018 $ +.Dt STRCMP 9 +.Os +.Sh NAME +.Nm strlen , +.Nm strnlen , +.Nm strncpy , +.Nm strlcpy , +.Nm strlcat , +.Nm strcmp , +.Nm strncmp , +.Nm strncasecmp +.Nd kernel library string routines +.Sh SYNOPSIS +.In lib/libkern/libkern.h +.Ft size_t +.Fn strlen "const char *s" +.Ft size_t +.Fn strnlen "const char *s" "size_t maxlen" +.Ft char * +.Fn strncpy "char *dst" "const char *src" "size_t len" +.Ft size_t +.Fn strlcpy "char *dst" "const char *src" "size_t size" +.Ft size_t +.Fn strlcat "char *dst" "const char *src" "size_t size" +.Ft int +.Fn strcmp "const char *s1" "const char *s2" +.Ft int +.Fn strncmp "const char *s1" "const char *s2" "size_t len" +.Ft int +.Fn strncasecmp "const char *s1" "const char *s2" "size_tlen" +.Sh DESCRIPTION +Those functions have the same semantics as their libc counterparts, +.Xr strlen 3 , +.Xr strncpy 3 , +.Xr strnlen 3 , +.Xr strlcpy 3 , +.Xr strlcat 3 , +.Xr strcmp 3 , +.Xr strncmp 3 +and +.Xr strncasecmp 3 . +.Sh SEE ALSO +.Xr strcmp 3 , +.Xr strlcat 3 , +.Xr strlcpy 3 , +.Xr strlen 3 , +.Xr strncmp 3 +.Xr strncpy 3 , +.Xr strnlen 3 +.Sh STANDARDS +The +.Fn strlen , +.Fn strncpy , +.Fn strcmp , +.Fn strncmp +and +.Fn strcasecmp +functions conform to +.St -ansiC .