Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F134786972
D30397.id89823.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D30397.id89823.diff
View Options
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1869,7 +1869,7 @@
* Write out a core segment to the compression stream.
*/
static int
-compress_chunk(struct coredump_params *p, char *base, char *buf, u_int len)
+compress_chunk(struct coredump_params *cp, char *base, char *buf, u_int len)
{
u_int chunk_len;
int error;
@@ -1884,7 +1884,7 @@
error = copyin(base, buf, chunk_len);
if (error != 0)
bzero(buf, chunk_len);
- error = compressor_write(p->comp, buf, chunk_len);
+ error = compressor_write(cp->comp, buf, chunk_len);
if (error != 0)
break;
base += chunk_len;
@@ -1894,17 +1894,17 @@
}
int
-core_write(struct coredump_params *p, const void *base, size_t len,
+core_write(struct coredump_params *cp, const void *base, size_t len,
off_t offset, enum uio_seg seg, size_t *resid)
{
- return (vn_rdwr_inchunks(UIO_WRITE, p->vp, __DECONST(void *, base),
+ return (vn_rdwr_inchunks(UIO_WRITE, cp->vp, __DECONST(void *, base),
len, offset, seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED,
- p->active_cred, p->file_cred, resid, p->td));
+ cp->active_cred, cp->file_cred, resid, cp->td));
}
int
-core_output(char *base, size_t len, off_t offset, struct coredump_params *p,
+core_output(char *base, size_t len, off_t offset, struct coredump_params *cp,
void *tmpbuf)
{
vm_map_t map;
@@ -1916,10 +1916,10 @@
KASSERT((uintptr_t)base % PAGE_SIZE == 0,
("%s: user address %p is not page-aligned", __func__, base));
- if (p->comp != NULL)
- return (compress_chunk(p, base, tmpbuf, len));
+ if (cp->comp != NULL)
+ return (compress_chunk(cp, base, tmpbuf, len));
- map = &p->td->td_proc->p_vmspace->vm_map;
+ map = &cp->td->td_proc->p_vmspace->vm_map;
for (; len > 0; base += runlen, offset += runlen, len -= runlen) {
/*
* Attempt to page in all virtual pages in the range. If a
@@ -1937,7 +1937,7 @@
}
if (success) {
- error = core_write(p, base, runlen, offset,
+ error = core_write(cp, base, runlen, offset,
UIO_USERSPACE, &resid);
if (error != 0) {
if (error != EFAULT)
@@ -1960,13 +1960,13 @@
}
}
if (!success) {
- error = vn_start_write(p->vp, &mp, V_WAIT);
+ error = vn_start_write(cp->vp, &mp, V_WAIT);
if (error != 0)
break;
- vn_lock(p->vp, LK_EXCLUSIVE | LK_RETRY);
- error = vn_truncate_locked(p->vp, offset + runlen,
- false, p->td->td_ucred);
- VOP_UNLOCK(p->vp);
+ vn_lock(cp->vp, LK_EXCLUSIVE | LK_RETRY);
+ error = vn_truncate_locked(cp->vp, offset + runlen,
+ false, cp->td->td_ucred);
+ VOP_UNLOCK(cp->vp);
vn_finished_write(mp);
if (error != 0)
break;
@@ -1981,10 +1981,12 @@
int
sbuf_drain_core_output(void *arg, const char *data, int len)
{
- struct coredump_params *p;
+ struct coredump_params *cp;
+ struct proc *p;
int error, locked;
- p = (struct coredump_params *)arg;
+ cp = arg;
+ p = cp->td->td_proc;
/*
* Some kern_proc out routines that print to this sbuf may
@@ -1994,19 +1996,18 @@
* can safely release the lock before draining and acquire
* again after.
*/
- locked = PROC_LOCKED(p->td->td_proc);
+ locked = PROC_LOCKED(p);
if (locked)
- PROC_UNLOCK(p->td->td_proc);
- if (p->comp != NULL)
- error = compressor_write(p->comp, __DECONST(char *, data), len);
+ PROC_UNLOCK(p);
+ if (cp->comp != NULL)
+ error = compressor_write(cp->comp, __DECONST(char *, data), len);
else
- error = core_write(p, __DECONST(void *, data), len, p->offset,
+ error = core_write(cp, __DECONST(void *, data), len, cp->offset,
UIO_SYSSPACE, NULL);
if (locked)
- PROC_LOCK(p->td->td_proc);
+ PROC_LOCK(p);
if (error != 0)
return (-error);
- p->offset += len;
+ cp->offset += len;
return (len);
}
-
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 5, 3:15 PM (12 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24845932
Default Alt Text
D30397.id89823.diff (3 KB)
Attached To
Mode
D30397: Clean up some of the core dumping code.
Attached
Detach File
Event Timeline
Log In to Comment