FreeBSD Bugzilla – Attachment 149376 Details for
Bug 194985
getdtablecount new syscall from openbsd
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated kern code patch
patch-getdtablecount.txt (text/plain), 1.16 KB, created by
David CARLIER
on 2014-11-13 13:17:11 UTC
(
hide
)
Description:
Updated kern code patch
Filename:
MIME Type:
Creator:
David CARLIER
Created:
2014-11-13 13:17:11 UTC
Size:
1.16 KB
patch
obsolete
>diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c >index e955b87..856eae5 100644 >--- a/sys/kern/kern_descrip.c >+++ b/sys/kern/kern_descrip.c >@@ -255,6 +255,7 @@ fdused_init(struct filedesc *fdp, int fd) > KASSERT(!fdisused(fdp, fd), ("fd=%d is already used", fd)); > > fdp->fd_map[NDSLOT(fd)] |= NDBIT(fd); >+ fdp->fd_openfd++; > } > > static void >@@ -288,6 +289,7 @@ fdunused(struct filedesc *fdp, int fd) > fdp->fd_freefile = fd; > if (fd == fdp->fd_lastfile) > fdp->fd_lastfile = fd_last_used(fdp, fd); >+ fdp->fd_openfd--; > } > > /* >@@ -1262,6 +1264,33 @@ sys_closefrom(struct thread *td, struct closefrom_args *uap) > return (0); > } > >+/* >+ * Number of file descriptors per process >+ */ >+#ifndef _SYS_SYSPROTO_H_ >+struct getdtablecount_args { >+ int dummy; >+}; >+#endif >+/* ARGSUSED */ >+ >+int >+sys_getdtablecount(struct thread *td, struct getdtablecount_args *uap) >+{ >+ struct proc *p; >+ struct filedesc *fdp; >+ >+ p = td->td_proc; >+ PROC_LOCK(p); >+ fdp = p->p_fd; >+ FILEDESC_SLOCK(fdp); >+ td->td_retval[0] = fdp->fd_openfd; >+ FILEDESC_SUNLOCK(fdp); >+ PROC_UNLOCK(p); >+ >+ return (0); >+} >+ > #if defined(COMPAT_43) > /* > * Return status information about a file descriptor.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 194985
:
149353
| 149376