Lines Matching refs:fd

129 	FDFile(int fd)
131 fFD(fd)
151 futimens(int fd, const struct timespec times[2])
153 FDFile file(fd);
162 FDPathFile(int fd, const char* path, int flag)
164 fFD(fd),
189 utimensat(int fd, const char* path, const struct timespec times[2], int flag)
191 FDPathFile file(fd, path, flag);
401 BPrivate::get_path(int fd, const char *name, string &path)
403 // get the node ref for the fd, if any, and the path part is not absolute
404 if (fd >= 0 && !(name && name[0] == '/')) {
406 Descriptor *descriptor = get_descriptor(fd);
481 _kern_create_dir(int fd, const char *path, int perms)
485 status_t error = get_path(fd, path, realPath);
546 _kern_open_dir(int fd, const char *path)
550 status_t error = get_path(fd, path, realPath);
572 _kern_open_parent_dir(int fd, char *name, size_t nameLength)
576 status_t error = get_path(fd, NULL, realPath);
606 _kern_read_dir(int fd, struct dirent *buffer, size_t bufferSize,
614 = dynamic_cast<DirectoryDescriptor*>(get_descriptor(fd));
640 _kern_rewind_dir(int fd)
644 = dynamic_cast<DirectoryDescriptor*>(get_descriptor(fd));
702 _kern_open(int fd, const char *path, int openMode, int perms)
706 status_t error = get_path(fd, path, realPath);
729 _kern_seek(int fd, off_t pos, int seekType)
733 = dynamic_cast<FileDescriptor*>(get_descriptor(fd));
738 off_t result = lseek(descriptor->fd, pos, seekType);
747 _kern_read(int fd, off_t pos, void *buffer, size_t bufferSize)
751 = dynamic_cast<FileDescriptor*>(get_descriptor(fd));
757 off_t result = lseek(descriptor->fd, pos, SEEK_SET);
763 ssize_t bytesRead = haiku_host_platform_read(descriptor->fd, buffer,
773 _kern_write(int fd, off_t pos, const void *buffer, size_t bufferSize)
777 = dynamic_cast<FileDescriptor*>(get_descriptor(fd));
783 off_t result = lseek(descriptor->fd, pos, SEEK_SET);
789 ssize_t bytesWritten = haiku_host_platform_write(descriptor->fd, buffer,
799 _kern_close(int fd)
801 return delete_descriptor(fd);
806 _kern_dup(int fd)
809 Descriptor *descriptor = get_descriptor(fd);
826 _kern_fsync(int fd)
830 = dynamic_cast<FileDescriptor*>(get_descriptor(fd));
835 if (fsync(descriptor->fd) < 0)
843 _kern_read_stat(int fd, const char *path, bool traverseLink,
849 status_t error = get_path(fd, path, realPath);
863 Descriptor *descriptor = get_descriptor(fd);
875 _kern_write_stat(int fd, const char *path, bool traverseLink,
884 error = get_path(fd, path, realPath);
895 Descriptor *descriptor = get_descriptor(fd);
901 realFD = fileFD->fd;
903 error = get_path(fd, NULL, realPath);
1013 _kern_create_symlink(int fd, const char *path, const char *toPath, int mode)
1018 status_t error = get_path(fd, path, realPath);
1031 _kern_read_link(int fd, const char *path, char *buffer, size_t *_bufferSize)
1035 status_t error = get_path(fd, path, realPath);
1067 _kern_unlink(int fd, const char *path)
1071 status_t error = get_path(fd, path, realPath);
1109 _kern_lock_node(int fd)
1116 _kern_unlock_node(int fd)
1127 read_pos(int fd, off_t pos, void *buffer, size_t bufferSize)
1130 off_t result = lseek(fd, pos, SEEK_SET);
1135 ssize_t bytesRead = haiku_host_platform_read(fd, buffer, bufferSize);
1145 write_pos(int fd, off_t pos, const void *buffer, size_t bufferSize)
1149 = dynamic_cast<AttributeDescriptor*>(get_descriptor(fd));
1161 off_t result = lseek(fd, pos, SEEK_SET);
1166 ssize_t bytesWritten = haiku_host_platform_write(fd, buffer, bufferSize);
1178 _kern_readv(int fd, off_t pos, const struct iovec *vec, size_t count)
1181 off_t result = lseek(fd, pos, SEEK_SET);
1186 return haiku_host_platform_readv(fd, vec, count);
1191 _kern_writev(int fd, off_t pos, const struct iovec *vec, size_t count)
1194 off_t result = lseek(fd, pos, SEEK_SET);
1199 return haiku_host_platform_writev(fd, vec, count);
1207 _haiku_build_fchmod(int fd, mode_t mode)
1209 return _haiku_build_fchmodat(fd, NULL, mode, AT_SYMLINK_NOFOLLOW);
1214 _haiku_build_fchmodat(int fd, const char* path, mode_t mode, int flag)
1216 if (fd >= 0 && fd != AT_FDCWD && get_descriptor(fd) == NULL)
1217 return fchmodat(fd, path, mode, flag);
1222 RETURN_AND_SET_ERRNO(_kern_write_stat(fd, path,
1228 _haiku_build_fstat(int fd, struct stat* st)
1230 return _haiku_build_fstatat(fd, NULL, st, AT_SYMLINK_NOFOLLOW);
1235 _haiku_build_fstatat(int fd, const char* path, struct stat* st, int flag)
1237 if (fd >= 0 && fd != AT_FDCWD && get_descriptor(fd) == NULL)
1238 return fstatat(fd, path, st, flag);
1240 RETURN_AND_SET_ERRNO(_kern_read_stat(fd, path,
1246 _haiku_build_mkdirat(int fd, const char* path, mode_t mode)
1248 if (fd >= 0 && fd != AT_FDCWD && get_descriptor(fd) == NULL)
1249 return mkdirat(fd, path, mode);
1251 RETURN_AND_SET_ERRNO(_kern_create_dir(fd, path, mode));
1256 _haiku_build_mkfifoat(int fd, const char* path, mode_t mode)
1258 return mkfifoat(fd, path, mode);
1265 _haiku_build_utimensat(int fd, const char* path, const struct timespec times[2],
1268 if (fd >= 0 && fd != AT_FDCWD && get_descriptor(fd) == NULL)
1269 return utimensat(fd, path, times, flag);
1316 status = _kern_write_stat(fd, path, (flag & AT_SYMLINK_NOFOLLOW) == 0,
1324 _haiku_build_futimens(int fd, const struct timespec times[2])
1326 return _haiku_build_utimensat(fd, NULL, times, AT_SYMLINK_NOFOLLOW);
1331 _haiku_build_faccessat(int fd, const char* path, int accessMode, int flag)
1333 if (fd >= 0 && fd != AT_FDCWD && get_descriptor(fd) == NULL)
1334 return faccessat(fd, path, accessMode, flag);
1338 status_t error = _kern_read_stat(fd, path, false, &st, sizeof(st));
1388 _haiku_build_fchdir(int fd)
1390 if (is_unknown_or_system_descriptor(fd))
1391 return fchdir(fd);
1398 _haiku_build_close(int fd)
1400 if (get_descriptor(fd) == NULL)
1401 return close(fd);
1403 RETURN_AND_SET_ERRNO(_kern_close(fd));
1408 _haiku_build_dup(int fd)
1410 if (get_descriptor(fd) == NULL)
1411 return close(fd);
1413 RETURN_AND_SET_ERRNO(_kern_dup(fd));
1439 _haiku_build_unlinkat(int fd, const char* path, int flag)
1441 if (fd >= 0 && fd != AT_FDCWD && get_descriptor(fd) == NULL)
1442 return unlinkat(fd, path, flag);
1444 RETURN_AND_SET_ERRNO(_kern_unlink(fd, path));
1449 _haiku_build_readlinkat(int fd, const char* path, char* buffer,
1452 if (fd >= 0 && fd != AT_FDCWD && get_descriptor(fd) == NULL)
1453 return readlinkat(fd, path, buffer, bufferSize);
1455 status_t error = _kern_read_link(fd, path, buffer, &bufferSize);
1464 _haiku_build_symlinkat(const char* toPath, int fd, const char* symlinkPath)
1466 if (fd >= 0 && fd != AT_FDCWD && get_descriptor(fd) == NULL)
1467 return symlinkat(toPath, fd, symlinkPath);
1469 RETURN_AND_SET_ERRNO(_kern_create_symlink(fd, symlinkPath, toPath,
1475 _haiku_build_ftruncate(int fd, off_t newSize)
1477 if (fd >= 0 && fd != AT_FDCWD && get_descriptor(fd) == NULL)
1478 return ftruncate(fd, newSize);
1483 RETURN_AND_SET_ERRNO(_kern_write_stat(fd, NULL, false, &st, sizeof(st),
1489 _haiku_build_fchown(int fd, uid_t owner, gid_t group)
1491 return _haiku_build_fchownat(fd, NULL, owner, group, AT_SYMLINK_NOFOLLOW);
1496 _haiku_build_fchownat(int fd, const char* path, uid_t owner, gid_t group,
1499 if (fd >= 0 && fd != AT_FDCWD && get_descriptor(fd) == NULL)
1500 return fchownat(fd, path, owner, group, flag);
1506 RETURN_AND_SET_ERRNO(_kern_write_stat(fd, path,
1513 _haiku_build_mknodat(int fd, const char* name, mode_t mode, dev_t dev)
1515 return mknodat(fd, name, mode, dev);
1536 _haiku_build_openat(int fd, const char* path, int openMode, mode_t permissions)
1543 RETURN_AND_SET_ERRNO(_kern_open(fd, path, openMode, permissions));
1548 _haiku_build_fcntl(int fd, int op, int argument)
1550 if (is_unknown_or_system_descriptor(fd))
1551 return fcntl(fd, op, argument);