Improve *access*() parameter name consistency.
The current code mixes the use of `flags' and `mode'. This is a bit confusing, since the faccessat() function as a `flag' parameter to store the AT_ flag. Make this less confusing by using the same name as used in the POSIX specification -- `amode'.
This commit is contained in:
parent
80b93ff342
commit
d3a993d46b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=227691
@ -86,7 +86,7 @@
|
|||||||
struct l_utimbuf *times); }
|
struct l_utimbuf *times); }
|
||||||
31 AUE_NULL UNIMPL stty
|
31 AUE_NULL UNIMPL stty
|
||||||
32 AUE_NULL UNIMPL gtty
|
32 AUE_NULL UNIMPL gtty
|
||||||
33 AUE_ACCESS STD { int linux_access(char *path, l_int flags); }
|
33 AUE_ACCESS STD { int linux_access(char *path, l_int amode); }
|
||||||
34 AUE_NICE STD { int linux_nice(l_int inc); }
|
34 AUE_NICE STD { int linux_nice(l_int inc); }
|
||||||
35 AUE_NULL UNIMPL ftime
|
35 AUE_NULL UNIMPL ftime
|
||||||
36 AUE_SYNC NOPROTO { int sync(void); }
|
36 AUE_SYNC NOPROTO { int sync(void); }
|
||||||
@ -490,7 +490,7 @@
|
|||||||
char *buf, l_int bufsiz); }
|
char *buf, l_int bufsiz); }
|
||||||
306 AUE_FCHMODAT STD { int linux_fchmodat(l_int dfd, const char *filename, \
|
306 AUE_FCHMODAT STD { int linux_fchmodat(l_int dfd, const char *filename, \
|
||||||
l_mode_t mode); }
|
l_mode_t mode); }
|
||||||
307 AUE_FACCESSAT STD { int linux_faccessat(l_int dfd, const char *filename, l_int mode); }
|
307 AUE_FACCESSAT STD { int linux_faccessat(l_int dfd, const char *filename, l_int amode); }
|
||||||
308 AUE_NULL STD { int linux_pselect6(void); }
|
308 AUE_NULL STD { int linux_pselect6(void); }
|
||||||
309 AUE_NULL STD { int linux_ppoll(void); }
|
309 AUE_NULL STD { int linux_ppoll(void); }
|
||||||
310 AUE_NULL STD { int linux_unshare(void); }
|
310 AUE_NULL STD { int linux_unshare(void); }
|
||||||
|
@ -113,7 +113,7 @@
|
|||||||
int *alen); }
|
int *alen); }
|
||||||
32 AUE_GETSOCKNAME NOPROTO { int getsockname(int fdes, caddr_t asa, \
|
32 AUE_GETSOCKNAME NOPROTO { int getsockname(int fdes, caddr_t asa, \
|
||||||
int *alen); }
|
int *alen); }
|
||||||
33 AUE_ACCESS NOPROTO { int access(char *path, int flags); }
|
33 AUE_ACCESS NOPROTO { int access(char *path, int amode); }
|
||||||
34 AUE_CHFLAGS NOPROTO { int chflags(char *path, int flags); }
|
34 AUE_CHFLAGS NOPROTO { int chflags(char *path, int flags); }
|
||||||
35 AUE_FCHFLAGS NOPROTO { int fchflags(int fd, int flags); }
|
35 AUE_FCHFLAGS NOPROTO { int fchflags(int fd, int flags); }
|
||||||
36 AUE_SYNC NOPROTO { int sync(void); }
|
36 AUE_SYNC NOPROTO { int sync(void); }
|
||||||
@ -671,7 +671,7 @@
|
|||||||
const char *attrname); }
|
const char *attrname); }
|
||||||
374 AUE_NULL NOPROTO { int __setugid(int flag); }
|
374 AUE_NULL NOPROTO { int __setugid(int flag); }
|
||||||
375 AUE_NULL UNIMPL nfsclnt
|
375 AUE_NULL UNIMPL nfsclnt
|
||||||
376 AUE_EACCESS NOPROTO { int eaccess(char *path, int flags); }
|
376 AUE_EACCESS NOPROTO { int eaccess(char *path, int amode); }
|
||||||
377 AUE_NULL UNIMPL afs_syscall
|
377 AUE_NULL UNIMPL afs_syscall
|
||||||
378 AUE_NMOUNT STD { int freebsd32_nmount(struct iovec32 *iovp, \
|
378 AUE_NMOUNT STD { int freebsd32_nmount(struct iovec32 *iovp, \
|
||||||
unsigned int iovcnt, int flags); }
|
unsigned int iovcnt, int flags); }
|
||||||
@ -911,7 +911,7 @@
|
|||||||
u_int32_t id1, u_int32_t id2, \
|
u_int32_t id1, u_int32_t id2, \
|
||||||
size_t cpusetsize, \
|
size_t cpusetsize, \
|
||||||
const cpuset_t *mask); }
|
const cpuset_t *mask); }
|
||||||
489 AUE_FACCESSAT NOPROTO { int faccessat(int fd, char *path, int mode, \
|
489 AUE_FACCESSAT NOPROTO { int faccessat(int fd, char *path, int amode, \
|
||||||
int flag); }
|
int flag); }
|
||||||
490 AUE_FCHMODAT NOPROTO { int fchmodat(int fd, const char *path, \
|
490 AUE_FCHMODAT NOPROTO { int fchmodat(int fd, const char *path, \
|
||||||
mode_t mode, int flag); }
|
mode_t mode, int flag); }
|
||||||
|
@ -565,16 +565,16 @@ linux_access(struct thread *td, struct linux_access_args *args)
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* linux convention */
|
/* linux convention */
|
||||||
if (args->flags & ~(F_OK | X_OK | W_OK | R_OK))
|
if (args->amode & ~(F_OK | X_OK | W_OK | R_OK))
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
LCONVPATHEXIST(td, args->path, &path);
|
LCONVPATHEXIST(td, args->path, &path);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (ldebug(access))
|
if (ldebug(access))
|
||||||
printf(ARGS(access, "%s, %d"), path, args->flags);
|
printf(ARGS(access, "%s, %d"), path, args->amode);
|
||||||
#endif
|
#endif
|
||||||
error = kern_access(td, path, UIO_SYSSPACE, args->flags);
|
error = kern_access(td, path, UIO_SYSSPACE, args->amode);
|
||||||
LFREEPATH(path);
|
LFREEPATH(path);
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
@ -587,7 +587,7 @@ linux_faccessat(struct thread *td, struct linux_faccessat_args *args)
|
|||||||
int error, dfd;
|
int error, dfd;
|
||||||
|
|
||||||
/* linux convention */
|
/* linux convention */
|
||||||
if (args->mode & ~(F_OK | X_OK | W_OK | R_OK))
|
if (args->amode & ~(F_OK | X_OK | W_OK | R_OK))
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
|
dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
|
||||||
@ -595,11 +595,11 @@ linux_faccessat(struct thread *td, struct linux_faccessat_args *args)
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (ldebug(access))
|
if (ldebug(access))
|
||||||
printf(ARGS(access, "%s, %d"), path, args->mode);
|
printf(ARGS(access, "%s, %d"), path, args->amode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
error = kern_accessat(td, dfd, path, UIO_SYSSPACE, 0 /* XXX */,
|
error = kern_accessat(td, dfd, path, UIO_SYSSPACE, 0 /* XXX */,
|
||||||
args->mode);
|
args->amode);
|
||||||
LFREEPATH(path);
|
LFREEPATH(path);
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
|
@ -488,7 +488,7 @@ svr4_sys_access(td, uap)
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
CHECKALTEXIST(td, uap->path, &newpath);
|
CHECKALTEXIST(td, uap->path, &newpath);
|
||||||
error = kern_access(td, newpath, UIO_SYSSPACE, uap->flags);
|
error = kern_access(td, newpath, UIO_SYSSPACE, uap->amode);
|
||||||
free(newpath, M_TEMP);
|
free(newpath, M_TEMP);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
31 AUE_NULL UNIMPL stty
|
31 AUE_NULL UNIMPL stty
|
||||||
32 AUE_NULL UNIMPL gtty
|
32 AUE_NULL UNIMPL gtty
|
||||||
33 AUE_NULL STD { int svr4_sys_access(char *path, \
|
33 AUE_NULL STD { int svr4_sys_access(char *path, \
|
||||||
int flags); }
|
int amode); }
|
||||||
34 AUE_NULL STD { int svr4_sys_nice(int prio); }
|
34 AUE_NULL STD { int svr4_sys_nice(int prio); }
|
||||||
35 AUE_NULL UNIMPL statfs
|
35 AUE_NULL UNIMPL statfs
|
||||||
36 AUE_NULL NOPROTO { int sync(void); }
|
36 AUE_NULL NOPROTO { int sync(void); }
|
||||||
|
@ -243,7 +243,7 @@ ibcs2_access(td, uap)
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
CHECKALTEXIST(td, uap->path, &path);
|
CHECKALTEXIST(td, uap->path, &path);
|
||||||
error = kern_access(td, path, UIO_SYSSPACE, uap->flags);
|
error = kern_access(td, path, UIO_SYSSPACE, uap->amode);
|
||||||
free(path, M_TEMP);
|
free(path, M_TEMP);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
struct ibcs2_utimbuf *buf); }
|
struct ibcs2_utimbuf *buf); }
|
||||||
31 AUE_NULL UNIMPL ibcs2_stty
|
31 AUE_NULL UNIMPL ibcs2_stty
|
||||||
32 AUE_NULL UNIMPL ibcs2_gtty
|
32 AUE_NULL UNIMPL ibcs2_gtty
|
||||||
33 AUE_ACCESS STD { int ibcs2_access(char *path, int flags); }
|
33 AUE_ACCESS STD { int ibcs2_access(char *path, int amode); }
|
||||||
34 AUE_NICE STD { int ibcs2_nice(int incr); }
|
34 AUE_NICE STD { int ibcs2_nice(int incr); }
|
||||||
35 AUE_STATFS STD { int ibcs2_statfs(char *path, \
|
35 AUE_STATFS STD { int ibcs2_statfs(char *path, \
|
||||||
struct ibcs2_statfs *buf, int len, \
|
struct ibcs2_statfs *buf, int len, \
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
struct l_utimbuf *times); }
|
struct l_utimbuf *times); }
|
||||||
31 AUE_NULL UNIMPL stty
|
31 AUE_NULL UNIMPL stty
|
||||||
32 AUE_NULL UNIMPL gtty
|
32 AUE_NULL UNIMPL gtty
|
||||||
33 AUE_ACCESS STD { int linux_access(char *path, l_int flags); }
|
33 AUE_ACCESS STD { int linux_access(char *path, l_int amode); }
|
||||||
34 AUE_NICE STD { int linux_nice(l_int inc); }
|
34 AUE_NICE STD { int linux_nice(l_int inc); }
|
||||||
35 AUE_NULL UNIMPL ftime
|
35 AUE_NULL UNIMPL ftime
|
||||||
36 AUE_SYNC NOPROTO { int sync(void); }
|
36 AUE_SYNC NOPROTO { int sync(void); }
|
||||||
@ -500,7 +500,7 @@
|
|||||||
char *buf, l_int bufsiz); }
|
char *buf, l_int bufsiz); }
|
||||||
306 AUE_FCHMODAT STD { int linux_fchmodat(l_int dfd, const char *filename, \
|
306 AUE_FCHMODAT STD { int linux_fchmodat(l_int dfd, const char *filename, \
|
||||||
l_mode_t mode); }
|
l_mode_t mode); }
|
||||||
307 AUE_FACCESSAT STD { int linux_faccessat(l_int dfd, const char *filename, l_int mode); }
|
307 AUE_FACCESSAT STD { int linux_faccessat(l_int dfd, const char *filename, l_int amode); }
|
||||||
308 AUE_NULL STD { int linux_pselect6(void); }
|
308 AUE_NULL STD { int linux_pselect6(void); }
|
||||||
309 AUE_NULL STD { int linux_ppoll(void); }
|
309 AUE_NULL STD { int linux_ppoll(void); }
|
||||||
310 AUE_NULL STD { int linux_unshare(void); }
|
310 AUE_NULL STD { int linux_unshare(void); }
|
||||||
|
@ -115,7 +115,7 @@
|
|||||||
32 AUE_GETSOCKNAME STD { int getsockname(int fdes, \
|
32 AUE_GETSOCKNAME STD { int getsockname(int fdes, \
|
||||||
struct sockaddr * __restrict asa, \
|
struct sockaddr * __restrict asa, \
|
||||||
__socklen_t * __restrict alen); }
|
__socklen_t * __restrict alen); }
|
||||||
33 AUE_ACCESS STD { int access(char *path, int flags); }
|
33 AUE_ACCESS STD { int access(char *path, int amode); }
|
||||||
34 AUE_CHFLAGS STD { int chflags(char *path, int flags); }
|
34 AUE_CHFLAGS STD { int chflags(char *path, int flags); }
|
||||||
35 AUE_FCHFLAGS STD { int fchflags(int fd, int flags); }
|
35 AUE_FCHFLAGS STD { int fchflags(int fd, int flags); }
|
||||||
36 AUE_SYNC STD { int sync(void); }
|
36 AUE_SYNC STD { int sync(void); }
|
||||||
@ -671,7 +671,7 @@
|
|||||||
const char *attrname); }
|
const char *attrname); }
|
||||||
374 AUE_NULL STD { int __setugid(int flag); }
|
374 AUE_NULL STD { int __setugid(int flag); }
|
||||||
375 AUE_NULL UNIMPL nfsclnt
|
375 AUE_NULL UNIMPL nfsclnt
|
||||||
376 AUE_EACCESS STD { int eaccess(char *path, int flags); }
|
376 AUE_EACCESS STD { int eaccess(char *path, int amode); }
|
||||||
377 AUE_NULL NOSTD|NOTSTATIC { int afs3_syscall(long syscall, \
|
377 AUE_NULL NOSTD|NOTSTATIC { int afs3_syscall(long syscall, \
|
||||||
long parm1, long parm2, long parm3, \
|
long parm1, long parm2, long parm3, \
|
||||||
long parm4, long parm5, long parm6); }
|
long parm4, long parm5, long parm6); }
|
||||||
@ -870,7 +870,7 @@
|
|||||||
488 AUE_NULL STD { int cpuset_setaffinity(cpulevel_t level, \
|
488 AUE_NULL STD { int cpuset_setaffinity(cpulevel_t level, \
|
||||||
cpuwhich_t which, id_t id, size_t cpusetsize, \
|
cpuwhich_t which, id_t id, size_t cpusetsize, \
|
||||||
const cpuset_t *mask); }
|
const cpuset_t *mask); }
|
||||||
489 AUE_FACCESSAT STD { int faccessat(int fd, char *path, int mode, \
|
489 AUE_FACCESSAT STD { int faccessat(int fd, char *path, int amode, \
|
||||||
int flag); }
|
int flag); }
|
||||||
490 AUE_FCHMODAT STD { int fchmodat(int fd, char *path, mode_t mode, \
|
490 AUE_FCHMODAT STD { int fchmodat(int fd, char *path, mode_t mode, \
|
||||||
int flag); }
|
int flag); }
|
||||||
|
@ -2144,7 +2144,7 @@ vn_access(vp, user_flags, cred, td)
|
|||||||
#ifndef _SYS_SYSPROTO_H_
|
#ifndef _SYS_SYSPROTO_H_
|
||||||
struct access_args {
|
struct access_args {
|
||||||
char *path;
|
char *path;
|
||||||
int flags;
|
int amode;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
int
|
int
|
||||||
@ -2152,18 +2152,18 @@ sys_access(td, uap)
|
|||||||
struct thread *td;
|
struct thread *td;
|
||||||
register struct access_args /* {
|
register struct access_args /* {
|
||||||
char *path;
|
char *path;
|
||||||
int flags;
|
int amode;
|
||||||
} */ *uap;
|
} */ *uap;
|
||||||
{
|
{
|
||||||
|
|
||||||
return (kern_access(td, uap->path, UIO_USERSPACE, uap->flags));
|
return (kern_access(td, uap->path, UIO_USERSPACE, uap->amode));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _SYS_SYSPROTO_H_
|
#ifndef _SYS_SYSPROTO_H_
|
||||||
struct faccessat_args {
|
struct faccessat_args {
|
||||||
int dirfd;
|
int dirfd;
|
||||||
char *path;
|
char *path;
|
||||||
int mode;
|
int amode;
|
||||||
int flag;
|
int flag;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2174,19 +2174,19 @@ sys_faccessat(struct thread *td, struct faccessat_args *uap)
|
|||||||
if (uap->flag & ~AT_EACCESS)
|
if (uap->flag & ~AT_EACCESS)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
return (kern_accessat(td, uap->fd, uap->path, UIO_USERSPACE, uap->flag,
|
return (kern_accessat(td, uap->fd, uap->path, UIO_USERSPACE, uap->flag,
|
||||||
uap->mode));
|
uap->amode));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
kern_access(struct thread *td, char *path, enum uio_seg pathseg, int mode)
|
kern_access(struct thread *td, char *path, enum uio_seg pathseg, int amode)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (kern_accessat(td, AT_FDCWD, path, pathseg, 0, mode));
|
return (kern_accessat(td, AT_FDCWD, path, pathseg, 0, amode));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
|
kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
|
||||||
int flags, int mode)
|
int flag, int amode)
|
||||||
{
|
{
|
||||||
struct ucred *cred, *tmpcred;
|
struct ucred *cred, *tmpcred;
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
@ -2198,7 +2198,7 @@ kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
|
|||||||
* Create and modify a temporary credential instead of one that
|
* Create and modify a temporary credential instead of one that
|
||||||
* is potentially shared.
|
* is potentially shared.
|
||||||
*/
|
*/
|
||||||
if (!(flags & AT_EACCESS)) {
|
if (!(flag & AT_EACCESS)) {
|
||||||
cred = td->td_ucred;
|
cred = td->td_ucred;
|
||||||
tmpcred = crdup(cred);
|
tmpcred = crdup(cred);
|
||||||
tmpcred->cr_uid = cred->cr_ruid;
|
tmpcred->cr_uid = cred->cr_ruid;
|
||||||
@ -2206,7 +2206,7 @@ kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
|
|||||||
td->td_ucred = tmpcred;
|
td->td_ucred = tmpcred;
|
||||||
} else
|
} else
|
||||||
cred = tmpcred = td->td_ucred;
|
cred = tmpcred = td->td_ucred;
|
||||||
AUDIT_ARG_VALUE(mode);
|
AUDIT_ARG_VALUE(amode);
|
||||||
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE |
|
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE |
|
||||||
AUDITVNODE1, pathseg, path, fd, CAP_FSTAT, td);
|
AUDITVNODE1, pathseg, path, fd, CAP_FSTAT, td);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
@ -2214,12 +2214,12 @@ kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
|
|||||||
vfslocked = NDHASGIANT(&nd);
|
vfslocked = NDHASGIANT(&nd);
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
|
|
||||||
error = vn_access(vp, mode, tmpcred, td);
|
error = vn_access(vp, amode, tmpcred, td);
|
||||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||||
vput(vp);
|
vput(vp);
|
||||||
VFS_UNLOCK_GIANT(vfslocked);
|
VFS_UNLOCK_GIANT(vfslocked);
|
||||||
out1:
|
out1:
|
||||||
if (!(flags & AT_EACCESS)) {
|
if (!(flag & AT_EACCESS)) {
|
||||||
td->td_ucred = cred;
|
td->td_ucred = cred;
|
||||||
crfree(tmpcred);
|
crfree(tmpcred);
|
||||||
}
|
}
|
||||||
@ -2232,7 +2232,7 @@ kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg,
|
|||||||
#ifndef _SYS_SYSPROTO_H_
|
#ifndef _SYS_SYSPROTO_H_
|
||||||
struct eaccess_args {
|
struct eaccess_args {
|
||||||
char *path;
|
char *path;
|
||||||
int flags;
|
int amode;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
int
|
int
|
||||||
@ -2240,18 +2240,18 @@ sys_eaccess(td, uap)
|
|||||||
struct thread *td;
|
struct thread *td;
|
||||||
register struct eaccess_args /* {
|
register struct eaccess_args /* {
|
||||||
char *path;
|
char *path;
|
||||||
int flags;
|
int amode;
|
||||||
} */ *uap;
|
} */ *uap;
|
||||||
{
|
{
|
||||||
|
|
||||||
return (kern_eaccess(td, uap->path, UIO_USERSPACE, uap->flags));
|
return (kern_eaccess(td, uap->path, UIO_USERSPACE, uap->amode));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg, int flags)
|
kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg, int amode)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (kern_accessat(td, AT_FDCWD, path, pathseg, AT_EACCESS, flags));
|
return (kern_accessat(td, AT_FDCWD, path, pathseg, AT_EACCESS, amode));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(COMPAT_43)
|
#if defined(COMPAT_43)
|
||||||
|
Loading…
Reference in New Issue
Block a user