您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ user_path_at函数代码示例

51自学网 2021-06-03 09:23:04
  C++
这篇教程C++ user_path_at函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中user_path_at函数的典型用法代码示例。如果您正苦于以下问题:C++ user_path_at函数的具体用法?C++ user_path_at怎么用?C++ user_path_at使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了user_path_at函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SYSCALL_DEFINE5

SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,		gid_t, group, int, flag){	struct path path;	int error = -EINVAL;	int lookup_flags;	if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH)) != 0)		goto out;	lookup_flags = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW;	if (flag & AT_EMPTY_PATH)		lookup_flags |= LOOKUP_EMPTY;	error = user_path_at(dfd, filename, lookup_flags, &path);	if (error)		goto out;//ASUS_BSP +++ Jimmy,Josh "remove fuse"	if(strcmp(path.mnt->mnt_mountpoint->d_iname,"sdcard")==0){		error = -ENOSYS;		goto out_release;	}//ASUS_BSP --- Jimmy,Josh "remove fuse"	error = mnt_want_write(path.mnt);	if (error)		goto out_release;	error = chown_common(&path, user, group);	mnt_drop_write(path.mnt);out_release:	path_put(&path);out:	return error;}
开发者ID:SmokyBob,项目名称:android_kernel_asus_padfone2,代码行数:32,


示例2: SYSCALL_DEFINE3

SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode){	struct path path;	struct inode *inode;	int error;	struct iattr newattrs;	unsigned int lookup_flags = LOOKUP_FOLLOW;retry:	error = user_path_at(dfd, filename, lookup_flags, &path);	if (error)		goto out;	inode = path.dentry->d_inode;	error = mnt_want_write(path.mnt);	if (error)		goto dput_and_out;	mutex_lock(&inode->i_mutex);	if (mode == (mode_t) -1)		mode = inode->i_mode;	newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);	newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;	error = notify_change(path.dentry, &newattrs);	mutex_unlock(&inode->i_mutex);	mnt_drop_write(path.mnt);dput_and_out:	path_put(&path);	if (retry_estale(error, lookup_flags)) {		lookup_flags |= LOOKUP_REVAL;		goto retry;	}out:	return error;}
开发者ID:3null,项目名称:fastsocket,代码行数:33,


示例3: SYSCALL_DEFINE5

SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,		gid_t, group, int, flag){	struct path path;	int error = -EINVAL;	int lookup_flags;	if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH)) != 0)		goto out;	lookup_flags = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW;	if (flag & AT_EMPTY_PATH)		lookup_flags |= LOOKUP_EMPTY;	error = user_path_at(dfd, filename, lookup_flags, &path);	if (error)		goto out;	error = mnt_want_write(path.mnt);	if (error)		goto out_release;	error = chown_common(&path, user, group);	mnt_drop_write(path.mnt);out_release:	path_put(&path);out:	return error;}
开发者ID:boa19861105,项目名称:Blackout-Monarudo,代码行数:26,


示例4: SYSCALL_DEFINE1

SYSCALL_DEFINE1(chroot, const char __user *, filename){	struct path path;	int error;	unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_DIRECTORY;retry:	error = user_path_at(AT_FDCWD, filename, lookup_flags, &path);	if (error)		goto out;	error = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_CHDIR);	if (error)		goto dput_and_out;	error = -EPERM;	if (!nsown_capable(CAP_SYS_CHROOT))		goto dput_and_out;	error = security_path_chroot(&path);	if (error)		goto dput_and_out;	set_fs_root(current->fs, &path);	error = 0;dput_and_out:	path_put(&path);	if (retry_estale(error, lookup_flags)) {		lookup_flags |= LOOKUP_REVAL;		goto retry;	}out:	return error;}
开发者ID:wpwrak,项目名称:ben-wpan-linux,代码行数:32,


示例5: SYSCALL_DEFINE5

SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,		gid_t, group, int, flag){	struct path path;	int error = -EINVAL;	unsigned int lookup_flags;	if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)		goto out;	lookup_flags = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW;retry:	error = user_path_at(dfd, filename, lookup_flags, &path);	if (error)		goto out;	error = mnt_want_write(path.mnt);	if (error)		goto out_release;	error = chown_common(path.dentry, user, group);	mnt_drop_write(path.mnt);out_release:	path_put(&path);	if (retry_estale(error, lookup_flags)) {		lookup_flags |= LOOKUP_REVAL;		goto retry;	}out:	return error;}
开发者ID:3null,项目名称:fastsocket,代码行数:29,


示例6: SYSCALL_DEFINE3

SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode){	struct path path;	struct inode *inode;	int error;	struct iattr newattrs;	error = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path);	if (error)		goto out;	inode = path.dentry->d_inode;	error = mnt_want_write(path.mnt);	if (error)		goto dput_and_out;	mutex_lock(&inode->i_mutex);	error = security_path_chmod(path.dentry, path.mnt, mode);	if (error)		goto out_unlock;	if (mode == (mode_t) -1)		mode = inode->i_mode;	newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);	newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;	error = notify_change(path.dentry, &newattrs);out_unlock:	mutex_unlock(&inode->i_mutex);	mnt_drop_write(path.mnt);dput_and_out:	path_put(&path);out:	return error;}
开发者ID:kalltkaffe,项目名称:galaxy-2636,代码行数:32,


示例7: SYSCALL_DEFINE1

SYSCALL_DEFINE1(chdir, const char __user *, filename){	struct path path;	int error;	unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_DIRECTORY;retry:	error = user_path_at(AT_FDCWD, filename, lookup_flags, &path);	if (error)		goto out;	error = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_ACCESS);	if (error)		goto dput_and_out;	set_fs_pwd(current->fs, &path);dput_and_out:	path_put(&path);	if (retry_estale(error, lookup_flags)) {		lookup_flags |= LOOKUP_REVAL;		goto retry;	}out:	return error;}
开发者ID:3null,项目名称:fastsocket,代码行数:25,


示例8: SYSCALL_DEFINE4

SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname,		char __user *, buf, int, bufsiz){	struct path path;	int error;	unsigned int lookup_flags = 0;	if (bufsiz <= 0)		return -EINVAL;retry:	error = user_path_at(dfd, pathname, lookup_flags, &path);	if (!error) {		struct inode *inode = path.dentry->d_inode;		error = -EINVAL;		if (inode->i_op->readlink) {			error = security_inode_readlink(path.dentry);			if (!error) {				touch_atime(path.mnt, path.dentry);				error = inode->i_op->readlink(path.dentry,							      buf, bufsiz);			}		}		path_put(&path);		if (retry_estale(error, lookup_flags)) {			lookup_flags |= LOOKUP_REVAL;			goto retry;		}	}	return error;}
开发者ID:3null,项目名称:fastsocket,代码行数:32,


示例9: vfs_fstatat

int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,		int flag){	struct path path;	int error = -EINVAL;	unsigned int lookup_flags = 0;	if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |		      AT_EMPTY_PATH)) != 0)		goto out;	if (!(flag & AT_SYMLINK_NOFOLLOW))		lookup_flags |= LOOKUP_FOLLOW;	if (flag & AT_EMPTY_PATH)		lookup_flags |= LOOKUP_EMPTY;retry:	error = user_path_at(dfd, filename, lookup_flags, &path);	if (error)		goto out;	error = vfs_getattr(&path, stat);	path_put(&path);	if (retry_estale(error, lookup_flags)) {		lookup_flags |= LOOKUP_REVAL;		goto retry;	}out:	return error;}
开发者ID:19Dan01,项目名称:linux,代码行数:29,


示例10: vfs_fstatat

int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,		int flag){	struct path path;	int error = -EINVAL;	int lookup_flags = 0;	if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT |		      AT_EMPTY_PATH)) != 0)		goto out;	if (!(flag & AT_SYMLINK_NOFOLLOW))		lookup_flags |= LOOKUP_FOLLOW;	if (flag & AT_EMPTY_PATH)		lookup_flags |= LOOKUP_EMPTY;	error = user_path_at(dfd, filename, lookup_flags, &path);	if (error)		goto out;	error = vfs_getattr(path.mnt, path.dentry, stat);	if (!error)		zpath_realsize(path.dentry, &stat->size);	path_put(&path);out:	return error;}
开发者ID:LiquidSmokeX64,项目名称:URKernel,代码行数:27,


示例11: do_fchownat

int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group,		int flag){	struct path path;	int error = -EINVAL;	int lookup_flags;	if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH)) != 0)		goto out;	lookup_flags = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW;	if (flag & AT_EMPTY_PATH)		lookup_flags |= LOOKUP_EMPTY;retry:	error = user_path_at(dfd, filename, lookup_flags, &path);	if (error)		goto out;	error = mnt_want_write(path.mnt);	if (error)		goto out_release;	error = chown_common(&path, user, group);	mnt_drop_write(path.mnt);out_release:	path_put(&path);	if (retry_estale(error, lookup_flags)) {		lookup_flags |= LOOKUP_REVAL;		goto retry;	}out:	return error;}
开发者ID:krzk,项目名称:linux,代码行数:31,


