Re: [PATCH v2 0/1] Call prctl(2) with signed long integers, and avoid casts

Thomas Weißschuh <[email protected]> Wed, 3 Dec 2025 23:12:47 +0100
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
Hi!

On 2025-12-03 22:01:18+0100, Alejandro Colomar wrote:
> On Wed, Dec 03, 2025 at 09:50:27PM +0100, Alejandro Colomar wrote:
> > Karel reminded me of this old patch.  Here's a revision of the patch.
> > Major changes in v2:
> > 
> > -  Don't specify the 5 arguments unnecessarily.
> > 
> > BTW, I've developed a header file that might be useful for the general
> > public.  See in a reply to this mail.
> 
> Here it is.  I think it would be useful to provide this in some libprctl
> library so that everyone can use these, instead of raw prctl(2).  What
> do you think?  We could start by including this header file within
> util-linux, and then consider providing in a separate git repository so
> that distros can package it as a system library.

What about fixing raw prctl(2) in libc to avoid the issues you are
fixing in your original patch? prctl() could be a macro which counts its
passed arguments, dispatching to a set of inline functions which then in
turn call the underlying prctl() with the correct set of parameters.
This would be backwards-compatible and safe.

(...)


Thomas