Lines Matching refs:fd

25 haiku_freebsd_read(int fd, void *buf, size_t nbytes)
28 if (fstat(fd, &st) != 0)
32 return read(fd, buf, nbytes); // Is a file! Good :)
35 if (ioctl(fd, DIOCGSECTORSIZE, &sectorSize) == -1)
38 off_t cur = lseek(fd, 0, SEEK_CUR);
47 return read(fd, buf, nbytes);
53 off_t sdCur = lseek(fd, -(cur % sectorSize), SEEK_CUR);
57 if (read(fd, tmpBlock, sectorSize) == -1)
63 if (lseek(fd, -sectorSize + (cur % sectorSize) + nbytes, SEEK_CUR)
79 if (lseek(fd, -(sectorSize - seekDiff), SEEK_CUR) == -1)
82 off_t sdCur = lseek(fd,0,SEEK_CUR);
86 if (read(fd, tmpBlock, sectorSize) == -1 )
95 if (read(fd, ((char*)buf) + seekDiff, nbytes - seekDiff
103 off_t sdCur = lseek(fd, 0, SEEK_CUR);
107 if (read(fd, tmpBlock, sectorSize) == -1)
113 if (lseek(fd, -(sectorSize - nbytesDiff), SEEK_CUR) == -1)
125 haiku_freebsd_write(int fd, const void *buf, size_t nbytes)
128 if (fstat(fd, &st) != 0)
132 return write(fd, buf, nbytes); // Is a file! Good :)
135 if (ioctl(fd, DIOCGSECTORSIZE, &sectorSize) == -1)
138 off_t cur = lseek(fd, 0, SEEK_CUR);
147 return write(fd, buf, nbytes);
153 off_t sdCur = lseek(fd, -(cur % sectorSize), SEEK_CUR);
157 if (pread(fd, tmpBlock, sectorSize, sdCur) == -1)
161 if (write(fd, tmpBlock, sectorSize) == -1)
165 if (lseek(fd, -sectorSize + (cur % sectorSize) + nbytes, SEEK_CUR)
181 if (lseek(fd, -(sectorSize - seekDiff), SEEK_CUR) == -1)
184 off_t sdCur = lseek(fd, 0, SEEK_CUR);
188 if (pread(fd, tmpBlock, sectorSize, sdCur) == -1)
193 if (write(fd, tmpBlock, sectorSize) == -1)
199 if (write(fd, ((char*)buf) + seekDiff, nbytes - seekDiff
207 off_t sdCur = lseek(fd, 0, SEEK_CUR);
211 if (pread(fd, tmpBlock, sectorSize, sdCur) == -1)
215 if (write(fd, tmpBlock, sectorSize) == -1)
219 if (lseek(fd, -(sectorSize - nbytesDiff), SEEK_CUR) == -1)
231 haiku_freebsd_readv(int fd, const struct iovec *vecs, size_t count)
236 ssize_t currentRead = haiku_freebsd_read(fd, vecs[i].iov_base,
253 haiku_freebsd_writev(int fd, const struct iovec *vecs, size_t count)
258 ssize_t written = haiku_freebsd_write(fd, vecs[i].iov_base,