Date: Sun, 14 Jun 2015 14:10:06 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284381 - head/sys/kern Message-ID: <201506141410.t5EEA6kR020114@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Sun Jun 14 14:10:05 2015 New Revision: 284381 URL: https://svnweb.freebsd.org/changeset/base/284381 Log: fd: reduce excessive zeroing on fd close fde_file as NULL is already an indicator of an unused fd. All other fields are populated when fp is installed. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Jun 14 14:08:52 2015 (r284380) +++ head/sys/kern/kern_descrip.c Sun Jun 14 14:10:05 2015 (r284381) @@ -309,7 +309,7 @@ fdfree(struct filedesc *fdp, int fd) seq_write_begin(&fde->fde_seq); #endif fdefree_last(fde); - bzero(fde, fde_change_size); + fde->fde_file = NULL; fdunused(fdp, fd); #ifdef CAPABILITIES seq_write_end(&fde->fde_seq); @@ -1651,7 +1651,6 @@ fdalloc(struct thread *td, int minfd, in ("fd_first_free() returned non-free descriptor")); KASSERT(fdp->fd_ofiles[fd].fde_file == NULL, ("file descriptor isn't free")); - KASSERT(fdp->fd_ofiles[fd].fde_flags == 0, ("file flags are set")); fdused(fdp, fd); *result = fd; return (0); @@ -1766,8 +1765,7 @@ _finstall(struct filedesc *fdp, struct f seq_write_begin(&fde->fde_seq); #endif fde->fde_file = fp; - if ((flags & O_CLOEXEC) != 0) - fde->fde_flags |= UF_EXCLOSE; + fde->fde_flags = (flags & O_CLOEXEC) != 0 ? UF_EXCLOSE : 0; if (fcaps != NULL) filecaps_move(fcaps, &fde->fde_caps); else @@ -2852,7 +2850,7 @@ dupfdopen(struct thread *td, struct file seq_write_begin(&newfde->fde_seq); #endif memcpy(newfde, oldfde, fde_change_size); - bzero(oldfde, fde_change_size); + oldfde->fde_file = NULL; fdunused(fdp, dfd); #ifdef CAPABILITIES seq_write_end(&newfde->fde_seq);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506141410.t5EEA6kR020114>