comedi_mark_buffer_read man page
comedi_mark_buffer_read — streaming buffer control
int comedi_mark_buffer_read (comedi_t * device, unsigned int subdevice, unsigned int num_bytes);
The function comedi_mark_buffer_read() is used on a subdevice that has a Comedi input command in progress. It should only be used if you are using a mmap() (as opposed to calling read() on the device file) to read data from Comedi's buffer, since Comedi will automatically keep track of how many bytes have been transferred via read() calls. This function is used to indicate that the next num_bytes bytes in the buffer are no longer needed and may be discarded. If there is an error, -1 is returned.