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

Comments & tests for stat_syscall #301

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

pranav-bhatt
Copy link

Description

This PR adds comments and tests for the stat_syscall system call function.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

For the unit tests added, run ``

  • Test A - lind_project/tests/test_cases/test_a.c
  • Test B - lind_project/tests/test_cases/test_b.c

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been added to a pull request and/or merged in other modules (native-client, lind-glibc, lind-project)

Signed-off-by: pranav <pranav.b@cloudera.com>
Copy link
Contributor

@yashaswi2000 yashaswi2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job with the description, add doc strings to helper functions as well, missing unit tests.

src/safeposix/syscalls/fs_calls.rs Show resolved Hide resolved
@@ -1193,6 +1229,8 @@ impl Cage {
statbuf.st_blocks = 0;
}

// helper function to populate information of socket inode object into the
// statbuf
fn _istat_helper_sock(inodeobj: &SocketInode, statbuf: &mut StatData) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

document the helper function aswell

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I have a couple of thoughts here:

  1. The helper functions themselves are pretty straightforward since they are just populating fields
  2. the definitions of each of those fields and the possible values they can take are pretty long and can lead to over-documentation
  3. Adding the definitions of each field is probably out of the scope of the helper functions, and could maybe (but again probably not) be handled in the object definition of the inodes itself instead of here.

A better way here would be to link the man page for inodes. That should provide a better experience for folks and keep things clean IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants