Module Name:    src
Committed By:   riastradh
Date:           Fri Nov  1 18:42:30 UTC 2024

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/include: strings.h
        src/lib/libc/string: Makefile.inc ffs.3

Log Message:
ffs(3): Fix visibility in strings.h and add MLINKS for ffsl/ffsll.

ffs(3) was added in POSIX 2001 with XSI option (_XOPEN_SOURCE>=600),
not in POSIX 2008 with XSI option (_XOPEN_SOURCE>=700).

Noticed while updating the STANDARDS section of the man page.

PR lib/58802: missing ffsl(), ffsll() functions from POSIX 2024


To generate a diff of this commit:
cvs rdiff -u -r1.2478 -r1.2479 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.19 -r1.20 src/include/strings.h
cvs rdiff -u -r1.91 -r1.92 src/lib/libc/string/Makefile.inc
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/string/ffs.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.2478 src/distrib/sets/lists/comp/mi:1.2479
--- src/distrib/sets/lists/comp/mi:1.2478	Wed Oct 30 18:09:16 2024
+++ src/distrib/sets/lists/comp/mi	Fri Nov  1 18:42:29 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2478 2024/10/30 18:09:16 christos Exp $
+#	$NetBSD: mi,v 1.2479 2024/11/01 18:42:29 riastradh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.comp				comp-sys-root
@@ -7744,6 +7744,8 @@
 ./usr/share/man/cat3/feupdateenv.0		comp-c-catman		.cat
 ./usr/share/man/cat3/fflush.0			comp-c-catman		.cat
 ./usr/share/man/cat3/ffs.0			comp-c-catman		.cat
+./usr/share/man/cat3/ffsl.0			comp-c-catman		.cat
+./usr/share/man/cat3/ffsll.0			comp-c-catman		.cat
 ./usr/share/man/cat3/ffs32.0			comp-c-catman		.cat
 ./usr/share/man/cat3/ffs64.0			comp-c-catman		.cat
 ./usr/share/man/cat3/fgetc.0			comp-c-catman		.cat
@@ -16283,6 +16285,8 @@
 ./usr/share/man/html3/feupdateenv.html		comp-c-htmlman	html
 ./usr/share/man/html3/fflush.html		comp-c-htmlman		html
 ./usr/share/man/html3/ffs.html			comp-c-htmlman		html
+./usr/share/man/html3/ffsl.html			comp-c-htmlman		html
+./usr/share/man/html3/ffsll.html		comp-c-htmlman		html
 ./usr/share/man/html3/ffs32.html		comp-c-htmlman		html
 ./usr/share/man/html3/ffs64.html		comp-c-htmlman		html
 ./usr/share/man/html3/fgetc.html		comp-c-htmlman		html
@@ -24760,6 +24764,8 @@
 ./usr/share/man/man3/feupdateenv.3		comp-c-man		.man
 ./usr/share/man/man3/fflush.3			comp-c-man		.man
 ./usr/share/man/man3/ffs.3			comp-c-man		.man
+./usr/share/man/man3/ffsl.3			comp-c-man		.man
+./usr/share/man/man3/ffsll.3			comp-c-man		.man
 ./usr/share/man/man3/ffs32.3			comp-c-man		.man
 ./usr/share/man/man3/ffs64.3			comp-c-man		.man
 ./usr/share/man/man3/fgetc.3			comp-c-man		.man