示例12: SYSCALL_DEFINE4

SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname,		char __user *, buf, int, bufsiz){	struct path path;	int error;	if (bufsiz <= 0)		return -EINVAL;	error = user_path_at(dfd, pathname, 0, &path);	if (!error) {		struct inode *inode = path.dentry->d_inode;		error = -EINVAL;		if (inode->i_op->readlink) {			error = security_inode_readlink(path.dentry);			if (!error) {				touch_atime(path.mnt, path.dentry);				error = inode->i_op->readlink(path.dentry,							      buf, bufsiz);			}		}		path_put(&path);	}	return error;}
开发者ID:ANFS,项目名称:ANFS-kernel,代码行数:26,


示例13: user_statfs

int user_statfs(const char __user *pathname, struct kstatfs *st){	struct path path;	int error = user_path_at(AT_FDCWD, pathname, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &path);	if (!error) {		error = vfs_statfs(&path, st);		path_put(&path);	}	return error;}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:10,


示例14: SYSCALL_DEFINE3

SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode){	const struct cred *old_cred;	struct cred *override_cred;	struct path path;	struct inode *inode;	int res;	if (mode & ~S_IRWXO)			return -EINVAL;	override_cred = prepare_creds();	if (!override_cred)		return -ENOMEM;	override_cred->fsuid = override_cred->uid;	override_cred->fsgid = override_cred->gid;	if (!issecure(SECURE_NO_SETUID_FIXUP)) {				if (override_cred->uid)			cap_clear(override_cred->cap_effective);		else			override_cred->cap_effective =				override_cred->cap_permitted;	}	old_cred = override_creds(override_cred);	res = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path);	if (res)		goto out;	inode = path.dentry->d_inode;	if ((mode & MAY_EXEC) && S_ISREG(inode->i_mode)) {		res = -EACCES;		if (path.mnt->mnt_flags & MNT_NOEXEC)			goto out_path_release;	}	res = inode_permission(inode, mode | MAY_ACCESS);		if (res || !(mode & S_IWOTH) || special_file(inode->i_mode))		goto out_path_release;	if (__mnt_is_readonly(path.mnt))		res = -EROFS;out_path_release:	path_put(&path);out:	revert_creds(old_cred);	put_cred(override_cred);	return res;}
开发者ID:kuzetsa,项目名称:B1RB_htc_msm8974,代码行数:55,


示例15: vfs_lstat_fd

int vfs_lstat_fd(int dfd, char __user *name, struct kstat *stat){	struct path path;	int error;	error = user_path_at(dfd, name, 0, &path);	if (!error) {		error = vfs_getattr(path.mnt, path.dentry, stat);		path_put(&path);	}	return error;}
开发者ID:458941968,项目名称:mini2440-kernel-2.6.29,代码行数:12,


示例16: SYSCALL_DEFINE3

SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, umode_t, mode){	struct path path;	int error;	error = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path);	if (!error) {		error = chmod_common(&path, mode);		path_put(&path);	}	return error;}
开发者ID:boa19861105,项目名称:Blackout-Monarudo,代码行数:12,


示例17: SYSCALL_DEFINE4

/* * This is the system call interface. This communicates with * the user-level programs. Currently this only supports diskquota * calls. Maybe we need to add the process quotas etc. in the future, * but we probably should use rlimits for that. */SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,		qid_t, id, void __user *, addr){	uint cmds, type;	struct super_block *sb = NULL;	struct path path, *pathp = NULL;	int ret;	cmds = cmd >> SUBCMDSHIFT;	type = cmd & SUBCMDMASK;	/*	 * As a special case Q_SYNC can be called without a specific device.	 * It will iterate all superblocks that have quota enabled and call	 * the sync action on each of them.	 */	if (!special) {		if (cmds == Q_SYNC)			return quota_sync_all(type);		return -ENODEV;	}	/*	 * Path for quotaon has to be resolved before grabbing superblock	 * because that gets s_umount sem which is also possibly needed by path	 * resolution (think about autofs) and thus deadlocks could arise.	 */	if (cmds == Q_QUOTAON) {		ret = user_path_at(AT_FDCWD, addr, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &path);		if (ret)			pathp = ERR_PTR(ret);		else			pathp = &path;	}	sb = quotactl_block(special, cmds);	if (IS_ERR(sb)) {		ret = PTR_ERR(sb);		goto out;	}	ret = do_quotactl(sb, type, cmds, id, addr, pathp);	drop_super(sb);out:	if (pathp && !IS_ERR(pathp))		path_put(pathp);	return ret;}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:55,


示例18: do_utimes

