From mboxrd@z Thu Jan 1 00:00:00 1970 From: Szabolcs Nagy Subject: Re: glibc and linux-man disagrees about pkey_alloc Date: Wed, 16 May 2018 12:33:37 +0100 Message-ID: References: <20180516111910.GB19883@altlinux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org In-Reply-To: <20180516111910.GB19883@altlinux.org> To: mtk.manpages@gmail.com, linux-man@vger.kernel.org, GNU C Library , Rich Felker Cc: nd@arm.com List-Id: linux-man@vger.kernel.org On 16/05/18 12:19, Dmitry V. Levin wrote: > On Wed, May 16, 2018 at 12:10:40PM +0100, Szabolcs Nagy wrote: >> glibc sysdeps/unix/sysv/linux/bits/mman-shared.h: >> >> int pkey_alloc (unsigned int __flags, unsigned int __access_rights) __THROW; >> >> linux-man http://man7.org/linux/man-pages/man2/pkey_alloc.2.html : >> >> int pkey_alloc(unsigned long flags, unsigned long access_rights); >> >> i assume the documentation should be fixed (as the glibc >> code is already in use) > > Note that pkey_alloc syscall takes arguments of type "unsigned long" > and explicitly tests them for unsupported bits. > > i see, but this is a general bug in the way the syscalls are documented: a syscall is not a c function, so a c declaration is not the right way to document it (the pcs does not even work for syscalls and the linux uapi headers do not provide magic inline wrappers usable from freestanding c code). the libc api is in c so that is reasonable to document using the c language (using c/posix types). so i recommend making the distinction between kernel uapi, syscall abi and libc api clear when they disagree about types. in this case the man says '#include ' which is a libc header, so the declaration has to match whatever is in there otherwise it's misleading.