Print this page
XXXX adding PID information to netstat output
*** 836,850 ****
/*
* Duplicate all file descriptors across a fork.
*/
void
! flist_fork(uf_info_t *pfip, uf_info_t *cfip)
{
int fd, nfiles;
uf_entry_t *pufp, *cufp;
mutex_init(&cfip->fi_lock, NULL, MUTEX_DEFAULT, NULL);
cfip->fi_rlist = NULL;
/*
* We don't need to hold fi_lock because all other lwp's in the
--- 836,853 ----
/*
* Duplicate all file descriptors across a fork.
*/
void
! flist_fork(proc_t *pp, proc_t *cp)
{
int fd, nfiles;
uf_entry_t *pufp, *cufp;
+ uf_info_t *pfip = P_FINFO(pp);
+ uf_info_t *cfip = P_FINFO(cp);
+
mutex_init(&cfip->fi_lock, NULL, MUTEX_DEFAULT, NULL);
cfip->fi_rlist = NULL;
/*
* We don't need to hold fi_lock because all other lwp's in the
*** 858,867 ****
--- 861,877 ----
fd++, pufp++, cufp++) {
cufp->uf_file = pufp->uf_file;
cufp->uf_alloc = pufp->uf_alloc;
cufp->uf_flag = pufp->uf_flag;
cufp->uf_busy = pufp->uf_busy;
+
+ if (cufp->uf_file != NULL && cufp->uf_file->f_vnode != NULL) {
+ (void) VOP_IOCTL(cufp->uf_file->f_vnode, F_ASSOCI_PID,
+ (intptr_t)cp->p_pidp->pid_id, FKIOCTL, kcred,
+ NULL, NULL);
+ }
+
if (pufp->uf_file == NULL) {
ASSERT(pufp->uf_flag == 0);
if (pufp->uf_busy) {
/*
* Grab locks to appease ASSERTs in fd_reserve
*** 943,952 ****
--- 953,967 ----
count = fp->f_count--;
flag = fp->f_flag;
offset = fp->f_offset;
vp = fp->f_vnode;
+ if (vp != NULL) {
+ (void) VOP_IOCTL(vp, F_DASSOC_PID,
+ (intptr_t)(ttoproc(curthread)->p_pidp->pid_id), FKIOCTL,
+ kcred, NULL, NULL);
+ }
error = VOP_CLOSE(vp, flag, count, offset, fp->f_cred, NULL);
if (count > 1) {
mutex_exit(&fp->f_tlock);