91 UF_EXIT(ufp);
92 }
93 mutex_exit(&fip->fi_lock);
94
95 v[0].p_type = PT_NOTE;
96 v[0].p_flags = PF_R;
97 v[0].p_filesz = (sizeof (Note) * (10 + 3 * nlwp + nzomb + nfd))
98 + roundup(sizeof (psinfo_t), sizeof (Word))
99 + roundup(sizeof (pstatus_t), sizeof (Word))
100 + roundup(prgetprivsize(), sizeof (Word))
101 + roundup(priv_get_implinfo_size(), sizeof (Word))
102 + roundup(strlen(platform) + 1, sizeof (Word))
103 + roundup(strlen(p->p_zone->zone_name) + 1, sizeof (Word))
104 + roundup(__KERN_NAUXV_IMPL * sizeof (aux_entry_t), sizeof (Word))
105 + roundup(sizeof (utsname), sizeof (Word))
106 + roundup(sizeof (core_content_t), sizeof (Word))
107 + roundup(sizeof (prsecflags_t), sizeof (Word))
108 + (nlwp + nzomb) * roundup(sizeof (lwpsinfo_t), sizeof (Word))
109 + nlwp * roundup(sizeof (lwpstatus_t), sizeof (Word))
110 + nlwp * roundup(sizeof (prlwpname_t), sizeof (Word))
111 + nfd * roundup(sizeof (prfdinfo_t), sizeof (Word));
112
113 if (curproc->p_agenttp != NULL) {
114 v[0].p_filesz += sizeof (Note) +
115 roundup(sizeof (psinfo_t), sizeof (Word));
116 }
117
118 size = sizeof (prcred_t) + sizeof (gid_t) * (ngroups_max - 1);
119 pcrp = kmem_alloc(size, KM_SLEEP);
120 prgetcred(p, pcrp);
121 if (pcrp->pr_ngroups != 0) {
122 v[0].p_filesz += sizeof (Note) + roundup(sizeof (prcred_t) +
123 sizeof (gid_t) * (pcrp->pr_ngroups - 1), sizeof (Word));
124 } else {
125 v[0].p_filesz += sizeof (Note) +
126 roundup(sizeof (prcred_t), sizeof (Word));
127 }
128 kmem_free(pcrp, size);
129
130
131 #if defined(__i386) || defined(__i386_COMPAT)
333 strlen(p->p_zone->zone_name) + 1, p->p_zone->zone_name,
334 rlimit, credp);
335 if (error)
336 goto done;
337
338
339 /* open file table */
340 vroot = PTOU(p)->u_rdir;
341 if (vroot == NULL)
342 vroot = rootdir;
343
344 VN_HOLD(vroot);
345
346 fip = P_FINFO(p);
347
348 for (fd = 0; fd < fip->fi_nfiles; fd++) {
349 uf_entry_t *ufp;
350 vnode_t *fvp;
351 struct file *fp;
352 vattr_t vattr;
353 prfdinfo_t fdinfo;
354
355 bzero(&fdinfo, sizeof (fdinfo));
356
357 mutex_enter(&fip->fi_lock);
358 UF_ENTER(ufp, fip, fd);
359 if (((fp = ufp->uf_file) == NULL) || (fp->f_count < 1)) {
360 UF_EXIT(ufp);
361 mutex_exit(&fip->fi_lock);
362 continue;
363 }
364
365 fdinfo.pr_fd = fd;
366 fdinfo.pr_fdflags = ufp->uf_flag;
367 fdinfo.pr_fileflags = fp->f_flag2;
368 fdinfo.pr_fileflags <<= 16;
369 fdinfo.pr_fileflags |= fp->f_flag;
370 if ((fdinfo.pr_fileflags & (FSEARCH | FEXEC)) == 0)
371 fdinfo.pr_fileflags += FOPEN;
372 fdinfo.pr_offset = fp->f_offset;
373
|
91 UF_EXIT(ufp);
92 }
93 mutex_exit(&fip->fi_lock);
94
95 v[0].p_type = PT_NOTE;
96 v[0].p_flags = PF_R;
97 v[0].p_filesz = (sizeof (Note) * (10 + 3 * nlwp + nzomb + nfd))
98 + roundup(sizeof (psinfo_t), sizeof (Word))
99 + roundup(sizeof (pstatus_t), sizeof (Word))
100 + roundup(prgetprivsize(), sizeof (Word))
101 + roundup(priv_get_implinfo_size(), sizeof (Word))
102 + roundup(strlen(platform) + 1, sizeof (Word))
103 + roundup(strlen(p->p_zone->zone_name) + 1, sizeof (Word))
104 + roundup(__KERN_NAUXV_IMPL * sizeof (aux_entry_t), sizeof (Word))
105 + roundup(sizeof (utsname), sizeof (Word))
106 + roundup(sizeof (core_content_t), sizeof (Word))
107 + roundup(sizeof (prsecflags_t), sizeof (Word))
108 + (nlwp + nzomb) * roundup(sizeof (lwpsinfo_t), sizeof (Word))
109 + nlwp * roundup(sizeof (lwpstatus_t), sizeof (Word))
110 + nlwp * roundup(sizeof (prlwpname_t), sizeof (Word))
111 + nfd * roundup(sizeof (prfdinfov1_t), sizeof (Word));
112
113 if (curproc->p_agenttp != NULL) {
114 v[0].p_filesz += sizeof (Note) +
115 roundup(sizeof (psinfo_t), sizeof (Word));
116 }
117
118 size = sizeof (prcred_t) + sizeof (gid_t) * (ngroups_max - 1);
119 pcrp = kmem_alloc(size, KM_SLEEP);
120 prgetcred(p, pcrp);
121 if (pcrp->pr_ngroups != 0) {
122 v[0].p_filesz += sizeof (Note) + roundup(sizeof (prcred_t) +
123 sizeof (gid_t) * (pcrp->pr_ngroups - 1), sizeof (Word));
124 } else {
125 v[0].p_filesz += sizeof (Note) +
126 roundup(sizeof (prcred_t), sizeof (Word));
127 }
128 kmem_free(pcrp, size);
129
130
131 #if defined(__i386) || defined(__i386_COMPAT)
333 strlen(p->p_zone->zone_name) + 1, p->p_zone->zone_name,
334 rlimit, credp);
335 if (error)
336 goto done;
337
338
339 /* open file table */
340 vroot = PTOU(p)->u_rdir;
341 if (vroot == NULL)
342 vroot = rootdir;
343
344 VN_HOLD(vroot);
345
346 fip = P_FINFO(p);
347
348 for (fd = 0; fd < fip->fi_nfiles; fd++) {
349 uf_entry_t *ufp;
350 vnode_t *fvp;
351 struct file *fp;
352 vattr_t vattr;
353 prfdinfov1_t fdinfo;
354
355 bzero(&fdinfo, sizeof (fdinfo));
356
357 mutex_enter(&fip->fi_lock);
358 UF_ENTER(ufp, fip, fd);
359 if (((fp = ufp->uf_file) == NULL) || (fp->f_count < 1)) {
360 UF_EXIT(ufp);
361 mutex_exit(&fip->fi_lock);
362 continue;
363 }
364
365 fdinfo.pr_fd = fd;
366 fdinfo.pr_fdflags = ufp->uf_flag;
367 fdinfo.pr_fileflags = fp->f_flag2;
368 fdinfo.pr_fileflags <<= 16;
369 fdinfo.pr_fileflags |= fp->f_flag;
370 if ((fdinfo.pr_fileflags & (FSEARCH | FEXEC)) == 0)
371 fdinfo.pr_fileflags += FOPEN;
372 fdinfo.pr_offset = fp->f_offset;
373
|