/*************************************************************** SYS-ACCESS.C This file contains Linux/i386/ILP32 implementation of __cpu_sys_access(). 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 __mpu_int64_t __cpu_sys_access( int dirfd, const char *path, __mpu_uint64_t mode ) { int host_mode = 0; if( !path ) return( -(__mpu_int64_t)__MCPU_EFAULT ); if( mode & ~(__mpu_uint64_t)__CPU_ACCESS_SUPPORTED ) return( -(__mpu_int64_t)__MCPU_EINVAL ); if( mode & __CPU_R_OK ) host_mode |= R_OK; if( mode & __CPU_W_OK ) host_mode |= W_OK; if( mode & __CPU_X_OK ) host_mode |= X_OK; if( faccessat( dirfd, path, host_mode, 0 ) < 0 ) return( -(__mpu_int64_t)__cpu_errno_from_host( errno ) ); return( 0 ); } /* End of __cpu_sys_access() */