Page MenuHomeFreeBSD

D59386.id.diff
No OneTemporary

D59386.id.diff

diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1040,7 +1040,7 @@
* Common code for dup, dup2, fcntl(F_DUPFD) and fcntl(F_DUP2FD).
*/
int
-kern_dup(struct thread *td, u_int mode, int flags, int old, int new)
+kern_dup(struct thread *td, u_int mode, int flags, int oldd, int newd)
{
struct filedesc *fdp;
struct filedescent *oldfde, *newfde;
@@ -1056,34 +1056,34 @@
MPASS((flags & ~(FDDUP_FLAG_CLOEXEC | FDDUP_FLAG_CLOFORK)) == 0);
MPASS(mode < FDDUP_LASTMODE);
- AUDIT_ARG_FD(old);
- /* XXXRW: if (flags & FDDUP_FIXED) AUDIT_ARG_FD2(new); */
+ AUDIT_ARG_FD(oldd);
+ /* XXXRW: if (flags & FDDUP_FIXED) AUDIT_ARG_FD2(newd); */
/*
* Verify we have a valid descriptor to dup from and possibly to
* dup to. Unlike dup() and dup2(), fcntl()'s F_DUPFD should
* return EINVAL when the new descriptor is out of bounds.
*/
- if (old < 0)
+ if (oldd < 0)
return (EBADF);
- if (new < 0)
+ if (newd < 0)
return (mode == FDDUP_FCNTL ? EINVAL : EBADF);
maxfd = getmaxfd(td);
- if (new >= maxfd)
+ if (newd >= maxfd)
return (mode == FDDUP_FCNTL ? EINVAL : EBADF);
error = EBADF;
FILEDESC_XLOCK(fdp);
- if (fget_noref(fdp, old) == NULL)
+ if (fget_noref(fdp, oldd) == NULL)
goto unlock;
- if (mode == FDDUP_FIXED && old == new) {
- td->td_retval[0] = new;
- fdp->fd_ofiles[new].fde_flags |= fddup_to_fde_flags(flags);
+ if (mode == FDDUP_FIXED && oldd == newd) {
+ td->td_retval[0] = newd;
+ fdp->fd_ofiles[newd].fde_flags |= fddup_to_fde_flags(flags);
error = 0;
goto unlock;
}
- oldfde = &fdp->fd_ofiles[old];
+ oldfde = &fdp->fd_ofiles[oldd];
oldfp = oldfde->fde_file;
if (!fhold(oldfp))
goto unlock;
@@ -1096,13 +1096,13 @@
switch (mode) {
case FDDUP_NORMAL:
case FDDUP_FCNTL:
- if ((error = fdalloc(td, new, &new)) != 0) {
+ if ((error = fdalloc(td, newd, &newd)) != 0) {
fdrop(oldfp, td);
goto unlock;
}
break;
case FDDUP_FIXED:
- if (new >= fdp->fd_nfiles) {
+ if (newd >= fdp->fd_nfiles) {
/*
* The resource limits are here instead of e.g.
* fdalloc(), because the file descriptor table may be
@@ -1113,7 +1113,7 @@
*/
#ifdef RACCT
if (RACCT_ENABLED()) {
- error = racct_set_unlocked(p, RACCT_NOFILE, new + 1);
+ error = racct_set_unlocked(p, RACCT_NOFILE, newd + 1);
if (error != 0) {
error = EMFILE;
fdrop(oldfp, td);
@@ -1121,24 +1121,24 @@
}
}
#endif
- fdgrowtable_exp(fdp, new + 1);
+ fdgrowtable_exp(fdp, newd + 1);
}
- if (!fdisused(fdp, new))
- fdused(fdp, new);
+ if (!fdisused(fdp, newd))
+ fdused(fdp, newd);
break;
default:
KASSERT(0, ("%s unsupported mode %d", __func__, mode));
}
- KASSERT(old != new, ("new fd is same as old"));
+ KASSERT(oldd != newd, ("new fd is same as old"));
/* Refetch oldfde because the table may have grown and old one freed. */
- oldfde = &fdp->fd_ofiles[old];
+ oldfde = &fdp->fd_ofiles[oldd];
KASSERT(oldfp == oldfde->fde_file,
("fdt_ofiles shift from growth observed at fd %d",
- old));
+ oldd));
- newfde = &fdp->fd_ofiles[new];
+ newfde = &fdp->fd_ofiles[newd];
delfp = newfde->fde_file;
nioctls = filecaps_copy_prep(&oldfde->fde_caps);
@@ -1158,12 +1158,12 @@
#ifdef CAPABILITIES
seqc_write_end(&newfde->fde_seqc);
#endif
- td->td_retval[0] = new;
+ td->td_retval[0] = newd;
error = 0;
if (delfp != NULL) {
- (void) closefp(fdp, new, delfp, td, true, false);
+ (void) closefp(fdp, newd, delfp, td, true, false);
FILEDESC_UNLOCK_ASSERT(fdp);
} else {
unlock:
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -3751,14 +3751,14 @@
#ifdef MAC
static int
-kern_renameat_mac(struct thread *td, int oldfd, const char *old, int newfd,
- const char *new, enum uio_seg pathseg, struct nameidata *fromnd, int op,
+kern_renameat_mac(struct thread *td, int fromfd, const char *from, int tofd,
+ const char *to, enum uio_seg pathseg, struct nameidata *fromnd, int op,
int ndflags)
{
int error;
NDINIT_ATRIGHTS(fromnd, op, LOCKPARENT | LOCKLEAF | AUDITVNODE1 |
- ndflags, pathseg, old, oldfd, &cap_renameat_source_rights);
+ ndflags, pathseg, from, fromfd, &cap_renameat_source_rights);
if ((error = namei(fromnd)) != 0)
return (error);
error = mac_vnode_check_rename_from(td->td_ucred, fromnd->ni_dvp,
@@ -3776,8 +3776,8 @@
#endif
int
-kern_renameat(struct thread *td, int oldfd, const char *old, int newfd,
- const char *new, enum uio_seg pathseg, u_int flags)
+kern_renameat(struct thread *td, int fromfd, const char *from, int tofd,
+ const char *to, enum uio_seg pathseg, u_int flags)
{
struct mount *mp, *tmp;
struct vnode *tvp, *fvp, *tdvp;
@@ -3805,14 +3805,14 @@
bwillwrite();
#ifdef MAC
if (mac_vnode_check_rename_from_enabled()) {
- error = kern_renameat_mac(td, oldfd, old, newfd, new, pathseg,
+ error = kern_renameat_mac(td, fromfd, from, tofd, to, pathseg,
&fromnd, op, fndflags);
if (error != 0)
return (error);
} else {
#endif
NDINIT_ATRIGHTS(&fromnd, op, WANTPARENT | AUDITVNODE1 | fndflags,
- pathseg, old, oldfd, &cap_renameat_source_rights);
+ pathseg, from, fromfd, &cap_renameat_source_rights);
if ((error = namei(&fromnd)) != 0)
return (error);
#ifdef MAC
@@ -3834,7 +3834,7 @@
tondflags = LOCKPARENT | LOCKLEAF | NOCACHE | AUDITVNODE2;
if (fromnd.ni_vp->v_type == VDIR)
tondflags |= WILLBEDIR;
- NDINIT_ATRIGHTS(&tond, RENAME, tondflags, pathseg, new, newfd,
+ NDINIT_ATRIGHTS(&tond, RENAME, tondflags, pathseg, to, tofd,
&cap_renameat_target_rights);
if ((error = namei(&tond)) != 0) {
/* Translate error code for rename("dir1", "dir2/."). */
@@ -3945,10 +3945,10 @@
}
}
#ifdef CAPABILITIES
- if (newfd != AT_FDCWD && (tond.ni_resflags & NIRES_ABS) == 0) {
+ if (tofd != AT_FDCWD && (tond.ni_resflags & NIRES_ABS) == 0) {
/*
* If the target already exists we require CAP_UNLINKAT
- * from 'newfd', when newfd was used for the lookup.
+ * from 'tofd', when tofd was used for the lookup.
*/
error = cap_check(&tond.ni_filecaps.fc_rights,
&cap_unlinkat_rights);
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -133,7 +133,7 @@
cpuwhich_t which, id_t id, cpusetid_t *setid);
int kern_cpuset_setid(struct thread *td, cpuwhich_t which,
id_t id, cpusetid_t setid);
-int kern_dup(struct thread *td, u_int mode, int flags, int old, int new);
+int kern_dup(struct thread *td, u_int mode, int flags, int oldd, int newd);
int kern_execve(struct thread *td, struct image_args *args,
struct mac *mac_p, struct vmspace *oldvmspace);
void kern_exit(struct thread *, int, int);
@@ -318,8 +318,8 @@
int kern_readv(struct thread *td, int fd, struct uio *auio);
int kern_recvit(struct thread *td, int s, struct msghdr *mp,
enum uio_seg fromseg, struct mbuf **controlp);
-int kern_renameat(struct thread *td, int oldfd, const char *old, int newfd,
- const char *new, enum uio_seg pathseg, u_int flags);
+int kern_renameat(struct thread *td, int fromfd, const char *from,
+ int tofd, const char *to, enum uio_seg pathseg, u_int flags);
int kern_sched_getparam(struct thread *td, struct thread *targettd,
struct sched_param *param);
int kern_sched_getscheduler(struct thread *td, struct thread *targettd,

File Metadata

Mime Type
text/plain
Expires
Tue, Sep 8, 8:57 PM (4 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38533904
Default Alt Text
D59386.id.diff (7 KB)

Event Timeline