[pmg-devel] [PATCH] Syscall: add setresuid syscall

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Apr 17 09:05:46 CEST 2019


On 4/16/19 4:23 PM, Stoiko Ivanov wrote:
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
> See `man 2 setresuid`. The code was tested with small UIDs (109) and one which
> does not fit into 16 bit (100000000), since I wasn't too sure about the workings
> of setresuid vs. setresuid32 (see NOTES of the manpage) - it worked with both.
> 
> src/PVE/Syscall.pm | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/PVE/Syscall.pm b/src/PVE/Syscall.pm
> index 0f50c63..a2903b7 100644
> --- a/src/PVE/Syscall.pm
> +++ b/src/PVE/Syscall.pm
> @@ -13,6 +13,7 @@ BEGIN {
>  	close => &SYS_close,
>  	mkdirat => &SYS_mkdirat,
>  	faccessat => &SYS_faccessat,
> +	setresuid => &SYS_setresuid,
>      );
>  };
>  
> 

we normally also add a helper for this in Tools, which gets a prototype
definition, as syscalls are fixed we can safely do this, then you do not
need to use syscall here, have the same interface as others already use
and can capsule the syscall() == 0 there, and handle the call as "common
boolean".

See commit cee0e23ac07c6066aee921ff1ae780b2a21f4b03 in common for an
example addition.



More information about the pmg-devel mailing list