question about Glibc extensions

Florian Weimer fweimer@redhat.com
Wed May 20 16:38:30 GMT 2020


* Martin Sebor via Libc-alpha:

> For example, C (and POSIX) requires the first argument to mbstowcs
> to be a valid non-null pointer, but the mbstowcs man page says it
> can be null.  The Glibc manual doesn't mention it.

It's an XSI extension in POSIX:

| [XSI] [Option Start] If pwcs is a null pointer, mbstowcs() shall
| return the length required to convert the entire array regardless of
| the value of n, but no values are stored. [Option End]

> Another example is the POSIX readlink function which is required
> to set errno to EINVAL if (and only if) the path argument names
> a file that is not a symbolic link,

We could probably set the length argument to MIN (INT_MAX, bufsize)
before passing it to the kernel.

> PS Where does material for the Linux man pages that describe Glibc
> specifics come from?

The glibc source code, for the most part.

Thanks,
Florian



More information about the Libc-alpha mailing list