Use long for the last argument to VOP_PATHCONF rather than a register_t.
pathconf(2) and fpathconf(2) both return a long. The kern_[f]pathconf() functions now accept a pointer to a long value rather than modifying td_retval directly. Instead, the system calls explicitly store the returned long value in td_retval[0]. Requested by: bde Reviewed by: kib Sponsored by: Chelsio Communications
This commit is contained in:
parent
19a63eb534
commit
b1288166e0
@ -418,7 +418,7 @@ fdesc_pathconf(struct vop_pathconf_args *ap)
|
||||
vref(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
error = kern_fpathconf(curthread, VTOFDESC(vp)->fd_fd,
|
||||
ap->a_name);
|
||||
ap->a_name, ap->a_retval);
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
vunref(vp);
|
||||
return (error);
|
||||
|
@ -316,7 +316,7 @@ nfsvno_getfs(struct nfsfsinfo *sip, int isdgram)
|
||||
* Do the pathconf vnode op.
|
||||
*/
|
||||
int
|
||||
nfsvno_pathconf(struct vnode *vp, int flag, register_t *retf,
|
||||
nfsvno_pathconf(struct vnode *vp, int flag, long *retf,
|
||||
struct ucred *cred, struct thread *p)
|
||||
{
|
||||
int error;
|
||||
@ -688,7 +688,7 @@ int
|
||||
nfs_supportsnfsv4acls(struct vnode *vp)
|
||||
{
|
||||
int error;
|
||||
register_t retval;
|
||||
long retval;
|
||||
|
||||
ASSERT_VOP_LOCKED(vp, "nfs supports nfsv4acls");
|
||||
|
||||
|
@ -371,8 +371,7 @@ struct ucred *newnfs_getcred(void);
|
||||
void newnfs_setroot(struct ucred *);
|
||||
int nfs_catnap(int, int, const char *);
|
||||
struct nfsreferral *nfsv4root_getreferral(vnode_t, vnode_t, u_int32_t);
|
||||
int nfsvno_pathconf(vnode_t, int, register_t *, struct ucred *,
|
||||
NFSPROC_T *);
|
||||
int nfsvno_pathconf(vnode_t, int, long *, struct ucred *, NFSPROC_T *);
|
||||
int nfsrv_atroot(vnode_t, uint64_t *);
|
||||
void newnfs_timer(void *);
|
||||
int nfs_supportsnfsv4acls(vnode_t);
|
||||
|
@ -2133,7 +2133,7 @@ nfsrvd_pathconf(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
{
|
||||
struct nfsv3_pathconf *pc;
|
||||
int getret = 1;
|
||||
register_t linkmax, namemax, chownres, notrunc;
|
||||
long linkmax, namemax, chownres, notrunc;
|
||||
struct nfsvattr at;
|
||||
|
||||
if (nd->nd_repstat) {
|
||||
|
@ -895,7 +895,7 @@ smbfs_pathconf (ap)
|
||||
{
|
||||
struct smbmount *smp = VFSTOSMBFS(VTOVFS(ap->a_vp));
|
||||
struct smb_vc *vcp = SSTOVC(smp->sm_share);
|
||||
register_t *retval = ap->a_retval;
|
||||
long *retval = ap->a_retval;
|
||||
int error = 0;
|
||||
|
||||
switch (ap->a_name) {
|
||||
|
@ -1343,7 +1343,7 @@ tmpfs_pathconf(struct vop_pathconf_args *v)
|
||||
{
|
||||
struct vnode *vp = v->a_vp;
|
||||
int name = v->a_name;
|
||||
register_t *retval = v->a_retval;
|
||||
long *retval = v->a_retval;
|
||||
|
||||
int error;
|
||||
|
||||
|
@ -737,12 +737,16 @@ int
|
||||
ibcs2_pathconf(struct thread *td, struct ibcs2_pathconf_args *uap)
|
||||
{
|
||||
char *path;
|
||||
long value;
|
||||
int error;
|
||||
|
||||
CHECKALTEXIST(td, uap->path, &path);
|
||||
uap->name++; /* iBCS2 _PC_* defines are offset by one */
|
||||
error = kern_pathconf(td, path, UIO_SYSSPACE, uap->name, FOLLOW);
|
||||
error = kern_pathconf(td, path, UIO_SYSSPACE, uap->name, FOLLOW,
|
||||
&value);
|
||||
free(path, M_TEMP);
|
||||
if (error == 0)
|
||||
td->td_retval[0] = value;
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -1418,12 +1418,17 @@ struct fpathconf_args {
|
||||
int
|
||||
sys_fpathconf(struct thread *td, struct fpathconf_args *uap)
|
||||
{
|
||||
long value;
|
||||
int error;
|
||||
|
||||
return (kern_fpathconf(td, uap->fd, uap->name));
|
||||
error = kern_fpathconf(td, uap->fd, uap->name, &value);
|
||||
if (error == 0)
|
||||
td->td_retval[0] = value;
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
kern_fpathconf(struct thread *td, int fd, int name)
|
||||
kern_fpathconf(struct thread *td, int fd, int name, long *valuep)
|
||||
{
|
||||
struct file *fp;
|
||||
struct vnode *vp;
|
||||
@ -1435,19 +1440,19 @@ kern_fpathconf(struct thread *td, int fd, int name)
|
||||
return (error);
|
||||
|
||||
if (name == _PC_ASYNC_IO) {
|
||||
td->td_retval[0] = _POSIX_ASYNCHRONOUS_IO;
|
||||
*valuep = _POSIX_ASYNCHRONOUS_IO;
|
||||
goto out;
|
||||
}
|
||||
vp = fp->f_vnode;
|
||||
if (vp != NULL) {
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_PATHCONF(vp, name, td->td_retval);
|
||||
error = VOP_PATHCONF(vp, name, valuep);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
} else if (fp->f_type == DTYPE_PIPE || fp->f_type == DTYPE_SOCKET) {
|
||||
if (name != _PC_PIPE_BUF) {
|
||||
error = EINVAL;
|
||||
} else {
|
||||
td->td_retval[0] = PIPE_BUF;
|
||||
*valuep = PIPE_BUF;
|
||||
error = 0;
|
||||
}
|
||||
} else {
|
||||
|
@ -2384,8 +2384,14 @@ struct pathconf_args {
|
||||
int
|
||||
sys_pathconf(struct thread *td, struct pathconf_args *uap)
|
||||
{
|
||||
long value;
|
||||
int error;
|
||||
|
||||
return (kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name, FOLLOW));
|
||||
error = kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name, FOLLOW,
|
||||
&value);
|
||||
if (error == 0)
|
||||
td->td_retval[0] = value;
|
||||
return (error);
|
||||
}
|
||||
|
||||
#ifndef _SYS_SYSPROTO_H_
|
||||
@ -2397,14 +2403,19 @@ struct lpathconf_args {
|
||||
int
|
||||
sys_lpathconf(struct thread *td, struct lpathconf_args *uap)
|
||||
{
|
||||
long value;
|
||||
int error;
|
||||
|
||||
return (kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name,
|
||||
NOFOLLOW));
|
||||
error = kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name,
|
||||
NOFOLLOW, &value);
|
||||
if (error == 0)
|
||||
td->td_retval[0] = value;
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name,
|
||||
u_long flags)
|
||||
u_long flags, long *valuep)
|
||||
{
|
||||
struct nameidata nd;
|
||||
int error;
|
||||
@ -2415,7 +2426,7 @@ kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name,
|
||||
return (error);
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
|
||||
error = VOP_PATHCONF(nd.ni_vp, name, td->td_retval);
|
||||
error = VOP_PATHCONF(nd.ni_vp, name, valuep);
|
||||
vput(nd.ni_vp);
|
||||
return (error);
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ vop_print {
|
||||
vop_pathconf {
|
||||
IN struct vnode *vp;
|
||||
IN int name;
|
||||
OUT register_t *retval;
|
||||
OUT long *retval;
|
||||
};
|
||||
|
||||
|
||||
|
@ -118,7 +118,7 @@ int kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg);
|
||||
int kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg);
|
||||
int kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf);
|
||||
int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf);
|
||||
int kern_fpathconf(struct thread *td, int fd, int name);
|
||||
int kern_fpathconf(struct thread *td, int fd, int name, long *valuep);
|
||||
int kern_fstat(struct thread *td, int fd, struct stat *sbp);
|
||||
int kern_fstatfs(struct thread *td, int fd, struct statfs *buf);
|
||||
int kern_fsync(struct thread *td, int fd, bool fullsync);
|
||||
@ -187,7 +187,7 @@ int kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap,
|
||||
int kern_openat(struct thread *td, int fd, char *path,
|
||||
enum uio_seg pathseg, int flags, int mode);
|
||||
int kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg,
|
||||
int name, u_long flags);
|
||||
int name, u_long flags, long *valuep);
|
||||
int kern_pipe(struct thread *td, int fildes[2], int flags,
|
||||
struct filecaps *fcaps1, struct filecaps *fcaps2);
|
||||
int kern_poll(struct thread *td, struct pollfd *fds, u_int nfds,
|
||||
|
Loading…
Reference in New Issue
Block a user