Skip to content

Fix nasa#484, will check the lseek() return value in linux_sysmon_upd…#485

Open
myc-yang wants to merge 1 commit into
nasa:devfrom
myc-yang:484-return-value-lseek-linux-sysmon
Open

Fix nasa#484, will check the lseek() return value in linux_sysmon_upd…#485
myc-yang wants to merge 1 commit into
nasa:devfrom
myc-yang:484-return-value-lseek-linux-sysmon

Conversation

@myc-yang
Copy link
Copy Markdown

Checklist (Please check before submitting)

Describe the contribution
Fixes #484, will check the lseek() return value in linux_sysmon_update_schedstat() in fsw/modules/linux_sysmon/linux_sysmon.c

Testing performed

Expected behavior changes
When running the linux system monitor, if there is an issue going to the beginning of the /proc/schedstat file, a message will be printed out

System(s) tested on

  • Hardware: PC
  • OS: Ubuntu 18.04
  • Versions: [e.g. cFE 6.6, OSAL 4.2, PSP 1.3 for mcp750, any related apps or tools]

Additional context
Add any other context about the contribution here.

Third party code
If included, identify any third party code and provide text file of license

Contributor Info - All information REQUIRED for consideration of pull request
Michael Yang NASA/GSFC

…ate_schedstat() in fsw/modules/linux_sysmon/linux_sysmon.c
Copy link
Copy Markdown
Contributor

@jphickey jphickey left a comment

Choose a reason for hiding this comment

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

This doesn't seem to add value. If the lseek failed for whatever reason, the later read will fail, and this will end up following the error paths from there.

While I agree that the error checking here could be better, I'm not sure this improves it. As this is linux-specific code, we should at least capture errno and print the message.

Also - as a side note - 0 is the only valid output from this call because it is SEEK_SET. Any nonzero value means it did not seek correctly.

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.

Return value of lseek() in linux_sysmon_update_schedstat() of fsw/modules/linux_sysmon/linux_sysmon.c

3 participants