internal static int Read(int fd, ulong offset, Span <byte> buffer) { if (fd == -1) { return(LibC.EACCES); } LibC.lseek(fd, (long)offset, LibC.SEEK_SET); if (LibC.errno != 0) { return(-LibC.errno); } ssize_t rd; fixed(void *bp = buffer) { rd = LibC.read(fd, bp, buffer.Length); } if (rd >= 0) { return((int)rd); } return(-LibC.errno); }
private void CallLseek() { int current_status = LibC.lseek((int)fd.Value, Convert.ToInt64((int)offset.Value), (int)origin.Value); position.Value = (uint)current_status; if (current_status == -1) { SetErrorNumber(); } call = Call.Done; }