summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_descrip.c11
-rw-r--r--sys/kern/syscalls.master4
2 files changed, 12 insertions, 3 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index ef18b8bef87..dca42ddc9d7 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_descrip.c,v 1.90 2012/04/12 11:01:37 deraadt Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.91 2012/04/12 11:07:20 deraadt Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@@ -155,6 +155,7 @@ fd_used(struct filedesc *fdp, int fd)
if (fd > fdp->fd_lastfile)
fdp->fd_lastfile = fd;
+ fdp->fd_openfd++;
}
static __inline void
@@ -175,6 +176,7 @@ fd_unused(struct filedesc *fdp, int fd)
#endif
if (fd == fdp->fd_lastfile)
fdp->fd_lastfile = find_last_set(fdp, fd);
+ fdp->fd_openfd--;
}
struct file *
@@ -1320,3 +1322,10 @@ sys_closefrom(struct proc *p, void *v, register_t *retval)
fdpunlock(fdp);
return (0);
}
+
+int
+sys_getdtablecount(struct proc *p, void *v, register_t *retval)
+{
+ *retval = p->p_fd->fd_openfd;
+ return (0);
+}
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index af289aab619..c241438c611 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
-; $OpenBSD: syscalls.master,v 1.120 2012/01/17 02:34:18 guenther Exp $
+; $OpenBSD: syscalls.master,v 1.121 2012/04/12 11:07:19 deraadt Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -72,7 +72,7 @@
16 STD { int sys_chown(const char *path, uid_t uid, \
gid_t gid); }
17 STD { int sys_obreak(char *nsize); } break
-18 OBSOL getfsstat25
+18 STD { int sys_getdtablecount(void); }
19 OBSOL olseek
20 STD NOLOCK { pid_t sys_getpid(void); }
21 STD { int sys_mount(const char *type, const char *path, \