/*************************************************************** SYS-FSTAT.C This file contains Linux/i386/ILP32 implementation of __cpu_sys_fstat(). 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-stat-linux.h" __mpu_int64_t __cpu_sys_fstat( int fd, struct __cpu_stat *st ) { struct stat host_st; int error; if( fd < 0 ) return( -(__mpu_int64_t)__MCPU_EBADF ); if( !st ) return( -(__mpu_int64_t)__MCPU_EFAULT ); if( fstat( fd, &host_st ) < 0 ) return( -(__mpu_int64_t)__cpu_errno_from_host( errno ) ); error = __cpu_stat_from_host( st, &host_st ); if( error ) return( -(__mpu_int64_t)error ); return( 0 ); } /* End of __cpu_sys_fstat() */