Index: src/include/strings.h
diff -u src/include/strings.h:1.19 src/include/strings.h:1.20
--- src/include/strings.h:1.19	Fri Nov  1 18:35:12 2024
+++ src/include/strings.h	Fri Nov  1 18:42:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: strings.h,v 1.19 2024/11/01 18:35:12 riastradh Exp $	*/
+/*	$NetBSD: strings.h,v 1.20 2024/11/01 18:42:30 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@ int	 bcmp(const void *, const void *, si
 void	 bcopy(const void *, void *, size_t);
 void	 bzero(void *, size_t);
 #endif
-#if defined(_NETBSD_SOURCE) || _XOPEN_SOURCE - 0 >= 700
+#if defined(_NETBSD_SOURCE) || _XOPEN_SOURCE - 0 >= 600
 int	 ffs(int) __constfunc;
 #endif
 #if defined(_NETBSD_SOURCE) || _XOPEN_SOURCE - 0 >= 800

Index: src/lib/libc/string/Makefile.inc
diff -u src/lib/libc/string/Makefile.inc:1.91 src/lib/libc/string/Makefile.inc:1.92
--- src/lib/libc/string/Makefile.inc:1.91	Fri Nov  1 18:35:12 2024
+++ src/lib/libc/string/Makefile.inc	Fri Nov  1 18:42:30 2024
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile.inc	8.1 (Berkeley) 6/4/93
-#	$NetBSD: Makefile.inc,v 1.91 2024/11/01 18:35:12 riastradh Exp $
+#	$NetBSD: Makefile.inc,v 1.92 2024/11/01 18:42:30 riastradh Exp $
 
 # string sources
 .PATH: ${ARCHDIR}/string ${.CURDIR}/string
@@ -55,6 +55,8 @@ MAN+=	bm.3 bcmp.3 bcopy.3 bstring.3 bzer
 	swab.3 wcstok.3 wcswidth.3 wmemchr.3 wcsdup.3 wcscasecmp.3
 
 MLINKS+=bm.3 bm_comp.3 bm.3 bm_exec.3 bm.3 bm_free.3
+MLINKS+=ffs.3 ffsl.3
+MLINKS+=ffs.3 ffsll.3
 MLINKS+=popcount.3 popcountl.3
 MLINKS+=popcount.3 popcountll.3
 MLINKS+=popcount.3 popcount32.3

Index: src/lib/libc/string/ffs.3
diff -u src/lib/libc/string/ffs.3:1.13 src/lib/libc/string/ffs.3:1.14
--- src/lib/libc/string/ffs.3:1.13	Wed Apr 28 07:47:09 2010
+++ src/lib/libc/string/ffs.3	Fri Nov  1 18:42:30 2024
@@ -28,13 +28,15 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     from: @(#)ffs.3	8.2 (Berkeley) 4/19/94
-.\"	$NetBSD: ffs.3,v 1.13 2010/04/28 07:47:09 jruoho Exp $
+.\"	$NetBSD: ffs.3,v 1.14 2024/11/01 18:42:30 riastradh Exp $
 .\"
-.Dd April 28, 2010
+.Dd November 1, 2024
 .Dt FFS 3
 .Os
 .Sh NAME
 .Nm ffs
+.Nm ffsl
+.Nm ffsll
 .Nd find first bit set in a bit string
 .Sh LIBRARY
 .Lb libc
@@ -42,24 +44,36 @@
 .In strings.h
 .Ft int
 .Fn ffs "int value"
+.Fn ffsl "long value"
+.Fn ffsll "long long value"
 .Sh DESCRIPTION
 The
-.Fn ffs
-function finds the first bit set in
+.Fn ffs ,
+.Fn ffsl ,
+and
+.Fn ffsll
+functions find the first bit set in
 .Fa value
-and returns the index of that bit.
+and return the index of that bit.
 Bits are numbered starting from 1, starting at the right-most
 bit.
 A return value of 0 means that the argument was zero.
 .Sh SEE ALSO
 .Xr bitstring 3 ,
 .Xr ffs32 3 ,
+.Xr ffs64 3 ,
 .Xr popcount 3
 .Sh STANDARDS
 The
 .Fn ffs
 function conforms to
 .St -p1003.1-2001 .
+The
+.Fn ffsl
+and
+.Fn ffsll
+functions conform to
+.St -p1003.1-2024 .
 .Sh HISTORY
 The
 .Fn ffs

Reply via email to