/*************************************************************** SYS-CHOWN.C This file contains Linux/i386/ILP32 implementation of __cpu_sys_chown(). PART OF : CPU - library . USAGE : Internal only . Copyright (C) 2026 by Andrew V.Kosteltsev. All Rights Reserved. ***************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include "cpu-chown-linux.h" __mpu_int64_t __cpu_sys_chown( int dirfd, const char *path, __mpu_uint64_t uid, __mpu_uint64_t gid ) { uid_t host_uid; gid_t host_gid; int error; if( !path ) return( -(__mpu_int64_t)__MCPU_EFAULT ); error = __cpu_uid_to_host( uid, &host_uid ); if( error ) return( -(__mpu_int64_t)error ); error = __cpu_gid_to_host( gid, &host_gid ); if( error ) return( -(__mpu_int64_t)error ); if( fchownat( dirfd, path, host_uid, host_gid, 0 ) < 0 ) return( -(__mpu_int64_t)__cpu_errno_from_host( errno ) ); return( 0 ); } /* End of __cpu_sys_chown() */