这篇教程C++ uid_eq函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uid_eq函数的典型用法代码示例。如果您正苦于以下问题:C++ uid_eq函数的具体用法?C++ uid_eq怎么用?C++ uid_eq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uid_eq函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: set_task_ioprioint set_task_ioprio(struct task_struct *task, int ioprio){ int err; struct io_context *ioc; const struct cred *cred = current_cred(), *tcred; rcu_read_lock(); tcred = __task_cred(task); if (!uid_eq(tcred->uid, cred->euid) && !uid_eq(tcred->uid, cred->uid) && !capable(CAP_SYS_NICE)) { rcu_read_unlock(); return -EPERM; } rcu_read_unlock(); err = security_task_setioprio(task, ioprio); if (err) return err; ioc = get_task_io_context(task, GFP_ATOMIC, NUMA_NO_NODE); if (ioc) { ioc->ioprio = ioprio; put_io_context(ioc); } return err;}
开发者ID:1800alex,项目名称:linux,代码行数:27,
示例2: posix_acl_permission/* * Return 0 if current is granted want access to the inode * by the acl. Returns -E... otherwise. */intposix_acl_permission(struct inode *inode, const struct posix_acl *acl, int want){ const struct posix_acl_entry *pa, *pe, *mask_obj; int found = 0; want &= MAY_READ | MAY_WRITE | MAY_EXEC | MAY_NOT_BLOCK; FOREACH_ACL_ENTRY(pa, acl, pe) { switch(pa->e_tag) { case ACL_USER_OBJ: /* (May have been checked already) */ if (uid_eq(inode->i_uid, current_fsuid())) goto check_perm; break; case ACL_USER: if (uid_eq(pa->e_uid, current_fsuid())) goto mask; break; case ACL_GROUP_OBJ: if (in_group_p(inode->i_gid)) { found = 1; if ((pa->e_perm & want) == want) goto mask; } break; case ACL_GROUP: if (in_group_p(pa->e_gid)) { found = 1; if ((pa->e_perm & want) == want) goto mask; } break; case ACL_MASK: break; case ACL_OTHER: if (found) return -EACCES; else goto check_perm; default: return -EIO; } } return -EIO;mask: for (mask_obj = pa+1; mask_obj != pe; mask_obj++) { if (mask_obj->e_tag == ACL_MASK) { if ((pa->e_perm & mask_obj->e_perm & want) == want) return 0; return -EACCES; } }check_perm: if ((pa->e_perm & want) == want) return 0; return -EACCES;}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:64,
示例3: gfs2_unlink_okstatic int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, const struct gfs2_inode *ip){ int error; if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode)) return -EPERM; if ((dip->i_inode.i_mode & S_ISVTX) && !uid_eq(dip->i_inode.i_uid, current_fsuid()) && !uid_eq(ip->i_inode.i_uid, current_fsuid()) && !capable(CAP_FOWNER)) return -EPERM; if (IS_APPEND(&dip->i_inode)) return -EPERM; error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC); if (error) return error; error = gfs2_dir_check(&dip->i_inode, name, ip); if (error) return error; return 0;}
开发者ID:garyvan,项目名称:openwrt-1.6,代码行数:26,
示例4: ncp_show_optionsstatic int ncp_show_options(struct seq_file *seq, struct dentry *root){ struct ncp_server *server = NCP_SBP(root->d_sb); unsigned int tmp; if (!uid_eq(server->m.uid, GLOBAL_ROOT_UID)) seq_printf(seq, ",uid=%u", from_kuid_munged(&init_user_ns, server->m.uid)); if (!gid_eq(server->m.gid, GLOBAL_ROOT_GID)) seq_printf(seq, ",gid=%u", from_kgid_munged(&init_user_ns, server->m.gid)); if (!uid_eq(server->m.mounted_uid, GLOBAL_ROOT_UID)) seq_printf(seq, ",owner=%u", from_kuid_munged(&init_user_ns, server->m.mounted_uid)); tmp = server->m.file_mode & S_IALLUGO; if (tmp != NCP_DEFAULT_FILE_MODE) seq_printf(seq, ",mode=0%o", tmp); tmp = server->m.dir_mode & S_IALLUGO; if (tmp != NCP_DEFAULT_DIR_MODE) seq_printf(seq, ",dirmode=0%o", tmp); if (server->m.time_out != NCP_DEFAULT_TIME_OUT * HZ / 100) { tmp = server->m.time_out * 100 / HZ; seq_printf(seq, ",timeout=%u", tmp); } if (server->m.retry_count != NCP_DEFAULT_RETRY_COUNT) seq_printf(seq, ",retry=%u", server->m.retry_count); if (server->m.flags != 0) seq_printf(seq, ",flags=%lu", server->m.flags); if (server->m.wdog_pid != NULL) seq_printf(seq, ",wdogpid=%u", pid_vnr(server->m.wdog_pid)); return 0;}
开发者ID:SantoshShilimkar,项目名称:linux,代码行数:33,
示例5: check_uid/* * check uid if it's not root(0) nor system(1000) */static inline long check_uid(kuid_t uid){ if (!uid_eq(uid, GLOBAL_ROOT_UID) && !uid_eq(uid, ANDROID_SYSTEM_SERVER_UID)) return -EPERM; /* uid is OK */ return 0;}
开发者ID:GameTheory-,项目名称:android_kernel_g4stylusn2,代码行数:11,
示例6: fib_rule_matchallbool fib_rule_matchall(const struct fib_rule *rule){ if (rule->iifindex || rule->oifindex || rule->mark || rule->tun_id || rule->flags) return false; if (rule->suppress_ifgroup != -1 || rule->suppress_prefixlen != -1) return false; if (!uid_eq(rule->uid_range.start, fib_kuid_range_unset.start) || !uid_eq(rule->uid_range.end, fib_kuid_range_unset.end)) return false; return true;}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:12,
示例7: check_same_owner/* * check the target process has a UID that matches the current process's */static bool check_same_owner(struct task_struct *p){ const struct cred *cred = current_cred(), *pcred; bool match; rcu_read_lock(); pcred = __task_cred(p); match = (uid_eq(cred->euid, pcred->euid) || uid_eq(cred->euid, pcred->uid)); rcu_read_unlock(); return match;}
开发者ID:BoostFlash,项目名称:hero2lteaelohapbackup,代码行数:15,
示例8: authlist_check_permission/* * Check if @authlist permits the called with @cred credentials to perform the * operation guarded by the @authlist. */int authlist_check_permission(struct authlist *authlist, const struct cred *cred){ struct authlist_entry *entry; int ne, error = 0; down_read(&authlist->rws); if (authlist->nentries == 0) { if (authlist->initial_value == AUTHLIST_KIND_EVERYBODY) error_out(0); error_out(-EPERM); } entry = authlist->entries; for (ne = 0; ne < authlist->nentries; ne++, entry++) { switch (entry->kind) { case AUTHLIST_KIND_UID: if (uid_eq(entry->kuid, cred->euid)) error_out(0); break; case AUTHLIST_KIND_NOUID: if (uid_eq(entry->kuid, cred->euid)) error_out(-EPERM); break; case AUTHLIST_KIND_GID: if (in_egroup(cred, entry->kgid)) error_out(0); break; case AUTHLIST_KIND_NOGID: if (in_egroup(cred, entry->kgid)) error_out(-EPERM); break; case AUTHLIST_KIND_EVERYBODY: error_out(0); case AUTHLIST_KIND_NOBODY: error_out(-EPERM); } }out: up_read(&authlist->rws); return error;}
开发者ID:oboguev,项目名称:dprio,代码行数:56,
示例9: gr_proc_is_restrictedint gr_proc_is_restricted(void){#if defined(CONFIG_GRKERNSEC_PROC_USER) || defined(CONFIG_GRKERNSEC_PROC_USERGROUP) const struct cred *cred = current_cred();#endif#ifdef CONFIG_GRKERNSEC_PROC_USER if (!uid_eq(cred->fsuid, GLOBAL_ROOT_UID)) return -EACCES;#elif defined(CONFIG_GRKERNSEC_PROC_USERGROUP) if (!uid_eq(cred->fsuid, GLOBAL_ROOT_UID) && !in_group_p(grsec_proc_gid)) return -EACCES;#endif return 0;}
开发者ID:ParrotSec,项目名称:linux-psec,代码行数:15,
示例10: sigio_permstatic inline int sigio_perm(struct task_struct *p, struct fown_struct *fown, int sig){ const struct cred *cred; int ret; rcu_read_lock(); cred = __task_cred(p); ret = ((uid_eq(fown->euid, GLOBAL_ROOT_UID) || uid_eq(fown->euid, cred->suid) || uid_eq(fown->euid, cred->uid) || uid_eq(fown->uid, cred->suid) || uid_eq(fown->uid, cred->uid)) && !security_file_send_sigiotask(p, fown, sig)); rcu_read_unlock(); return ret;}
开发者ID:nemumu,项目名称:linux,代码行数:15,
示例11: can_use_rp/** * can_use_rp - check whether the user is allowed to use reserved pool. * @c: UBIFS file-system description object * * UBIFS has so-called "reserved pool" which is flash space reserved * for the superuser and for uses whose UID/GID is recorded in UBIFS superblock. * This function checks whether current user is allowed to use reserved pool. * Returns %1 current user is allowed to use reserved pool and %0 otherwise. */static int can_use_rp(struct ubifs_info *c){ if (uid_eq(current_fsuid(), c->rp_uid) || capable(CAP_SYS_RESOURCE) || (!gid_eq(c->rp_gid, GLOBAL_ROOT_GID) && in_group_p(c->rp_gid))) return 1; return 0;}
开发者ID:0xFelix,项目名称:u-boot-edminiv2,代码行数:16,
示例12: check_quotactl_permissionstatic int check_quotactl_permission(struct super_block *sb, int type, int cmd, qid_t id){ switch (cmd) { /* these commands do not require any special privilegues */ case Q_GETFMT: case Q_SYNC: case Q_GETINFO: case Q_XGETQSTAT: case Q_XGETQSTATV: case Q_XQUOTASYNC: break; /* allow to query information for dquots we "own" */ case Q_GETQUOTA: case Q_XGETQUOTA: if ((type == USRQUOTA && uid_eq(current_euid(), make_kuid(current_user_ns(), id))) || (type == GRPQUOTA && in_egroup_p(make_kgid(current_user_ns(), id)))) break; /*FALLTHROUGH*/ default: if (!capable(CAP_SYS_ADMIN)) return -EPERM; } return security_quotactl(cmd, type, id, sb);}
开发者ID:3null,项目名称:linux,代码行数:26,
示例13: v1_commit_dqblkstatic int v1_commit_dqblk(struct dquot *dquot){ short type = dquot->dq_id.type; ssize_t ret; struct v1_disk_dqblk dqblk; v1_mem2disk_dqblk(&dqblk, &dquot->dq_dqb); if (((type == USRQUOTA) && uid_eq(dquot->dq_id.uid, GLOBAL_ROOT_UID)) || ((type == GRPQUOTA) && gid_eq(dquot->dq_id.gid, GLOBAL_ROOT_GID))) { dqblk.dqb_btime = sb_dqopt(dquot->dq_sb)->info[type].dqi_bgrace; dqblk.dqb_itime = sb_dqopt(dquot->dq_sb)->info[type].dqi_igrace; } ret = 0; if (sb_dqopt(dquot->dq_sb)->files[type]) ret = dquot->dq_sb->s_op->quota_write(dquot->dq_sb, type, (char *)&dqblk, sizeof(struct v1_disk_dqblk), v1_dqoff(from_kqid(&init_user_ns, dquot->dq_id))); if (ret != sizeof(struct v1_disk_dqblk)) { quota_error(dquot->dq_sb, "dquota write failed"); if (ret >= 0) ret = -EIO; goto out; } ret = 0;out: dqstats_inc(DQST_WRITES); return ret;}
开发者ID:020gzh,项目名称:linux,代码行数:32,
示例14: autofs_show_optionsstatic int autofs_show_options(struct seq_file *m, struct dentry *root){ struct autofs_sb_info *sbi = autofs_sbi(root->d_sb); struct inode *root_inode = d_inode(root->d_sb->s_root); if (!sbi) return 0; seq_printf(m, ",fd=%d", sbi->pipefd); if (!uid_eq(root_inode->i_uid, GLOBAL_ROOT_UID)) seq_printf(m, ",uid=%u", from_kuid_munged(&init_user_ns, root_inode->i_uid)); if (!gid_eq(root_inode->i_gid, GLOBAL_ROOT_GID)) seq_printf(m, ",gid=%u", from_kgid_munged(&init_user_ns, root_inode->i_gid)); seq_printf(m, ",pgrp=%d", pid_vnr(sbi->oz_pgrp)); seq_printf(m, ",timeout=%lu", sbi->exp_timeout/HZ); seq_printf(m, ",minproto=%d", sbi->min_proto); seq_printf(m, ",maxproto=%d", sbi->max_proto); if (autofs_type_offset(sbi->type)) seq_printf(m, ",offset"); else if (autofs_type_direct(sbi->type)) seq_printf(m, ",direct"); else seq_printf(m, ",indirect");#ifdef CONFIG_CHECKPOINT_RESTORE if (sbi->pipe) seq_printf(m, ",pipe_ino=%ld", file_inode(sbi->pipe)->i_ino); else seq_printf(m, ",pipe_ino=-1");#endif return 0;}
开发者ID:Lyude,项目名称:linux,代码行数:34,
示例15: unx_match/* * Match credentials against current the auth_cred. */static intunx_match(struct auth_cred *acred, struct rpc_cred *cred, int flags){ unsigned int groups = 0; unsigned int i; if (cred->cr_cred == acred->cred) return 1; if (!uid_eq(cred->cr_cred->fsuid, acred->cred->fsuid) || !gid_eq(cred->cr_cred->fsgid, acred->cred->fsgid)) return 0; if (acred->cred->group_info != NULL) groups = acred->cred->group_info->ngroups; if (groups > UNX_NGROUPS) groups = UNX_NGROUPS; if (cred->cr_cred->group_info == NULL) return groups == 0; if (groups != cred->cr_cred->group_info->ngroups) return 0; for (i = 0; i < groups ; i++) if (!gid_eq(cred->cr_cred->group_info->gid[i], acred->cred->group_info->gid[i])) return 0; return 1;}
开发者ID:Anjali05,项目名称:linux,代码行数:29,
示例16: cap_capable/** * cap_capable - Determine whether a task has a particular effective capability * @cred: The credentials to use * @ns: The user namespace in which we need the capability * @cap: The capability to check for * @audit: Whether to write an audit message or not * * Determine whether the nominated task has the specified capability amongst * its effective set, returning 0 if it does, -ve if it does not. * * NOTE WELL: cap_has_capability() cannot be used like the kernel's capable() * and has_capability() functions. That is, it has the reverse semantics: * cap_has_capability() returns 0 when a task has a capability, but the * kernel's capable() and has_capability() returns 1 for this case. */int cap_capable(const struct cred *cred, struct user_namespace *targ_ns, int cap, int audit){ struct user_namespace *ns = targ_ns; /* See if cred has the capability in the target user namespace * by examining the target user namespace and all of the target * user namespace's parents. */ for (;;) { /* Do we have the necessary capabilities? */ if (ns == cred->user_ns) return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM; /* Have we tried all of the parent namespaces? */ if (ns == &init_user_ns) return -EPERM; /* * The owner of the user namespace in the parent of the * user namespace has all caps. */ if ((ns->parent == cred->user_ns) && uid_eq(ns->owner, cred->euid)) return 0; /* * If you have a capability in a parent user ns, then you have * it over all children user namespaces as well. */ ns = ns->parent; } /* We never get here */}
开发者ID:RobinSystems,项目名称:linux-3.13,代码行数:49,
示例17: generic_match/* * Match credentials against current process creds. */static intgeneric_match(struct auth_cred *acred, struct rpc_cred *cred, int flags){ struct generic_cred *gcred = container_of(cred, struct generic_cred, gc_base); int i; if (acred->machine_cred) return machine_cred_match(acred, gcred, flags); if (!uid_eq(gcred->acred.uid, acred->uid) || !gid_eq(gcred->acred.gid, acred->gid) || gcred->acred.machine_cred != 0) goto out_nomatch; /* Optimisation in the case where pointers are identical... */ if (gcred->acred.group_info == acred->group_info) goto out_match; /* Slow path... */ if (gcred->acred.group_info->ngroups != acred->group_info->ngroups) goto out_nomatch; for (i = 0; i < gcred->acred.group_info->ngroups; i++) { if (!gid_eq(GROUP_AT(gcred->acred.group_info, i), GROUP_AT(acred->group_info, i))) goto out_nomatch; }out_match: return 1;out_nomatch: return 0;}
开发者ID:3null,项目名称:linux,代码行数:34,
示例18: recover_quota_datastatic int recover_quota_data(struct inode *inode, struct page *page){ struct f2fs_inode *raw = F2FS_INODE(page); struct iattr attr; uid_t i_uid = le32_to_cpu(raw->i_uid); gid_t i_gid = le32_to_cpu(raw->i_gid); int err; memset(&attr, 0, sizeof(attr)); attr.ia_uid = make_kuid(inode->i_sb->s_user_ns, i_uid); attr.ia_gid = make_kgid(inode->i_sb->s_user_ns, i_gid); if (!uid_eq(attr.ia_uid, inode->i_uid)) attr.ia_valid |= ATTR_UID; if (!gid_eq(attr.ia_gid, inode->i_gid)) attr.ia_valid |= ATTR_GID; if (!attr.ia_valid) return 0; err = dquot_transfer(inode, &attr); if (err) set_sbi_flag(F2FS_I_SB(inode), SBI_QUOTA_NEED_REPAIR); return err;}
开发者ID:avagin,项目名称:linux,代码行数:26,
示例19: hpfs_write_inode_eastatic void hpfs_write_inode_ea(struct inode *i, struct fnode *fnode){ struct hpfs_inode_info *hpfs_inode = hpfs_i(i); /*if (le32_to_cpu(fnode->acl_size_l) || le16_to_cpu(fnode->acl_size_s)) { Some unknown structures like ACL may be in fnode, we'd better not overwrite them hpfs_error(i->i_sb, "fnode %08x has some unknown HPFS386 structures", i->i_ino); } else*/ if (hpfs_sb(i->i_sb)->sb_eas >= 2) { __le32 ea; if (!uid_eq(i->i_uid, hpfs_sb(i->i_sb)->sb_uid) || hpfs_inode->i_ea_uid) { ea = cpu_to_le32(i_uid_read(i)); hpfs_set_ea(i, fnode, "UID", (char*)&ea, 2); hpfs_inode->i_ea_uid = 1; } if (!gid_eq(i->i_gid, hpfs_sb(i->i_sb)->sb_gid) || hpfs_inode->i_ea_gid) { ea = cpu_to_le32(i_gid_read(i)); hpfs_set_ea(i, fnode, "GID", (char *)&ea, 2); hpfs_inode->i_ea_gid = 1; } if (!S_ISLNK(i->i_mode)) if ((i->i_mode != ((hpfs_sb(i->i_sb)->sb_mode & ~(S_ISDIR(i->i_mode) ? 0 : 0111)) | (S_ISDIR(i->i_mode) ? S_IFDIR : S_IFREG)) && i->i_mode != ((hpfs_sb(i->i_sb)->sb_mode & ~(S_ISDIR(i->i_mode) ? 0222 : 0333)) | (S_ISDIR(i->i_mode) ? S_IFDIR : S_IFREG))) || hpfs_inode->i_ea_mode) { ea = cpu_to_le32(i->i_mode); /* sick, but legal */ hpfs_set_ea(i, fnode, "MODE", (char *)&ea, 2); hpfs_inode->i_ea_mode = 1; } if (S_ISBLK(i->i_mode) || S_ISCHR(i->i_mode)) { ea = cpu_to_le32(new_encode_dev(i->i_rdev)); hpfs_set_ea(i, fnode, "DEV", (char *)&ea, 4); } }}
开发者ID:020gzh,项目名称:linux,代码行数:35,
示例20: gr_handle_follow_linkintgr_handle_follow_link(const struct dentry *dentry, const struct vfsmount *mnt){#ifdef CONFIG_GRKERNSEC_LINK struct inode *inode = d_backing_inode(dentry); struct inode *parent = d_backing_inode(dentry->d_parent); const struct cred *cred = current_cred(); if (grsec_enable_link && d_is_symlink(dentry) && (parent->i_mode & S_ISVTX) && !uid_eq(parent->i_uid, inode->i_uid) && (parent->i_mode & S_IWOTH) && !uid_eq(cred->fsuid, inode->i_uid)) { gr_log_fs_int2(GR_DONT_AUDIT, GR_SYMLINK_MSG, dentry, mnt, inode->i_uid, inode->i_gid); return -EACCES; }#endif return 0;}
开发者ID:ParrotSec,项目名称:linux-psec,代码行数:17,
示例21: scm_check_credsstatic __inline__ int scm_check_creds(struct ucred *creds){ const struct cred *cred = current_cred(); kuid_t uid = make_kuid(cred->user_ns, creds->uid); kgid_t gid = make_kgid(cred->user_ns, creds->gid); if (!uid_valid(uid) || !gid_valid(gid)) return -EINVAL; if ((creds->pid == task_tgid_vnr(current) || capable(CAP_SYS_ADMIN)) && ((uid_eq(uid, cred->uid) || uid_eq(uid, cred->euid) || uid_eq(uid, cred->suid)) || capable(CAP_SETUID)) && ((gid_eq(gid, cred->gid) || gid_eq(gid, cred->egid) || gid_eq(gid, cred->sgid)) || capable(CAP_SETGID))) { return 0; } return -EPERM;}
开发者ID:AllenDou,项目名称:linux,代码行数:18,
示例22: fuse_allow_current_process/* * Calling into a user-controlled filesystem gives the filesystem * daemon ptrace-like capabilities over the current process. This * means, that the filesystem daemon is able to record the exact * filesystem operations performed, and can also control the behavior * of the requester process in otherwise impossible ways. For example * it can delay the operation for arbitrary length of time allowing * DoS against the requester. * * For this reason only those processes can call into the filesystem, * for which the owner of the mount has ptrace privilege. This * excludes processes started by other users, suid or sgid processes. */int fuse_allow_current_process(struct fuse_conn *fc){ const struct cred *cred; if (fc->allow_other) return current_in_userns(fc->user_ns); cred = current_cred(); if (uid_eq(cred->euid, fc->user_id) && uid_eq(cred->suid, fc->user_id) && uid_eq(cred->uid, fc->user_id) && gid_eq(cred->egid, fc->group_id) && gid_eq(cred->sgid, fc->group_id) && gid_eq(cred->gid, fc->group_id)) return 1; return 0;}
开发者ID:Anjali05,项目名称:linux,代码行数:31,
示例23: machine_cred_matchstatic intmachine_cred_match(struct auth_cred *acred, struct generic_cred *gcred, int flags){ if (!gcred->acred.machine_cred || gcred->acred.principal != acred->principal || !uid_eq(gcred->acred.uid, acred->uid) || !gid_eq(gcred->acred.gid, acred->gid)) return 0; return 1;}
开发者ID:3null,项目名称:linux,代码行数:10,
示例24: __cgroup1_procs_writestatic ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off, bool threadgroup){ struct cgroup *cgrp; struct task_struct *task; const struct cred *cred, *tcred; ssize_t ret; cgrp = cgroup_kn_lock_live(of->kn, false); if (!cgrp) return -ENODEV; task = cgroup_procs_write_start(buf, threadgroup); ret = PTR_ERR_OR_ZERO(task); if (ret) goto out_unlock; /* * Even if we're attaching all tasks in the thread group, we only * need to check permissions on one of them. */ cred = current_cred(); tcred = get_task_cred(task); if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) && !uid_eq(cred->euid, tcred->uid) && !uid_eq(cred->euid, tcred->suid)) ret = -EACCES; put_cred(tcred); if (ret) goto out_finish; ret = cgroup_attach_task(cgrp, task, threadgroup);out_finish: cgroup_procs_write_finish(task);out_unlock: cgroup_kn_unlock(of->kn); return ret ?: nbytes;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:41,
示例25: do_unlink_whstatic int do_unlink_wh(struct inode *h_dir, struct path *h_path){ int force; /* * forces superio when the dir has a sticky bit. * this may be a violation of unix fs semantics. */ force = (h_dir->i_mode & S_ISVTX) && !uid_eq(current_fsuid(), h_path->dentry->d_inode->i_uid); return vfsub_unlink(h_dir, h_path, force);}
开发者ID:bjayesh,项目名称:chandra,代码行数:12,
示例26: munge_mode_uid_gidstatic void munge_mode_uid_gid(const struct gfs2_inode *dip, struct inode *inode){ if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && (dip->i_inode.i_mode & S_ISUID) && !uid_eq(dip->i_inode.i_uid, GLOBAL_ROOT_UID)) { if (S_ISDIR(inode->i_mode)) inode->i_mode |= S_ISUID; else if (!uid_eq(dip->i_inode.i_uid, current_fsuid())) inode->i_mode &= ~07111; inode->i_uid = dip->i_inode.i_uid; } else inode->i_uid = current_fsuid(); if (dip->i_inode.i_mode & S_ISGID) { if (S_ISDIR(inode->i_mode)) inode->i_mode |= S_ISGID; inode->i_gid = dip->i_inode.i_gid; } else inode->i_gid = current_fsgid();}
开发者ID:ExtremeGTX,项目名称:Devkit8500_Linux_BSP,代码行数:21,
示例27: allow_file_dedupe/* Check whether we are allowed to dedupe the destination file */static bool allow_file_dedupe(struct file *file){ if (capable(CAP_SYS_ADMIN)) return true; if (file->f_mode & FMODE_WRITE) return true; if (uid_eq(current_fsuid(), file_inode(file)->i_uid)) return true; if (!inode_permission(file_inode(file), MAY_WRITE)) return true; return false;}
开发者ID:Anjali05,项目名称:linux,代码行数:13,
注:本文中的uid_eq函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ uid_to_string函数代码示例 C++ uid函数代码示例 |