Lines Matching refs:fd

48 	extern "C" ssize_t _kern_read(int fd, off_t pos, void *buffer, size_t bufferSize);
49 extern "C" ssize_t _kern_write(int fd, off_t pos, const void *buffer, size_t bufferSize);
50 extern "C" int _kern_dup(int fd);
51 extern "C" status_t _kern_close(int fd);
58 test_size(int fd, off_t size)
65 if (lseek(fd, size - 1, SEEK_SET) < 0)
68 return (read(fd, &buffer, 1) == 1);
73 get_partition_size(int fd, off_t maxSize)
80 if (test_size(fd, mid))
93 fssh_dup(int fd)
99 newFD = dup(fd);
101 newFD = _kern_dup(fd);
108 FSShell::restricted_file_duped(fd, newFD);
115 fssh_close(int fd)
117 FSShell::restricted_file_closed(fd);
122 return close(fd);
124 return _kern_close(fd);
137 fssh_ioctl(int fd, unsigned long op, ...)
154 if (ioctl(fd, B_GET_GEOMETRY, &systemGeometry) == 0) {
176 if (ioctl(fd, BLKGETSIZE64, &size) == 0 && size > 0) {
187 } else if (ioctl(fd, HDIO_GETGEO, &hdGeometry) == 0) {
194 off_t partitionSize = get_partition_size(fd, deviceSize);
219 if (fstat(fd, &status) == 0) {
230 ioctl(fd, DIOCGSECTORSIZE, &disklabel.d_secsize);
231 ioctl(fd, DIOCGFWSECTORS, &disklabel.d_nsectors);
232 ioctl(fd, DIOCGFWHEADS, &disklabel.d_ntracks);
233 ioctl(fd, DIOCGMEDIASIZE, &mediaSize);
270 if (fstat(fd, &status) == 0) {
277 if (ioctl(fd, DKIOCGETBLOCKCOUNT, &mediaSize) != 0) {
300 if (ioctl(fd, DKIOCGETBLOCKSIZE,
307 if (ioctl(fd, DKIOCISWRITABLE, &isWritable) != 0) {
334 if (ioctl(fd, B_FLUSH_DRIVE_CACHE) == 0)
348 if (ioctl(fd, 10000) == 0)
371 fssh_read(int fd, void *buffer, fssh_size_t count)
375 if (FSShell::restricted_file_restrict_io(fd, pos, count) < 0)
377 return read(fd, buffer, count);
379 fssh_ssize_t bytesRead = _kern_read(fd, fssh_lseek(fd, 0, FSSH_SEEK_CUR),
382 fssh_lseek(fd, bytesRead, FSSH_SEEK_CUR);
389 fssh_read_pos(int fd, fssh_off_t pos, void *buffer, fssh_size_t count)
391 if (FSShell::restricted_file_restrict_io(fd, pos, count) < 0)
394 return read_pos(fd, pos, buffer, count);
396 return _kern_read(fd, pos, buffer, count);
402 fssh_write(int fd, const void *buffer, fssh_size_t count)
406 if (FSShell::restricted_file_restrict_io(fd, pos, count) < 0)
408 return write(fd, buffer, count);
410 fssh_ssize_t written = write_pos(fd, fssh_lseek(fd, 0, FSSH_SEEK_CUR),
413 fssh_lseek(fd, written, FSSH_SEEK_CUR);
420 fssh_write_pos(int fd, fssh_off_t pos, const void *buffer, fssh_size_t count)
422 if (FSShell::restricted_file_restrict_io(fd, pos, count) < 0)
425 return write_pos(fd, pos, buffer, count);
427 return _kern_write(fd, pos, buffer, count);