static int fuse_chown(const char* path, uid_t uid, gid_t gid) { PRINTD("##chown\n"); fssh_struct_stat st; st.fssh_st_uid = uid; st.fssh_st_gid = gid; return _ERR(_kern_write_stat(-1, path, false, &st, sizeof(st), FSSH_B_STAT_UID|FSSH_B_STAT_GID)); }
int fchmod(int fd, mode_t mode) { struct stat stat; status_t status; stat.st_mode = mode; status = _kern_write_stat(fd, NULL, false, &stat, sizeof(struct stat), B_STAT_MODE); RETURN_AND_SET_ERRNO(status); }
int fchmodat(int fd, const char* path, mode_t mode, int flag) { struct stat stat; status_t status; stat.st_mode = mode; status = _kern_write_stat(fd, path, (flag & AT_SYMLINK_NOFOLLOW) == 0, &stat, sizeof(struct stat), B_STAT_MODE); RETURN_AND_SET_ERRNO(status); }
int chmod(const char *path, mode_t mode) { struct stat stat; status_t status; stat.st_mode = mode; status = _kern_write_stat(-1, path, true, &stat, sizeof(struct stat), B_STAT_MODE); RETURN_AND_SET_ERRNO(status); }
static int common_chown(int fd, const char* path, bool followLinks, uid_t owner, gid_t group) { struct stat stat; status_t status; int mask = 0; if (owner != (uid_t)-1) { stat.st_uid = owner; mask |= B_STAT_UID; } if (group != (gid_t)-1) { stat.st_gid = group; mask |= B_STAT_GID; } status = _kern_write_stat(fd, path, followLinks, &stat, sizeof(struct stat), mask); RETURN_AND_SET_ERRNO(status); }