本文整理汇总了C++中put_group_info函数的典型用法代码示例。如果您正苦于以下问题:C++ put_group_info函数的具体用法?C++ put_group_info怎么用?C++ put_group_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了put_group_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: crset
/* Set the cred info into the current task */
void
crset(cred_t * cr)
{
#if defined(STRUCT_TASK_STRUCT_HAS_CRED)
struct cred *new_creds;
/* If our current task doesn't have identical real and effective
* credentials, commit_cred won't let us change them, so we just
* bail here.
*/
if (current->cred != current->real_cred)
return;
new_creds = prepare_creds();
/* Drop the reference to group_info - we'll overwrite it in afs_copy_creds */
put_group_info(new_creds->group_info);
afs_copy_creds(new_creds, current_cred());
commit_creds(new_creds);
#else
struct group_info *old_info;
current->fsuid = afs_cr_uid(cr);
current->uid = afs_cr_ruid(cr);
current->fsgid = afs_cr_gid(cr);
current->gid = afs_cr_rgid(cr);
get_group_info(afs_cr_group_info(cr));
task_lock(current);
old_info = current->group_info;
current->group_info = afs_cr_group_info(cr);
task_unlock(current);
put_group_info(old_info);
#endif
}
示例2: sys_getgroups
asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist)
{
int i = 0;
/*
* SMP: Nobody else can change our grouplist. Thus we are
* safe.
*/
if (gidsetsize < 0)
return -EINVAL;
/* no need to grab task_lock here; it cannot change */
get_group_info(current->group_info);
i = current->group_info->ngroups;
if (gidsetsize) {
if (i > gidsetsize) {
i = -EINVAL;
goto out;
}
if (groups_to_user(grouplist, current->group_info)) {
i = -EFAULT;
goto out;
}
}
out:
put_group_info(current->group_info);
return i;
}
示例3: in_egroup_p
int in_egroup_p(gid_t grp)
{
int retval = 1;
if (grp != current->egid) {
get_group_info(current->group_info);
retval = groups_search(current->group_info, grp);
put_group_info(current->group_info);
}
return retval;
}
示例4: crgetgroups
/*
* Return an array of supplemental gids. The returned address is safe
* to use as long as the caller has taken a reference with crhold().
* The caller is responsible for releasing the reference with crfree().
*/
gid_t *
crgetgroups(const cred_t *cr)
{
struct group_info *gi;
gid_t *gids;
gi = get_group_info(cr->group_info);
gids = gi->blocks[0];
put_group_info(gi);
return gids;
}
示例5: crfree
void
crfree(cred_t * cr)
{
#if defined(STRUCT_TASK_STRUCT_HAS_CRED)
put_cred(cr);
#else
if (atomic_dec_and_test(&cr->cr_ref)) {
put_group_info(afs_cr_group_info(cr));
kfree(cr);
}
#endif
}
示例6: groupmember
/* Check if the passed gid is available is in supplied credential. */
int
groupmember(gid_t gid, const cred_t *cr)
{
struct group_info *gi;
int rc;
gi = get_group_info(cr->group_info);
rc = cr_groups_search(cr->group_info, gid);
put_group_info(gi);
return rc;
}
示例7: crgetngroups
/* Return the number of supplemental groups */
int
crgetngroups(const cred_t *cr)
{
struct group_info *gi;
int rc;
gi = get_group_info(cr->group_info);
rc = gi->ngroups;
put_group_info(gi);
return rc;
}
示例8: __put_task_struct
void __put_task_struct(struct task_struct *tsk)
{
WARN_ON(!(tsk->state & (TASK_DEAD | TASK_ZOMBIE)));
WARN_ON(atomic_read(&tsk->usage));
WARN_ON(tsk == current);
if (unlikely(tsk->audit_context))
audit_free(tsk);
security_task_free(tsk);
free_uid(tsk->user);
put_group_info(tsk->group_info);
free_task(tsk);
}
示例9: task_state
static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *p)
{
struct group_info *group_info;
int g;
struct fdtable *fdt = NULL;
pid_t ppid, tpid;
rcu_read_lock();
ppid = pid_alive(p) ?
task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
tpid = 0;
if (pid_alive(p)) {
struct task_struct *tracer = tracehook_tracer_task(p);
if (tracer)
tpid = task_pid_nr_ns(tracer, ns);
}
seq_printf(m,
"State:\t%s\n"
"Tgid:\t%d\n"
"Pid:\t%d\n"
"PPid:\t%d\n"
"TracerPid:\t%d\n"
"Uid:\t%d\t%d\t%d\t%d\n"
"Gid:\t%d\t%d\t%d\t%d\n",
get_task_state(p),
task_tgid_nr_ns(p, ns),
pid_nr_ns(pid, ns),
ppid, tpid,
p->uid, p->euid, p->suid, p->fsuid,
p->gid, p->egid, p->sgid, p->fsgid);
task_lock(p);
if (p->files)
fdt = files_fdtable(p->files);
seq_printf(m,
"FDSize:\t%d\n"
"Groups:\t",
fdt ? fdt->max_fds : 0);
rcu_read_unlock();
group_info = p->group_info;
get_group_info(group_info);
task_unlock(p);
for (g = 0; g < min(group_info->ngroups, NGROUPS_SMALL); g++)
seq_printf(m, "%d ", GROUP_AT(group_info, g));
put_group_info(group_info);
seq_printf(m, "\n");
}
示例10: crfree
void
crfree(cred_t * cr)
{
if (cr->cr_ref > 1) {
cr->cr_ref--;
return;
}
#if defined(AFS_LINUX26_ENV)
put_group_info(cr->cr_group_info);
#endif
kfree(cr);
}
示例11: __put_task_struct
void __put_task_struct(struct task_struct *tsk)
{
WARN_ON(!(tsk->exit_state & (EXIT_DEAD | EXIT_ZOMBIE)));
WARN_ON(atomic_read(&tsk->usage));
WARN_ON(tsk == current);
if (unlikely(tsk->audit_context))
audit_free(tsk);
security_task_free(tsk);
free_uid(tsk->user);
put_group_info(tsk->group_info);
if (!profile_handoff_task(tsk))
free_task(tsk);
}
示例12: sys_setgroups16
asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist)
{
struct group_info *group_info;
int retval;
if (!capable(CAP_SETGID))
return -EPERM;
if ((unsigned)gidsetsize > NGROUPS_MAX)
return -EINVAL;
group_info = groups_alloc(gidsetsize);
if (!group_info)
return -ENOMEM;
retval = groups16_from_user(group_info, grouplist);
if (retval) {
put_group_info(group_info);
return retval;
}
retval = set_current_groups(group_info);
put_group_info(group_info);
return retval;
}
示例13: mdt_identity_entry_free
static void mdt_identity_entry_free(struct upcall_cache *cache,
struct upcall_cache_entry *entry)
{
struct md_identity *identity = &entry->u.identity;
if (identity->mi_ginfo) {
put_group_info(identity->mi_ginfo);
identity->mi_ginfo = NULL;
}
if (identity->mi_nperms) {
LASSERT(identity->mi_perms);
OBD_FREE(identity->mi_perms,
identity->mi_nperms * sizeof(struct md_perm));
identity->mi_nperms = 0;
}
}
示例14: task_state
static inline char * task_state(struct task_struct *p, char *buffer)
{
struct group_info *group_info;
int g;
struct fdtable *fdt = NULL;
read_lock(&tasklist_lock);
buffer += sprintf(buffer,
"State:\t%s\n"
"SleepAVG:\t%lu%%\n"
"Tgid:\t%d\n"
"Pid:\t%d\n"
"PPid:\t%d\n"
"TracerPid:\t%d\n"
"Uid:\t%d\t%d\t%d\t%d\n"
"Gid:\t%d\t%d\t%d\t%d\n",
get_task_state(p),
(p->sleep_avg/1024)*100/(1020000000/1024),
p->tgid,
p->pid, pid_alive(p) ? p->group_leader->real_parent->tgid : 0,
pid_alive(p) && p->ptrace ? p->parent->pid : 0,
p->uid, p->euid, p->suid, p->fsuid,
p->gid, p->egid, p->sgid, p->fsgid);
read_unlock(&tasklist_lock);
task_lock(p);
rcu_read_lock();
if (p->files)
fdt = files_fdtable(p->files);
buffer += sprintf(buffer,
"FDSize:\t%d\n"
"Groups:\t",
fdt ? fdt->max_fds : 0);
rcu_read_unlock();
group_info = p->group_info;
get_group_info(group_info);
task_unlock(p);
for (g = 0; g < min(group_info->ngroups,NGROUPS_SMALL); g++)
buffer += sprintf(buffer, "%d ", GROUP_AT(group_info,g));
put_group_info(group_info);
buffer += sprintf(buffer, "\n");
return buffer;
}
示例15: task_state
static inline void task_state(struct seq_file *m, struct pid *pid,
struct task_struct *p)
{
struct group_info *group_info;
int g;
struct fdtable *fdt = NULL;
rcu_read_lock();
seq_printf(m,
"State:\t%s\n"
"SleepAVG:\t%lu%%\n"
"Tgid:\t%d\n"
"Pid:\t%d\n"
"PPid:\t%d\n"
"TracerPid:\t%d\n"
"Uid:\t%d\t%d\t%d\t%d\n"
"Gid:\t%d\t%d\t%d\t%d\n",
get_task_state(p),
(p->sleep_avg/1024)*100/(1020000000/1024),
p->tgid, p->pid,
pid_alive(p) ? rcu_dereference(p->real_parent)->tgid : 0,
pid_alive(p) && p->ptrace ? rcu_dereference(p->parent)->pid : 0,
p->uid, p->euid, p->suid, p->fsuid,
p->gid, p->egid, p->sgid, p->fsgid);
task_lock(p);
if (p->files)
fdt = files_fdtable(p->files);
seq_printf(m,
"FDSize:\t%d\n"
"Groups:\t",
fdt ? fdt->max_fds : 0);
rcu_read_unlock();
group_info = p->group_info;
get_group_info(group_info);
task_unlock(p);
for (g = 0; g < min(group_info->ngroups, NGROUPS_SMALL); g++)
seq_printf(m, "%d ", GROUP_AT(group_info, g));
put_group_info(group_info);
seq_printf(m, "\n");
}