Modify some calls to allow for FIFO support #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey Dave,
We've been looking to use FIFOs as an input to rawspec at the LOFAR stations given we're performing a packet-to-GUPPI raw conversion, so preventing a write to disk would save a good chunk of time while processing data.
Due to the use of seeks (via lseek) in rawspec, it can't handle FIFOs as an input in the current version. This PR introduces an alternative code path where rawspec will detect if the input is a FIFO or PIPE, and now either
To achieve the latter, I've created a new function, read_to_skip based on calls to read_fully, this has an 8k buffer that it repeatedly reads data into until the requested data has been consumed. I tried benchmarking a few options for the output array (the array of constant length, a variable length array and a malloc'd array) and found the fixed 8k array was the best option (VLA was faster in some cases, but segfaulted for larger read lengths).
I've tried to follow your coding style and approach while implementing this, but let me know if you want anything changed or if there's way you feel I could improve the implementation.
Cheers,
David