Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
cdc3d562
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
cdc3d562
编写于
10月 05, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
switch elf_coredump_extra_notes_write() to dump_emit()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
e6c1baa9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
38 deletion
+30
-38
arch/powerpc/include/asm/spu.h
arch/powerpc/include/asm/spu.h
+2
-1
arch/powerpc/platforms/cell/spu_syscalls.c
arch/powerpc/platforms/cell/spu_syscalls.c
+3
-2
arch/powerpc/platforms/cell/spufs/coredump.c
arch/powerpc/platforms/cell/spufs/coredump.c
+17
-27
arch/powerpc/platforms/cell/spufs/spufs.h
arch/powerpc/platforms/cell/spufs/spufs.h
+2
-1
fs/binfmt_elf.c
fs/binfmt_elf.c
+3
-4
include/linux/elf.h
include/linux/elf.h
+3
-3
未找到文件。
arch/powerpc/include/asm/spu.h
浏览文件 @
cdc3d562
...
...
@@ -235,6 +235,7 @@ extern long spu_sys_callback(struct spu_syscall_block *s);
/* syscalls implemented in spufs */
struct
file
;
struct
coredump_params
;
struct
spufs_calls
{
long
(
*
create_thread
)(
const
char
__user
*
name
,
unsigned
int
flags
,
umode_t
mode
,
...
...
@@ -242,7 +243,7 @@ struct spufs_calls {
long
(
*
spu_run
)(
struct
file
*
filp
,
__u32
__user
*
unpc
,
__u32
__user
*
ustatus
);
int
(
*
coredump_extra_notes_size
)(
void
);
int
(
*
coredump_extra_notes_write
)(
struct
file
*
file
,
loff_t
*
foffset
);
int
(
*
coredump_extra_notes_write
)(
struct
coredump_params
*
cprm
);
void
(
*
notify_spus_active
)(
void
);
struct
module
*
owner
;
};
...
...
arch/powerpc/platforms/cell/spu_syscalls.c
浏览文件 @
cdc3d562
...
...
@@ -25,6 +25,7 @@
#include <linux/module.h>
#include <linux/syscalls.h>
#include <linux/rcupdate.h>
#include <linux/binfmts.h>
#include <asm/spu.h>
...
...
@@ -126,7 +127,7 @@ int elf_coredump_extra_notes_size(void)
return
ret
;
}
int
elf_coredump_extra_notes_write
(
struct
file
*
file
,
loff_t
*
foffset
)
int
elf_coredump_extra_notes_write
(
struct
coredump_params
*
cprm
)
{
struct
spufs_calls
*
calls
;
int
ret
;
...
...
@@ -135,7 +136,7 @@ int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset)
if
(
!
calls
)
return
0
;
ret
=
calls
->
coredump_extra_notes_write
(
file
,
foffset
);
ret
=
calls
->
coredump_extra_notes_write
(
cprm
);
spufs_calls_put
(
calls
);
...
...
arch/powerpc/platforms/cell/spufs/coredump.c
浏览文件 @
cdc3d562
...
...
@@ -27,6 +27,8 @@
#include <linux/gfp.h>
#include <linux/list.h>
#include <linux/syscalls.h>
#include <linux/coredump.h>
#include <linux/binfmts.h>
#include <asm/uaccess.h>
...
...
@@ -52,35 +54,24 @@ static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer,
* These are the only things you should do on a core-file: use only these
* functions to write out all the necessary info.
*/
static
int
spufs_dump_write
(
struct
file
*
file
,
const
void
*
addr
,
int
nr
,
loff_t
*
foffset
)
static
int
spufs_dump_write
(
struct
coredump_params
*
cprm
,
const
void
*
addr
,
int
nr
)
{
unsigned
long
limit
=
rlimit
(
RLIMIT_CORE
);
ssize_t
written
;
if
(
*
foffset
+
nr
>
limit
)
if
(
!
dump_emit
(
cprm
,
addr
,
nr
))
return
-
EIO
;
written
=
file
->
f_op
->
write
(
file
,
addr
,
nr
,
&
file
->
f_pos
);
*
foffset
+=
written
;
if
(
written
!=
nr
)
return
-
EIO
;
return
0
;
}
static
int
spufs_dump_align
(
struct
file
*
file
,
char
*
buf
,
loff_t
new_off
,
loff_t
*
foffset
)
static
int
spufs_dump_align
(
struct
coredump_params
*
cprm
,
char
*
buf
,
loff_t
new_off
)
{
int
rc
,
size
;
size
=
min
((
loff_t
)
PAGE_SIZE
,
new_off
-
*
foffset
);
size
=
min
((
loff_t
)
PAGE_SIZE
,
new_off
-
cprm
->
written
);
memset
(
buf
,
0
,
size
);
rc
=
0
;
while
(
rc
==
0
&&
new_off
>
*
foffset
)
{
size
=
min
((
loff_t
)
PAGE_SIZE
,
new_off
-
*
foffset
);
rc
=
spufs_dump_write
(
file
,
buf
,
size
,
foffset
);
while
(
rc
==
0
&&
new_off
>
cprm
->
written
)
{
size
=
min
((
loff_t
)
PAGE_SIZE
,
new_off
-
cprm
->
written
);
rc
=
spufs_dump_write
(
cprm
,
buf
,
size
);
}
return
rc
;
...
...
@@ -165,7 +156,7 @@ int spufs_coredump_extra_notes_size(void)
}
static
int
spufs_arch_write_note
(
struct
spu_context
*
ctx
,
int
i
,
struct
file
*
file
,
int
dfd
,
loff_t
*
foffset
)
struct
coredump_params
*
cprm
,
int
dfd
)
{
loff_t
pos
=
0
;
int
sz
,
rc
,
nread
,
total
=
0
;
...
...
@@ -186,22 +177,22 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i,
en
.
n_descsz
=
sz
;
en
.
n_type
=
NT_SPU
;
rc
=
spufs_dump_write
(
file
,
&
en
,
sizeof
(
en
),
foffset
);
rc
=
spufs_dump_write
(
cprm
,
&
en
,
sizeof
(
en
)
);
if
(
rc
)
goto
out
;
rc
=
spufs_dump_write
(
file
,
fullname
,
en
.
n_namesz
,
foffset
);
rc
=
spufs_dump_write
(
cprm
,
fullname
,
en
.
n_namesz
);
if
(
rc
)
goto
out
;
rc
=
spufs_dump_align
(
file
,
buf
,
roundup
(
*
foffset
,
4
),
foffset
);
rc
=
spufs_dump_align
(
cprm
,
buf
,
roundup
(
cprm
->
written
,
4
)
);
if
(
rc
)
goto
out
;
do
{
nread
=
do_coredump_read
(
i
,
ctx
,
buf
,
bufsz
,
&
pos
);
if
(
nread
>
0
)
{
rc
=
spufs_dump_write
(
file
,
buf
,
nread
,
foffset
);
rc
=
spufs_dump_write
(
cprm
,
buf
,
nread
);
if
(
rc
)
goto
out
;
total
+=
nread
;
...
...
@@ -213,15 +204,14 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i,
goto
out
;
}
rc
=
spufs_dump_align
(
file
,
buf
,
roundup
(
*
foffset
-
total
+
sz
,
4
),
foffset
);
rc
=
spufs_dump_align
(
cprm
,
buf
,
roundup
(
cprm
->
written
-
total
+
sz
,
4
));
out:
free_page
((
unsigned
long
)
buf
);
return
rc
;
}
int
spufs_coredump_extra_notes_write
(
struct
file
*
file
,
loff_t
*
foffset
)
int
spufs_coredump_extra_notes_write
(
struct
coredump_params
*
cprm
)
{
struct
spu_context
*
ctx
;
int
fd
,
j
,
rc
;
...
...
@@ -233,7 +223,7 @@ int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset)
return
rc
;
for
(
j
=
0
;
spufs_coredump_read
[
j
].
name
!=
NULL
;
j
++
)
{
rc
=
spufs_arch_write_note
(
ctx
,
j
,
file
,
fd
,
foffset
);
rc
=
spufs_arch_write_note
(
ctx
,
j
,
cprm
,
fd
);
if
(
rc
)
{
spu_release_saved
(
ctx
);
return
rc
;
...
...
arch/powerpc/platforms/cell/spufs/spufs.h
浏览文件 @
cdc3d562
...
...
@@ -247,12 +247,13 @@ extern const struct spufs_tree_descr spufs_dir_debug_contents[];
/* system call implementation */
extern
struct
spufs_calls
spufs_calls
;
struct
coredump_params
;
long
spufs_run_spu
(
struct
spu_context
*
ctx
,
u32
*
npc
,
u32
*
status
);
long
spufs_create
(
struct
path
*
nd
,
struct
dentry
*
dentry
,
unsigned
int
flags
,
umode_t
mode
,
struct
file
*
filp
);
/* ELF coredump callbacks for writing SPU ELF notes */
extern
int
spufs_coredump_extra_notes_size
(
void
);
extern
int
spufs_coredump_extra_notes_write
(
struct
file
*
file
,
loff_t
*
foffset
);
extern
int
spufs_coredump_extra_notes_write
(
struct
coredump_params
*
cprm
);
extern
const
struct
file_operations
spufs_context_fops
;
...
...
fs/binfmt_elf.c
浏览文件 @
cdc3d562
...
...
@@ -2037,7 +2037,7 @@ static int elf_core_dump(struct coredump_params *cprm)
size_t
size
=
0
;
struct
vm_area_struct
*
vma
,
*
gate_vma
;
struct
elfhdr
*
elf
=
NULL
;
loff_t
offset
=
0
,
dataoff
,
foffset
;
loff_t
offset
=
0
,
dataoff
;
struct
elf_note_info
info
=
{
};
struct
elf_phdr
*
phdr4note
=
NULL
;
struct
elf_shdr
*
shdr4extnum
=
NULL
;
...
...
@@ -2160,12 +2160,11 @@ static int elf_core_dump(struct coredump_params *cprm)
if
(
!
write_note_info
(
&
info
,
cprm
))
goto
end_coredump
;
foffset
=
cprm
->
written
;
if
(
elf_coredump_extra_notes_write
(
cprm
->
file
,
&
foffset
))
if
(
elf_coredump_extra_notes_write
(
cprm
))
goto
end_coredump
;
/* Align to page */
if
(
!
dump_seek
(
cprm
->
file
,
dataoff
-
foffset
))
if
(
!
dump_seek
(
cprm
->
file
,
dataoff
-
cprm
->
written
))
goto
end_coredump
;
cprm
->
written
=
size
;
...
...
include/linux/elf.h
浏览文件 @
cdc3d562
...
...
@@ -39,13 +39,13 @@ extern Elf64_Dyn _DYNAMIC [];
/* Optional callbacks to write extra ELF notes. */
struct
file
;
struct
coredump_params
;
#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
static
inline
int
elf_coredump_extra_notes_size
(
void
)
{
return
0
;
}
static
inline
int
elf_coredump_extra_notes_write
(
struct
file
*
file
,
loff_t
*
foffset
)
{
return
0
;
}
static
inline
int
elf_coredump_extra_notes_write
(
struct
coredump_params
*
cprm
)
{
return
0
;
}
#else
extern
int
elf_coredump_extra_notes_size
(
void
);
extern
int
elf_coredump_extra_notes_write
(
struct
file
*
file
,
loff_t
*
foffset
);
extern
int
elf_coredump_extra_notes_write
(
struct
coredump_params
*
cprm
);
#endif
#endif
/* _LINUX_ELF_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录