Working ring buffer read() and getfree()