* Definition of __USE_MISC?
@ 2017-10-05 6:07 Sebastian Huber
2017-10-05 9:50 ` Florian Weimer
2017-10-05 15:15 ` Zack Weinberg
0 siblings, 2 replies; 9+ messages in thread
From: Sebastian Huber @ 2017-10-05 6:07 UTC (permalink / raw)
To: libc-alpha
Hello,
according to the comment in features.h we have:
__USE_MISC Define things from 4.3BSD or System V Unix.
What about interfaces that are present on newer BSD systems by default,
e.g. we have in glibc strings.h:
/* The following two functions are non-standard but necessary for non-32 bit
platforms. */
# ifdef __USE_GNU
extern int ffsl (long int __l) __THROW __attribute_const__;
__extension__ extern int ffsll (long long int __ll)
__THROW __attribute_const__;
# endif
In FreeBSD strings.h we have:
#if __BSD_VISIBLE
int ffsl(long) __pure2;
int ffsll(long long) __pure2;
int fls(int) __pure2;
int flsl(long) __pure2;
int flsll(long long) __pure2;
#endif
Would it be possible to change the guard in glibc to __USE_MISC?
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Definition of __USE_MISC?
2017-10-05 6:07 Definition of __USE_MISC? Sebastian Huber
@ 2017-10-05 9:50 ` Florian Weimer
2017-10-10 5:41 ` Sebastian Huber
2017-10-05 15:15 ` Zack Weinberg
1 sibling, 1 reply; 9+ messages in thread
From: Florian Weimer @ 2017-10-05 9:50 UTC (permalink / raw)
To: Sebastian Huber, libc-alpha
[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]
On 10/05/2017 08:07 AM, Sebastian Huber wrote:
> Hello,
>
> according to the comment in features.h we have:
>
> __USE_MISCÂ Â Â Â Â Â Define things from 4.3BSD or System V Unix.
>
> What about interfaces that are present on newer BSD systems by default,
> e.g. we have in glibc strings.h:
>
> /* The following two functions are non-standard but necessary for non-32
> bit
>   platforms. */
> # ifdef   __USE_GNU
> extern int ffsl (long int __l) __THROW __attribute_const__;
> __extension__ extern int ffsll (long long int __ll)
> Â Â Â Â __THROW __attribute_const__;
> # endif
>
> In FreeBSD strings.h we have:
>
> #if __BSD_VISIBLE
> int    ffsl(long) __pure2;
> int    ffsll(long long) __pure2;
> int    fls(int) __pure2;
> int    flsl(long) __pure2;
> int    flsll(long long) __pure2;
> #endif
>
> Would it be possible to change the guard in glibc to __USE_MISC?
Yes, it should be a simple change. I was worried about the long long
part initially, but we have precedent for using long long under
__USE_MISC (strtouq in <stdlib.h>).
Patch attached.
Thanks,
Florian
[-- Attachment #2: ffsl.patch --]
[-- Type: text/x-patch, Size: 669 bytes --]
Recent BSDs declare these functions, too.
2017-10-05 Florian Weimer <fweimer@redhat.com>
* string/strings.h (ffsl, ffsll): Declare under __USE_MISC, not
just __USE_GNU.
diff --git a/string/strings.h b/string/strings.h
index 630b3adc23..27508e31b8 100644
--- a/string/strings.h
+++ b/string/strings.h
@@ -106,7 +106,7 @@ extern int ffs (int __i) __THROW __attribute_const__;
/* The following two functions are non-standard but necessary for non-32 bit
platforms. */
-# ifdef __USE_GNU
+# ifdef __USE_MISC
extern int ffsl (long int __l) __THROW __attribute_const__;
__extension__ extern int ffsll (long long int __ll)
__THROW __attribute_const__;
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Definition of __USE_MISC?
2017-10-05 6:07 Definition of __USE_MISC? Sebastian Huber
2017-10-05 9:50 ` Florian Weimer
@ 2017-10-05 15:15 ` Zack Weinberg
2017-10-05 15:52 ` Joseph Myers
1 sibling, 1 reply; 9+ messages in thread
From: Zack Weinberg @ 2017-10-05 15:15 UTC (permalink / raw)
To: Sebastian Huber; +Cc: GNU C Library
On Thu, Oct 5, 2017 at 2:07 AM, Sebastian Huber
<sebastian.huber@embedded-brains.de> wrote:
> according to the comment in features.h we have:
>
> __USE_MISC Define things from 4.3BSD or System V Unix.
This was the historic definition, but I believe nowadays __USE_MISC is
just "anything that's not part of an official standard but that we
want to support and make visible by default." We don't have a
formalized way of deciding whether something belongs under __USE_MISC
or __USE_GNU, but "this is visible by default on other POSIXy
operating systems" is certainly a strong argument for __USE_MISC.
zw
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Definition of __USE_MISC?
2017-10-05 15:15 ` Zack Weinberg
@ 2017-10-05 15:52 ` Joseph Myers
0 siblings, 0 replies; 9+ messages in thread
From: Joseph Myers @ 2017-10-05 15:52 UTC (permalink / raw)
To: Zack Weinberg; +Cc: Sebastian Huber, GNU C Library
On Thu, 5 Oct 2017, Zack Weinberg wrote:
> On Thu, Oct 5, 2017 at 2:07 AM, Sebastian Huber
> <sebastian.huber@embedded-brains.de> wrote:
> > according to the comment in features.h we have:
> >
> > __USE_MISC Define things from 4.3BSD or System V Unix.
>
> This was the historic definition, but I believe nowadays __USE_MISC is
> just "anything that's not part of an official standard but that we
> want to support and make visible by default." We don't have a
> formalized way of deciding whether something belongs under __USE_MISC
> or __USE_GNU, but "this is visible by default on other POSIXy
> operating systems" is certainly a strong argument for __USE_MISC.
Indeed - and, many things that are present in __USE_MISC because of the
historical definition may by now be candidates for obsoletion, if there is
now a much more widely used standard interface for doing the same thing.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Definition of __USE_MISC?
2017-10-05 9:50 ` Florian Weimer
@ 2017-10-10 5:41 ` Sebastian Huber
2017-10-17 12:01 ` Florian Weimer
0 siblings, 1 reply; 9+ messages in thread
From: Sebastian Huber @ 2017-10-10 5:41 UTC (permalink / raw)
To: Florian Weimer, libc-alpha
On 05/10/17 11:50, Florian Weimer wrote:
> On 10/05/2017 08:07 AM, Sebastian Huber wrote:
>> Hello,
>>
>> according to the comment in features.h we have:
>>
>> __USE_MISC Define things from 4.3BSD or System V Unix.
>>
>> What about interfaces that are present on newer BSD systems by
>> default, e.g. we have in glibc strings.h:
>>
>> /* The following two functions are non-standard but necessary for
>> non-32 bit
>> platforms. */
>> # ifdef __USE_GNU
>> extern int ffsl (long int __l) __THROW __attribute_const__;
>> __extension__ extern int ffsll (long long int __ll)
>> __THROW __attribute_const__;
>> # endif
>>
>> In FreeBSD strings.h we have:
>>
>> #if __BSD_VISIBLE
>> int ffsl(long) __pure2;
>> int ffsll(long long) __pure2;
>> int fls(int) __pure2;
>> int flsl(long) __pure2;
>> int flsll(long long) __pure2;
>> #endif
>>
>> Would it be possible to change the guard in glibc to __USE_MISC?
>
> Yes, it should be a simple change. I was worried about the long long
> part initially, but we have precedent for using long long under
> __USE_MISC (strtouq in <stdlib.h>).
>
> Patch attached.
What are the opinions with respect to this patch? The ffsl() and ffsll()
are BSD visible in FreeBSD, DragonFlyBSD, some Mac OS X and musl. They
are not available in OpenBSD and NetBSD.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Definition of __USE_MISC?
2017-10-10 5:41 ` Sebastian Huber
@ 2017-10-17 12:01 ` Florian Weimer
2017-10-26 8:56 ` Sebastian Huber
0 siblings, 1 reply; 9+ messages in thread
From: Florian Weimer @ 2017-10-17 12:01 UTC (permalink / raw)
To: Sebastian Huber, libc-alpha
On 10/10/2017 07:41 AM, Sebastian Huber wrote:
> On 05/10/17 11:50, Florian Weimer wrote:
>
>> On 10/05/2017 08:07 AM, Sebastian Huber wrote:
>>> Hello,
>>>
>>> according to the comment in features.h we have:
>>>
>>> __USE_MISCÂ Â Â Â Â Â Define things from 4.3BSD or System V Unix.
>>>
>>> What about interfaces that are present on newer BSD systems by
>>> default, e.g. we have in glibc strings.h:
>>>
>>> /* The following two functions are non-standard but necessary for
>>> non-32 bit
>>>    platforms. */
>>> # ifdef   __USE_GNU
>>> extern int ffsl (long int __l) __THROW __attribute_const__;
>>> __extension__ extern int ffsll (long long int __ll)
>>> Â Â Â Â Â __THROW __attribute_const__;
>>> # endif
>>>
>>> In FreeBSD strings.h we have:
>>>
>>> #if __BSD_VISIBLE
>>> int    ffsl(long) __pure2;
>>> int    ffsll(long long) __pure2;
>>> int    fls(int) __pure2;
>>> int    flsl(long) __pure2;
>>> int    flsll(long long) __pure2;
>>> #endif
>>>
>>> Would it be possible to change the guard in glibc to __USE_MISC?
>>
>> Yes, it should be a simple change. I was worried about the long long
>> part initially, but we have precedent for using long long under
>> __USE_MISC (strtouq in <stdlib.h>).
>>
>> Patch attached.
>
> What are the opinions with respect to this patch? The ffsl() and ffsll()
> are BSD visible in FreeBSD, DragonFlyBSD, some Mac OS X and musl. They
> are not available in OpenBSD and NetBSD.
Unless there are objects, I'm going to check this in later this week.
Thanks,
Florian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Definition of __USE_MISC?
2017-10-17 12:01 ` Florian Weimer
@ 2017-10-26 8:56 ` Sebastian Huber
2017-10-30 13:02 ` Florian Weimer
0 siblings, 1 reply; 9+ messages in thread
From: Sebastian Huber @ 2017-10-26 8:56 UTC (permalink / raw)
To: Florian Weimer, libc-alpha
On 17/10/17 14:01, Florian Weimer wrote:
>>>>
>>>> Would it be possible to change the guard in glibc to __USE_MISC?
>>>
>>> Yes, it should be a simple change. I was worried about the long
>>> long part initially, but we have precedent for using long long under
>>> __USE_MISC (strtouq in <stdlib.h>).
>>>
>>> Patch attached.
>>
>> What are the opinions with respect to this patch? The ffsl() and
>> ffsll() are BSD visible in FreeBSD, DragonFlyBSD, some Mac OS X and
>> musl. They are not available in OpenBSD and NetBSD.
>
> Unless there are objects, I'm going to check this in later this week.
I think there were no objections.
Which documentation parts need an update? Only the man page in
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/man3/ffs.3
?
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Definition of __USE_MISC?
2017-10-26 8:56 ` Sebastian Huber
@ 2017-10-30 13:02 ` Florian Weimer
2017-11-02 7:24 ` Michael Kerrisk
0 siblings, 1 reply; 9+ messages in thread
From: Florian Weimer @ 2017-10-30 13:02 UTC (permalink / raw)
To: Sebastian Huber; +Cc: libc-alpha
On 10/26/2017 10:55 AM, Sebastian Huber wrote:
> On 17/10/17 14:01, Florian Weimer wrote:
>>>>>
>>>>> Would it be possible to change the guard in glibc to __USE_MISC?
>>>>
>>>> Yes, it should be a simple change. I was worried about the long
>>>> long part initially, but we have precedent for using long long under
>>>> __USE_MISC (strtouq in <stdlib.h>).
>>>>
>>>> Patch attached.
>>>
>>> What are the opinions with respect to this patch? The ffsl() and
>>> ffsll() are BSD visible in FreeBSD, DragonFlyBSD, some Mac OS X and
>>> musl. They are not available in OpenBSD and NetBSD.
>>
>> Unless there are objects, I'm going to check this in later this week.
>
> I think there were no objections.
Thanks for the reminder. I have now pushed the change.
> Which documentation parts need an update? Only the man page in
>
> https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/man3/ffs.3
>
> ?
Yes, the GNU manual does not document ffsl/ffsll at all, so no update is
needed. Will you contact Michael about the change?
Thanks,
Florian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Definition of __USE_MISC?
2017-10-30 13:02 ` Florian Weimer
@ 2017-11-02 7:24 ` Michael Kerrisk
0 siblings, 0 replies; 9+ messages in thread
From: Michael Kerrisk @ 2017-11-02 7:24 UTC (permalink / raw)
To: Florian Weimer; +Cc: Sebastian Huber, libc-alpha, Michael Kerrisk-manpages
On Mon, Oct 30, 2017 at 2:01 PM, Florian Weimer <fweimer@redhat.com> wrote:
> On 10/26/2017 10:55 AM, Sebastian Huber wrote:
>>
>> On 17/10/17 14:01, Florian Weimer wrote:
>>>>>>
>>>>>>
>>>>>> Would it be possible to change the guard in glibc to __USE_MISC?
>>>>>
>>>>>
>>>>> Yes, it should be a simple change. I was worried about the long long
>>>>> part initially, but we have precedent for using long long under __USE_MISC
>>>>> (strtouq in <stdlib.h>).
>>>>>
>>>>> Patch attached.
>>>>
>>>>
>>>> What are the opinions with respect to this patch? The ffsl() and ffsll()
>>>> are BSD visible in FreeBSD, DragonFlyBSD, some Mac OS X and musl. They are
>>>> not available in OpenBSD and NetBSD.
>>>
>>>
>>> Unless there are objects, I'm going to check this in later this week.
>>
>>
>> I think there were no objections.
>
>
> Thanks for the reminder. I have now pushed the change.
>
>> Which documentation parts need an update? Only the man page in
>>
>>
>> https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/man3/ffs.3
>>
>> ?
>
>
> Yes, the GNU manual does not document ffsl/ffsll at all, so no update is
> needed. Will you contact Michael about the change?
No need (but thanks for thinking of it). I've just now updated the FTM
requirements in the man page to say:
ffsl(), ffsll():
Since glibc 2.27:
_DEFAULT_SOURCE
Before glibc 2.27:
_GNU_SOURCE
Cheers,
Michael
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-11-02 7:24 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05 6:07 Definition of __USE_MISC? Sebastian Huber
2017-10-05 9:50 ` Florian Weimer
2017-10-10 5:41 ` Sebastian Huber
2017-10-17 12:01 ` Florian Weimer
2017-10-26 8:56 ` Sebastian Huber
2017-10-30 13:02 ` Florian Weimer
2017-11-02 7:24 ` Michael Kerrisk
2017-10-05 15:15 ` Zack Weinberg
2017-10-05 15:52 ` Joseph Myers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).