Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #454, Better error translation on statvfs() #463

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions src/os/rtems/src/os-impl-filesys.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,17 +376,34 @@ int32 OS_FileSysStatVolume_Impl (uint32 filesys_id, OS_statvfs_t *result)
{
OS_filesys_internal_record_t *local = &OS_filesys_table[filesys_id];
struct statvfs stat_buf;
int32 return_code;

if ( statvfs(local->system_mountpt, &stat_buf) != 0 )
{
return OS_ERROR;
/*
* The ENOSYS error means it is not implemented at the system level.
* This should translate to the OS_ERR_NOT_IMPLEMENTED OSAL code.
*/
if (errno == ENOSYS)
{
return_code = OS_ERR_NOT_IMPLEMENTED;
}
else
{
OS_DEBUG("%s: %s\n", local->system_mountpt, strerror(errno));
return_code = OS_ERROR;
}
}
else
{
result->block_size = stat_buf.f_bsize;
result->blocks_free = stat_buf.f_bfree;
result->total_blocks = stat_buf.f_blocks;

result->block_size = stat_buf.f_bsize;
result->blocks_free = stat_buf.f_bfree;
result->total_blocks = stat_buf.f_blocks;
return_code = OS_SUCCESS;
}

return(OS_SUCCESS);
return (return_code);
} /* end OS_FileSysStatVolume_Impl */


Expand Down