/* * do_utimes - change times on filename or file descriptor * @dfd: open file descriptor, -1 or AT_FDCWD * @filename: path name or NULL * @times: new times or NULL * @flags: zero or more flags (only AT_SYMLINK_NOFOLLOW for the moment) * * If filename is NULL and dfd refers to an open file, then operate on * the file.  Otherwise look up filename, possibly using dfd as a * starting point. * * If times==NULL, set access and modification to current time, * must be owner or have write permission. * Else, update from *times, must be owner or super user. */long do_utimes(int dfd, const char __user *filename, struct timespec *times,	       int flags){	int error = -EINVAL;	if (times && (!nsec_valid(times[0].tv_nsec) ||		      !nsec_valid(times[1].tv_nsec))) {		goto out;	}	if (flags & ~AT_SYMLINK_NOFOLLOW)		goto out;	if (filename == NULL && dfd != AT_FDCWD) {		struct fd f;		if (flags & AT_SYMLINK_NOFOLLOW)			goto out;		f = fdget(dfd);		error = -EBADF;		if (!f.file)			goto out;		error = utimes_common(&f.file->f_path, times);		fdput(f);	} else {		struct path path;		int lookup_flags = 0;		if (!(flags & AT_SYMLINK_NOFOLLOW))			lookup_flags |= LOOKUP_FOLLOW;retry:		error = user_path_at(dfd, filename, lookup_flags, &path);		if (error)			goto out;		error = utimes_common(&path, times);		path_put(&path);		if (retry_estale(error, lookup_flags)) {			lookup_flags |= LOOKUP_REVAL;			goto retry;		}	}out:	return error;}
开发者ID:020gzh,项目名称:linux,代码行数:63,


示例19: SYSCALL_DEFINE3

SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, umode_t, mode){	struct path path;	int error;	unsigned int lookup_flags = LOOKUP_FOLLOW;retry:	error = user_path_at(dfd, filename, lookup_flags, &path);	if (!error) {		error = chmod_common(&path, mode);		path_put(&path);		if (retry_estale(error, lookup_flags)) {			lookup_flags |= LOOKUP_REVAL;			goto retry;		}	}	return error;}
开发者ID:wpwrak,项目名称:ben-wpan-linux,代码行数:17,


示例20: user_statfs

int user_statfs(const char __user *pathname, struct kstatfs *st){	struct path path;	int error;	unsigned int lookup_flags = LOOKUP_FOLLOW;retry:	error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path);	if (!error) {		error = vfs_statfs(&path, st);		path_put(&path);		if (retry_estale(error, lookup_flags)) {			lookup_flags |= LOOKUP_REVAL;			goto retry;		}	}	return error;}
开发者ID:3null,项目名称:fastsocket,代码行数:17,


示例21: sys_SYNOUtime

/** * sys_SYNOUtime() is used to update create time. * * @param	filename	The file to be changed create time. * 			times	Create time should be stored in  *				actime field. * @return	0	success *			!0	error */asmlinkage long sys_SYNOUtime(char * filename, struct utimbuf * times){	int error;	struct path path;	struct inode *inode = NULL;	struct iattr newattrs;	error = user_path_at(AT_FDCWD, filename, LOOKUP_FOLLOW, &path);	if (error)		goto out;	inode = path.dentry->d_inode;	error = -EROFS;	if (IS_RDONLY(inode))		goto dput_and_out;	if (times) {		error = get_user(newattrs.ia_ctime.tv_sec, &times->actime);		newattrs.ia_ctime.tv_nsec = 0;		if (error)			goto dput_and_out;		newattrs.ia_valid = ATTR_CREATE_TIME;		mutex_lock(&inode->i_mutex);		if (inode->i_op && inode->i_op->setattr)  {			error = inode->i_op->setattr(path.dentry, &newattrs);		} else {			error = inode_change_ok(inode, &newattrs);			if (!error) {				setattr_copy(inode, &newattrs);				mark_inode_dirty(inode);				error = 0;			}		}		mutex_unlock(&inode->i_mutex);	}dput_and_out:	path_put(&path);out:	return error;}
开发者ID:Vincentxiaojie,项目名称:xpenology,代码行数:51,


示例22: do_sys_truncate

static long do_sys_truncate(const char __user *pathname, loff_t length){	unsigned int lookup_flags = LOOKUP_FOLLOW;	struct path path;	int error;	if (length < 0)	/* sorry, but loff_t says... */		return -EINVAL;retry:	error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path);	if (!error) {		error = vfs_truncate(&path, length);		path_put(&path);	}	if (retry_estale(error, lookup_flags)) {		lookup_flags |= LOOKUP_REVAL;		goto retry;	}	return error;}
开发者ID:wpwrak,项目名称:ben-wpan-linux,代码行数:21,


