Date: Thu, 14 Jun 2012 15:34:10 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r237075 - head/sys/kern Message-ID: <201206141534.q5EFYAiW002935@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Thu Jun 14 15:34:10 2012 New Revision: 237075 URL: http://svn.freebsd.org/changeset/base/237075 Log: Style fixes and assertions improvements. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 15:27:33 2012 (r237074) +++ head/sys/kern/kern_descrip.c Thu Jun 14 15:34:10 2012 (r237075) @@ -242,8 +242,10 @@ fd_last_used(struct filedesc *fdp, int s static int fdisused(struct filedesc *fdp, int fd) { + KASSERT(fd >= 0 && fd < fdp->fd_nfiles, ("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles)); + return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0); } @@ -255,8 +257,8 @@ fdused(struct filedesc *fdp, int fd) { FILEDESC_XLOCK_ASSERT(fdp); - KASSERT(!fdisused(fdp, fd), - ("fd already used")); + + KASSERT(!fdisused(fdp, fd), ("fd=%d is already used", fd)); fdp->fd_map[NDSLOT(fd)] |= NDBIT(fd); if (fd > fdp->fd_lastfile) @@ -273,10 +275,9 @@ fdunused(struct filedesc *fdp, int fd) { FILEDESC_XLOCK_ASSERT(fdp); - KASSERT(fdisused(fdp, fd), - ("fd is already unused")); - KASSERT(fdp->fd_ofiles[fd] == NULL, - ("fd is still in use")); + + KASSERT(fdisused(fdp, fd), ("fd=%d is already unused", fd)); + KASSERT(fdp->fd_ofiles[fd] == NULL, ("fd=%d is still in use", fd)); fdp->fd_map[NDSLOT(fd)] &= ~NDBIT(fd); if (fd < fdp->fd_freefile)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206141534.q5EFYAiW002935>