示例23: SYSCALL_DEFINE5

/** * sys_name_to_handle_at: convert name to handle * @dfd: directory relative to which name is interpreted if not absolute * @name: name that should be converted to handle. * @handle: resulting file handle * @mnt_id: mount id of the file system containing the file * @flag: flag value to indicate whether to follow symlink or not * * @handle->handle_size indicate the space available to store the * variable part of the file handle in bytes. If there is not * enough space, the field is updated to return the minimum * value required. */SYSCALL_DEFINE5(name_to_handle_at, int, dfd, const char __user *, name,		struct file_handle __user *, handle, int __user *, mnt_id,		int, flag){	struct path path;	int lookup_flags;	int err;	if ((flag & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0)		return -EINVAL;	lookup_flags = (flag & AT_SYMLINK_FOLLOW) ? LOOKUP_FOLLOW : 0;	if (flag & AT_EMPTY_PATH)		lookup_flags |= LOOKUP_EMPTY;	err = user_path_at(dfd, name, lookup_flags, &path);	if (!err) {		err = do_sys_name_to_handle(&path, handle, mnt_id);		path_put(&path);	}	return err;}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:34,


示例24: SYSCALL_DEFINE5

SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,		gid_t, group, int, flag){	struct path path;	int error = -EINVAL;	int follow;	if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)		goto out;	follow = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW;	error = user_path_at(dfd, filename, follow, &path);	if (error)		goto out;	error = mnt_want_write(path.mnt);	if (error)		goto out_release;	error = chown_common(path.dentry, user, group, path.mnt);	mnt_drop_write(path.mnt);out_release:	path_put(&path);out:	return error;}
开发者ID:mikeberkelaar,项目名称:grhardened,代码行数:24,


示例25: sys_faccessat

/* * access() needs to use the real uid/gid, not the effective uid/gid. * We do this by temporarily clearing all FS-related capabilities and * switching the fsuid/fsgid around to the real ones. */asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode){	struct path path;	struct inode *inode;	int old_fsuid, old_fsgid;	kernel_cap_t uninitialized_var(old_cap);  /* !SECURE_NO_SETUID_FIXUP */	int res;	if (mode & ~S_IRWXO)	/* where's F_OK, X_OK, W_OK, R_OK? */		return -EINVAL;	old_fsuid = current->fsuid;	old_fsgid = current->fsgid;	current->fsuid = current->uid;	current->fsgid = current->gid;	if (!issecure(SECURE_NO_SETUID_FIXUP)) {		/*		 * Clear the capabilities if we switch to a non-root user		 */#ifndef CONFIG_SECURITY_FILE_CAPABILITIES		/*		 * FIXME: There is a race here against sys_capset.  The		 * capabilities can change yet we will restore the old		 * value below.  We should hold task_capabilities_lock,		 * but we cannot because user_path_at can sleep.		 */#endif /* ndef CONFIG_SECURITY_FILE_CAPABILITIES */		if (current->uid)			old_cap = cap_set_effective(__cap_empty_set);		else			old_cap = cap_set_effective(current->cap_permitted);	}	res = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path);	if (res)		goto out;	inode = path.dentry->d_inode;	if ((mode & MAY_EXEC) && S_ISREG(inode->i_mode)) {		/*		 * MAY_EXEC on regular files is denied if the fs is mounted		 * with the "noexec" flag.		 */		res = -EACCES;		if (path.mnt->mnt_flags & MNT_NOEXEC)			goto out_path_release;	}	res = inode_permission(inode, mode | MAY_ACCESS);	/* SuS v2 requires we report a read only fs too */	if (res || !(mode & S_IWOTH) || special_file(inode->i_mode))		goto out_path_release;	/*	 * This is a rare case where using __mnt_is_readonly()	 * is OK without a mnt_want/drop_write() pair.  Since	 * no actual write to the fs is performed here, we do	 * not need to telegraph to that to anyone.	 *	 * By doing this, we accept that this access is	 * inherently racy and know that the fs may change	 * state before we even see this result.	 */	if (__mnt_is_readonly(path.mnt))		res = -EROFS;out_path_release:	path_put(&path);out:	current->fsuid = old_fsuid;	current->fsgid = old_fsgid;	if (!issecure(SECURE_NO_SETUID_FIXUP))		cap_set_effective(old_cap);	return res;}
开发者ID:mpalmer,项目名称:linux-2.6,代码行数:84,



注:本文中的user_path_at函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ user_path_dir函数代码示例
C++ user_path函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。