1 .\" Copyright (c) 2006, 2008 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Japanese Version Copyright (c) 2006-2008 Akihiro MOTOKI
24 .\" Translated 2006-04-15, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
25 .\" Updated 2007-01-05, Akihiro MOTOKI, LDP v2.43
26 .\" Updated 2007-09-03, Akihiro MOTOKI, LDP v2.64
27 .\" Updated 2008-08-10, Akihiro MOTOKI, LDP v3.05
28 .\" Updated 2008-09-19, Akihiro MOTOKI, LDP v3.08
30 .TH CORE 5 2010-02-25 "Linux" "Linux Programmer's Manual"
33 .\"O core \- core dump file
34 core \- ¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë
37 .\"O The default action of certain signals is to cause a process to terminate
39 .\"O .IR "core dump file" ,
40 .\"O a disk file containing an image of the process's memory at
41 .\"O the time of termination.
42 .\"O This image can be used in a debugger (e.g.,
44 .\"O to inspect the state of the program at the time that it terminated.
45 .\"O A list of the signals which cause a process to dump core can be found in
47 ¤¢¤ë¼ï¤Î¥·¥°¥Ê¥ë¤ò¼õ¤±¤¿¾ì¹ç¤Î¥Ç¥Õ¥©¥ë¥È¤Î¥¢¥¯¥·¥ç¥ó¤Ï¡¢
48 ¥×¥í¥»¥¹¤ò½ªÎ»¤· (terminate)¡¢
49 .I "¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë (core dump file)"
50 ¤òÀ¸À®¤¹¤ë¤³¤È¤Ç¤¢¤ë¡£¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë¤Ï¡¢¥Ç¥£¥¹¥¯¾å¤ËÀ¸À®¤µ¤ì¤ë
51 ½ªÎ»»þ¤Î¥×¥í¥»¥¹¤Î¥á¥â¥ê¥¤¥á¡¼¥¸¤òÆâÍƤȤ¹¤ë¥Õ¥¡¥¤¥ë¤Ç¤¢¤ë¡£
52 ¤³¤Î¥¤¥á¡¼¥¸¤ò¥Ç¥Ð¥Ã¥¬ (Î㤨¤Ð
55 ¥×¥í¥°¥é¥à¤¬½ªÎ»¤·¤¿»þÅÀ¤Î¥×¥í¥°¥é¥à¤Î¾õÂÖ¤ò¸¡ºº¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
56 ¤É¤Î¥·¥°¥Ê¥ë¤ò¼õ¤±¤¿¤È¤¤Ë¥×¥í¥»¥¹¤¬¥³¥¢¥À¥ó¥×¤òÀ¸À®¤¹¤ë¤«¤Î¥ê¥¹¥È¤Ï
60 .\"O A process can set its soft
62 .\"O resource limit to place an upper limit on the size of the core dump file
63 .\"O that will be produced if it receives a "core dump" signal; see
64 .\"O .BR getrlimit (2)
66 ¥×¥í¥»¥¹¤Ï¥½¥Õ¥È¡¦¥ê¥½¡¼¥¹À©¸Â
68 ¤òÀßÄꤹ¤ë¤³¤È¤Ç¡¢¡Ö¥³¥¢¥À¥ó¥×¡×¥·¥°¥Ê¥ë¤ò¼õ¿®¤·¤¿ºÝ¤ËÀ¸À®¤µ¤ì¤ë
69 ¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë¤Î¥µ¥¤¥º¤Ë¾å¸Â¤ò²Ý¤¹¤³¤È¤¬¤Ç¤¤ë¡£¾ÜºÙ¤Ï
73 .\"O There are various circumstances in which a core dump file is
75 ¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë¤¬À¸À®¤µ¤ì¤Ê¤¤¾õ¶·¤¬¤¤¤¯¤Ä¤«¤¢¤ë:
77 .\"O The process does not have permission to write the core file.
78 .\"O (By default the core file is called
80 .\"O and is created in the current working directory.
81 .\"O See below for details on naming.)
82 .\"O Writing the core file will fail if the directory in which
83 .\"O it is to be created is nonwritable,
84 .\"O or if a file with the same name exists and
86 .\"O or is not a regular file
87 .\"O (e.g., it is a directory or a symbolic link).
88 ¥×¥í¥»¥¹¤¬¥³¥¢¥Õ¥¡¥¤¥ë¤ò½ñ¤¹þ¤àµö²Ä¤ò»ý¤¿¤Ê¤¤¾ì¹ç
89 (¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¥³¥¢¥Õ¥¡¥¤¥ë¤Ï
91 ¤È¤¤¤¦Ì¾Á°¤Ç¡¢¥«¥ì¥ó¥È¡¦¥ï¡¼¥¥ó¥°¡¦¥Ç¥£¥ì¥¯¥È¥ê¤ËÀ¸À®¤µ¤ì¤ë¡£
92 ̿̾µ¬Â§¤Î¾ÜºÙ¤Ï²¼µ¤ò»²¾È)¡£
93 ¥³¥¢¥Õ¥¡¥¤¥ë¤òÀ¸À®¤·¤è¤¦¤È¤·¤¿¥Ç¥£¥ì¥¯¥È¥ê¤¬½ñ¤¹þ¤ß²Äǽ¤Ç¤Ê¤¤¾ì¹ç¡¢
94 ¤â¤·¤¯¤ÏƱ¤¸Ì¾Á°¤Î¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¡¢¤½¤Î¥Õ¥¡¥¤¥ë¤¬½ñ¤¹þ¤ß²Äǽ¤Ç¤â
95 Ä̾ï¤Î¥Õ¥¡¥¤¥ë¤Ç¤â¤Ê¤¤¾ì¹ç (Î㤨¤Ð¡¢¥Ç¥£¥ì¥¯¥È¥ê¤ä¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯)¡¢
96 ¥³¥¢¥Õ¥¡¥¤¥ë¤ÎÀ¸À®¤Ï¼ºÇÔ¤¹¤ë¡£
98 .\"O A (writable, regular) file with the same name as would be used for the
99 .\"O core dump already exists, but there is more than one hard link to that
101 ¥³¥¢¥À¥ó¥×¤Ë»È¤ª¤¦¤È¤·¤¿¤Î¤ÈƱ¤¸Ì¾Á°¤Î (½ñ¤¹þ¤ß²Äǽ¤Ê¡¢Ä̾ï¤Î) ¥Õ¥¡¥¤¥ë¤¬
102 ¤¹¤Ç¤Ë¸ºß¤·¡¢¤½¤Î¥Õ¥¡¥¤¥ë¤ËÂФ¹¤ë¥Ï¡¼¥É¥ê¥ó¥¯¤¬ 2¸Ä°Ê¾å¤¢¤ë¾ì¹ç¡£
104 .\"O The file system where the core dump file would be created is full;
105 .\"O or has run out of inodes; or is mounted read-only;
106 .\"O or the user has reached their quota for the file system.
107 ¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë¤òÀ¸À®¤·¤è¤¦¤È¤·¤¿¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬¥Õ¥ë¤Ç¤¢¤ë¤«¡¢
108 inode ¤¬Á´¤Æ»ÈÍѤµ¤ì¤Æ¤¤¤ë¤«¡¢Æɤ߹þ¤ßÀìÍѤǥޥ¦¥ó¥È¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¡£
109 ¤Þ¤¿¤Ï¡¢¤½¤Î¥æ¡¼¥¶¤Î¥Ç¥£¥¹¥¯»ÈÍÑÎ̤¬¤½¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î
110 ¥¯¥ª¡¼¥¿ (quota) ¤Ë㤷¤Æ¤¤¤ë¡£
112 .\"O The directory in which the core dump file is to be created does
114 ¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë¤òÀ¸À®¤·¤è¤¦¤È¤·¤¿¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¡£
118 .\"O (core file size) or
120 .\"O (file size) resource limits for the process are set to zero; see
121 .\"O .BR getrlimit (2)
122 .\"O and the documentation of the shell's
128 ¥×¥í¥»¥¹Ëè¤Î¥ê¥½¡¼¥¹À©¸Â
130 (¥³¥¢¥Õ¥¡¥¤¥ë¤Î¥µ¥¤¥º) ¤«
132 (¥Õ¥¡¥¤¥ë¥µ¥¤¥º) ¤¬ 0 ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡£
136 ¥³¥Þ¥ó¥É¤Î¥É¥¥å¥á¥ó¥È
142 .\"O The binary being executed by the process does not have read
143 .\"O permission enabled.
144 ¥×¥í¥»¥¹¤¬¼Â¹Ô¤·¤¿¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤ÎÆɤ߽Ф·µö²Ä¤¬Í¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤Ê¤¤¾ì¹ç¡£
146 .\"O The process is executing a set-user-ID (set-group-ID) program
147 .\"O that is owned by a user (group) other than the real user (group)
148 .\"O ID of the process.
149 .\"O (However, see the description of the
151 .\"O .B PR_SET_DUMPABLE
152 .\"O operation, and the description of the
153 .\"O .I /proc/sys/fs/suid_dumpable
154 .\"O .\" FIXME . Perhaps relocate discussion of /proc/sys/fs/suid_dumpable
155 .\"O .\" and PR_SET_DUMPABLE to this page?
158 ¥×¥í¥»¥¹¤¬¼Â¹Ô¤·¤Æ¤¤¤ë set-user-ID (set-group-ID) ¥×¥í¥°¥é¥à¤Î½êͼԤÎ
159 ¥æ¡¼¥¶ (¥°¥ë¡¼¥×) ¤¬¡¢¥×¥í¥»¥¹¤Î¼Â UID (¼Â GID) ¤È°Û¤Ê¤ë¾ì¹ç
166 .I /proc/sys/fs/suid_dumpable
167 ¥Õ¥¡¥¤¥ë¤ÎÀâÌÀ¤â»²¾È¤Î¤³¤È)¡£
168 .\" FIXME . Perhaps relocate discussion of /proc/sys/fs/suid_dumpable
169 .\" and PR_SET_DUMPABLE to this page?
170 .\"O .SS Naming of core dump files
171 .SS ¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë¤Î̾Á°
172 .\"O By default, a core dump file is named
175 .\"O .I /proc/sys/kernel/core_pattern
176 .\"O file (since Linux 2.6 and 2.4.21)
177 .\"O can be set to define a template that is used to name core dump files.
178 .\"O The template can contain % specifiers which are substituted
179 .\"O by the following values when a core file is created:
180 .\" motoki XXX Ʊ¤¸ÆâÍƤ¬½ÅÊ£¤·¤Æ½ñ¤«¤ì¤Æ¤¤¤ë¡£
181 ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë¤Î̾Á°¤Ï
183 ¤È¤Ê¤ë¤¬¡¢¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë¤Î̾Á°¤ò·è¤á¤ë¤Î¤Ë»È¤ï¤ì¤ë¥Æ¥ó¥×¥ì¡¼¥È¤ò
184 .I /proc/sys/kernel/core_pattern
185 ¥Õ¥¡¥¤¥ë¤ËÄêµÁ¤¹¤ë¤³¤È¤Ç¡¢¥Õ¥¡¥¤¥ë̾¤òÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤¤ë
186 .RI ( /proc/sys/kernel/core_pattern
187 ¤Ï Linux 2.6 ¤ª¤è¤Ó 2.4.21 °Ê¹ß¤ÇÍøÍѤǤ¤ë)¡£
188 ¥Æ¥ó¥×¥ì¡¼¥È¤Ë¤Ï % »Ø¼¨»Ò (specifier) ¤òÆþ¤ì¤ë¤³¤È¤¬¤Ç¤¤ë¡£
189 ¤³¤ì¤Ï¥³¥¢¥Õ¥¡¥¤¥ë¤¬À¸À®¤µ¤ì¤ëºÝ¤Ë¡¢°Ê²¼¤ÎÃͤËÃÖ¤´¹¤¨¤é¤ì¤ë¡£
195 .\"O a single % character
199 .\"O PID of dumped process
200 ¥À¥ó¥×¤µ¤ì¤¿¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ID (PID)
203 .\"O (numeric) real UID of dumped process
204 ¥À¥ó¥×¤µ¤ì¤¿¥×¥í¥»¥¹¤Î¼Â¥æ¡¼¥¶ ID (real UID)
207 .\"O (numeric) real GID of dumped process
208 ¥À¥ó¥×¤µ¤ì¤¿¥×¥í¥»¥¹¤Î¼Â¥°¥ë¡¼¥× ID (real GID)
211 .\"O number of signal causing dump
212 ¥À¥ó¥×¤ò°ú¤µ¯¤³¤·¤¿¥·¥°¥Ê¥ë¤ÎÈÖ¹æ
215 .\"O time of dump, expressed as seconds since the
216 .\"O Epoch, 1970-01-01 00:00:00 +0000 (UTC)
217 ¥À¥ó¥×»þ¹ï¡¢µª¸µ (Epoch; 1970-01-01 00:00:00 +0000 (UTC))
221 .\"O hostname (same as \fInodename\fP returned by \fBuname\fP(2))
222 ¥Û¥¹¥È̾ (\fBuname\fP(2) ¤ÇÊÖ¤µ¤ì¤ë \fInodename\fP ¤ÈƱ¤¸)
225 .\"O executable filename (without path prefix)
226 ¼Â¹Ô¥Õ¥¡¥¤¥ë̾ (¥Ñ¥¹Ì¾¤Î¥×¥ì¥Õ¥£¥Ã¥¯¥¹¤Ï´Þ¤Þ¤ì¤Ê¤¤)
229 .\"O core file size soft resource limit of crashing process (since Linux 2.6.24)
230 ¥¯¥é¥Ã¥·¥å¤·¤¿¥×¥í¥»¥¹¤Î¥³¥¢¥Õ¥¡¥¤¥ë¤Î¥µ¥¤¥º¤Ë´Ø¤¹¤ë¥½¥Õ¥È¥ê¥½¡¼¥¹¾å¸Â
235 .\"O A single % at the end of the template is dropped from the
236 .\"O core filename, as is the combination of a % followed by any
237 .\"O character other than those listed above.
238 ¥Æ¥ó¥×¥ì¡¼¥È¤ÎËöÈø¤Ë 1 ¸Ä¤À¤± % ¤¬¤¢¤ë¾ì¹ç¡¢
239 ¤½¤Î % ¤Ï¥³¥¢¥Õ¥¡¥¤¥ë̾¤Ë¤Ï´Þ¤á¤é¤ì¤Ê¤¤¡£¤Þ¤¿¡¢¾å¤ÇÎóµó¤µ¤ì¤Æ
240 ¤¤¤Ê¤¤ % ¤Èʸ»ú¤ÎÁȤ߹ç¤ï¤»¤¬¤¢¤Ã¤¿¾ì¹ç¤âƱÍͤǤ¢¤ë¡£
241 .\"O All other characters in the template become a literal
242 .\"O part of the core filename.
243 ¥Æ¥ó¥×¥ì¡¼¥È¤Ë¤ª¤±¤ë¾¤Îʸ»ú¤Ï¡¢
244 ¥³¥¢¥Õ¥¡¥¤¥ë̾¤È¤·¤Æ¤½¤Î¤Þ¤Þ»È¤ï¤ì¤ë¡£
245 .\"O The template may include \(aq/\(aq characters, which are interpreted
246 .\"O as delimiters for directory names.
247 ¥Æ¥ó¥×¥ì¡¼¥È¤Ë¤Ï \(aq/\(aq ʸ»ú¤òÆþ¤ì¤ë¤³¤È¤¬¤Ç¤¡¢
248 ¥Ç¥£¥ì¥¯¥È¥ê̾¤Î¶èÀÚ¤êʸ»ú¤È²ò¼á¤µ¤ì¤ë¡£
249 .\"O The maximum size of the resulting core filename is 128 bytes (64 bytes
250 .\"O in kernels before 2.6.19).
251 ·ë²Ì¤È¤·¤ÆÀ¸À®¤µ¤ì¤ë¥³¥¢¥Õ¥¡¥¤¥ë̾¤ÎºÇÂ祵¥¤¥º¤Ï 128 ¥Ð¥¤¥È¤Ç¤¢¤ë
252 (2.6.19 ¤è¤êÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤Ï 64 ¥Ð¥¤¥È)¡£
253 .\"O The default value in this file is "core".
254 ¤³¤Î¥Õ¥¡¥¤¥ë¤Î¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï "core" ¤Ç¤¢¤ë¡£
255 .\"O For backward compatibility, if
256 .\"O .I /proc/sys/kernel/core_pattern
257 .\"O does not include "%p" and
258 .\"O .I /proc/sys/kernel/core_uses_pid
260 .\"O is nonzero, then .PID will be appended to the core filename.
261 °ÊÁ°¤Î¤â¤Î¤È¤Î¸ß´¹À¤Î¤¿¤á¡¢
262 .I /proc/sys/kernel/core_pattern
265 .I /proc/sys/kernel/core_uses_pid
266 (²¼µ»²¾È) ¤¬ 0 ¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢.PID ¤¬¥³¥¢¥Õ¥¡¥¤¥ë̾¤ËÄɲ䵤ì¤ë¡£
268 .\"O Since version 2.4, Linux has also provided
269 .\"O a more primitive method of controlling
270 .\"O the name of the core dump file.
272 .\"O .I /proc/sys/kernel/core_uses_pid
273 .\"O file contains the value 0, then a core dump file is simply named
275 .\"O If this file contains a nonzero value, then the core dump file includes
276 .\"O the process ID in a name of the form
278 ¥Ð¡¼¥¸¥ç¥ó 2.4 °Ê¹ß¤Î Linux ¤Ç¤Ï
279 ¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë¤Î̾Á°¤òÀ©¸æ¤¹¤ë¸¶»ÏŪ¤ÊÊýË¡¤âÄ󶡤µ¤ì¤Æ¤¤¤ë¡£
280 .I /proc/sys/kernel/core_uses_pid
281 ¥Õ¥¡¥¤¥ë¤ËÃÍ 0 ¤¬½ñ¤«¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë¤Ïñ½ã¤Ë
283 ¤È¤¤¤¦Ì¾Á°¤Ë¤Ê¤ë¡£¤³¤Î¥Õ¥¡¥¤¥ë¤Ë 0 °Ê³°¤ÎÃͤ¬½ñ¤«¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
286 ¤È¤¤¤¦·Á¼°¤Î̾Á°¤Ë¤Ê¤ê¡¢¥Õ¥¡¥¤¥ë̾¤Ë¥×¥í¥»¥¹ ID ¤¬´Þ¤Þ¤ì¤ë¡£
287 .\"O .SS Piping core dumps to a program
288 .SS ¥³¥¢¥À¥ó¥×¤Î¥×¥í¥°¥é¥à¤Ø¤Î¥Ñ¥¤¥×
289 .\"O Since kernel 2.6.19, Linux supports an alternate syntax for the
290 .\"O .I /proc/sys/kernel/core_pattern
292 .\"O If the first character of this file is a pipe symbol (\fB|\fP),
293 .\"O then the remainder of the line is interpreted as a program to be
295 .\"O Instead of being written to a disk file, the core dump is given as
296 .\"O standard input to the program.
297 .\"O Note the following points:
298 ¥«¡¼¥Í¥ë 2.6.19 °Ê¹ß¤Ç¤Ï¡¢Linux ¤Ï
299 .I /proc/sys/kernel/core_pattern
300 ¥Õ¥¡¥¤¥ë¤ÎÊ̤ι½Ê¸¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¡£
301 ¤³¤Î¥Õ¥¡¥¤¥ë¤ÎºÇ½é¤Îʸ»ú¤¬¥Ñ¥¤¥×µ¹æ (\fB|\fP) ¤Ç¤¢¤ì¤Ð¡¢
302 ¤½¤Î¹Ô¤Î»Ä¤ê¤ÎÉôʬ¤Ï¼Â¹Ô¤¹¤ë¥×¥í¥°¥é¥à¤È¤·¤Æ²ò¼á¤µ¤ì¤ë¡£
303 ¥³¥¢¥À¥ó¥×¤Ï¡¢¥Ç¥£¥¹¥¯¾å¤Î¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤Þ¤ì¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢
304 ¥×¥í¥°¥é¥à¤Îɸ½àÆþÎϤȤ·¤ÆÅϤµ¤ì¤ë¡£
305 °Ê²¼¤ÎÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£
307 .\"O The program must be specified using an absolute pathname (or a
308 .\"O pathname relative to the root directory, \fI/\fP),
309 .\"O and must immediately follow the '|' character.
310 ¥×¥í¥°¥é¥à¤ÏÀäÂХѥ¹Ì¾ (¤â¤·¤¯¤Ï¥ë¡¼¥È¥Ç¥£¥ì¥¯¥È¥ê \fI/\fP ¤«¤é¤Î
311 ÁêÂХѥ¹Ì¾) ¤Ç»ØÄꤵ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
312 ¤Þ¤¿¡¢'|' ʸ»ú¤Îľ¸å¤«¤é»Ï¤á¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
314 .\"O The process created to run the program runs as user and group
316 ¥×¥í¥°¥é¥à¤ò¼Â¹Ô¤¹¤ë¤¿¤á¤ËÀ¸À®¤µ¤ì¤ë¥×¥í¥»¥¹¤Ï¡¢
321 .\"O Command-line arguments can be supplied to the
322 .\"O program (since kernel 2.6.24),
323 .\"O delimited by white space (up to a total line length of 128 bytes).
324 ¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¤¿ô¤ò¥×¥í¥°¥é¥à¤ËÍ¿¤¨¤ë¤³¤È¤¬¤Ç¤ (¥«¡¼¥Í¥ë 2.6.24 °Ê¹ß)¡¢
325 °ú¤¿ô¤Ï¥Û¥ï¥¤¥È¥¹¥Ú¡¼¥¹¤Ç¶èÀÚ¤ë
326 (1¹Ô¤ÎºÇÂçĹ¤Ï 128 ¥Ð¥¤¥È¤¬¾å¸Â¤Ç¤¢¤ë)¡£
328 .\"O The command-line arguments can include any of
329 .\"O the % specifiers listed above.
330 .\"O For example, to pass the PID of the process that is being dumped, specify
333 ¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¤¿ô¤Ë¤Ï¡¢¾åµ¤Î¥ê¥¹¥È¤Ë¤¢¤ë % »Ø¼¨»Ò¤ò´Þ¤á¤ë¤³¤È¤¬¤Ç¤¤ë¡£
334 Î㤨¤Ð¡¢¥À¥ó¥×¤µ¤ì¤ë¥×¥í¥»¥¹¤Î PID ¤òÅϤ¹¤Ë¤Ï¡¢
338 .\"O .SS Controlling which mappings are written to the core dump
339 .SS ¤É¤Î¥Þ¥Ã¥Ô¥ó¥°¤ò¥³¥¢¥À¥ó¥×¤Ë½ñ¤¹þ¤à¤«¤òÀ©¸æ¤¹¤ë
340 .\"O Since kernel 2.6.23, the Linux-specific
341 .\"O .IR /proc/PID/coredump_filter
342 .\"O file can be used to control which memory segments are written to the
343 .\"O core dump file in the event that a core dump is performed for the
344 .\"O process with the corresponding process ID.
345 ¥«¡¼¥Í¥ë 2.6.23 °Ê¹ß¤Ç¤Ï¡¢Linux ¸ÇͤΥե¡¥¤¥ë
346 .I /proc/PID/coredump_filter
347 ¤ò»È¤Ã¤Æ¡¢Âбþ¤¹¤ë¥×¥í¥»¥¹ ID ¤ò»ý¤Ä¥×¥í¥»¥¹¤ËÂФ·¤Æ¥³¥¢¥À¥ó¥×¤¬¹Ô¤ï¤ì¤ë
348 ºÝ¤Ë¡¢¤É¤Î¥á¥â¥ê¥»¥°¥á¥ó¥È¤ò¥³¥¢¥À¥ó¥×¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤à¤«¤òÀ©¸æ¤Ç¤¤ë¡£
350 .\"O The value in the file is a bit mask of memory mapping types (see
352 .\"O If a bit is set in the mask, then memory mappings of the
353 .\"O corresponding type are dumped; otherwise they are not dumped.
354 .\"O The bits in this file have the following meanings:
355 ¤³¤Î¥Õ¥¡¥¤¥ë¤ÎÃͤϥá¥â¥ê¥Þ¥Ã¥Ô¥ó¥°¼ïÊÌ
357 »²¾È) ¤Î¥Ó¥Ã¥È¥Þ¥¹¥¯¤Ç¤¢¤ë¡£
358 ¥Þ¥¹¥¯Æâ¤Î¤¢¤ë¥Ó¥Ã¥È¤¬¥»¥Ã¥È¤µ¤ì¤ë¤È¡¢¤½¤Î¥Ó¥Ã¥È¤ËÂбþ¤¹¤ë¼ïÊ̤Î
359 ¥á¥â¥ê¥Þ¥Ã¥Ô¥ó¥°¤¬¥À¥ó¥×¤µ¤ì¤ë¡£¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¤â¤Î¤Ï¥À¥ó¥×¤µ¤ì¤Ê¤¤¡£
360 ¤³¤Î¥Õ¥¡¥¤¥ë¤Î³Æ¥Ó¥Ã¥È¤Ï°Ê²¼¤Î°ÕÌ£¤ò»ý¤Ä¡£
366 .\"O Dump anonymous private mappings.
367 ̵̾¤Î¥×¥é¥¤¥Ù¡¼¥È¥Þ¥Ã¥Ô¥ó¥° (anonymous private mappings) ¤ò¥À¥ó¥×¤¹¤ë¡£
370 .\"O Dump anonymous shared mappings.
371 ̵̾¤Î¶¦Í¥Þ¥Ã¥Ô¥ó¥° (anonymous shared mappings) ¤ò¥À¥ó¥×¤¹¤ë¡£
374 .\"O Dump file-backed private mappings.
375 ¥Õ¥¡¥¤¥ë¤È´ØÏ¢ÉÕ¤±¤é¤ì¤¿¥×¥é¥¤¥Ù¡¼¥È¥Þ¥Ã¥Ô¥ó¥°
376 (file-backed private mappings) ¤ò¥À¥ó¥×¤¹¤ë¡£
379 .\"O Dump file-backed shared mappings.
380 ¥Õ¥¡¥¤¥ë¤È´ØÏ¢ÉÕ¤±¤é¤ì¤¿¶¦Í¥Þ¥Ã¥Ô¥ó¥°
381 (file-backed shared mappings) ¤ò¥À¥ó¥×¤¹¤ë¡£
382 .\" file-backed shared mappings of course also update the underlying
387 .\"O The default value of
388 .\"O .I coredump_filter
390 .\"O this reflects traditional Linux behavior and means that
391 .\"O only anonymous memory segments are dumped.
393 ¤Î¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï 0x3 ¤Ç¤¢¤ë¡£
394 ¤³¤ÎÃͤÏÀΤ«¤é¤Î Linux ¤ÎµóÆ°¤òÈ¿±Ç¤·¤¿¤â¤Î¤Ç¤¢¤ê¡¢
395 ̵̾¥á¥â¥ê¥»¥°¥á¥ó¥È (anonymous memory segments) ¤À¤±¤¬¥À¥ó¥×¤µ¤ì¤ë
398 .\"O Memory-mapped I/O pages such as frame buffer are never dumped, and
399 .\"O virtual DSO pages are always dumped, regardless of the
400 .\"O .I coredump_filter
403 ¤ÎÃͤ˴ؤï¤é¤º¡¢¥Õ¥ì¡¼¥à¥Ð¥Ã¥Õ¥¡¤Ê¤É¤Î memory-mapped I/O ¤Ë´Ø¤¹¤ë
404 ¥Ú¡¼¥¸¤Ï·è¤·¤Æ¥À¥ó¥×¤µ¤ì¤º¡¢²¾ÁÛ DSO ¥Ú¡¼¥¸¤Ï¾ï¤Ë¥À¥ó¥×¤µ¤ì¤ë¡£
406 .\"O A child process created via
408 .\"O inherits its parents
409 .\"O .I coredump_filter
412 .\"O .I coredump_filter
413 .\"O value is preserved across an
416 ¤ÇºîÀ®¤µ¤ì¤ë»Ò¥×¥í¥»¥¹¤Ï¿Æ¥×¥í¥»¥¹¤Î
424 .\"O It can be useful to set
425 .\"O .I coredump_filter
426 .\"O in the parent shell before running a program, for example:
427 Îã¤Î¤è¤¦¤Ë¡¢¥×¥í¥°¥é¥à¤ò¼Â¹Ô¤¹¤ëÁ°¤Ë¿Æ¥·¥§¥ë¤Î
429 ¤òÀßÄꤷ¤Æ¤ª¤¯¤ÈÌòΩ¤Ä¤³¤È¤¬¤¢¤ë¡£
433 .RB "$" " echo 0x7 > /proc/self/coredump_filter"
434 .RB "$" " ./some_program"
438 .\"O This file is only provided if the kernel was built with the
439 .\"O .B CONFIG_ELF_CORE
440 .\"O configuration option.
441 ¤³¤Î¥Õ¥¡¥¤¥ë¤¬Ä󶡤µ¤ì¤ë¤Î¤Ï¡¢¥«¡¼¥Í¥ë¤¬ÀßÄꥪ¥×¥·¥ç¥ó
443 ¤ò͸ú¤Ë¤·¤ÆºîÀ®¤µ¤ì¤¿¾ì¹ç¤À¤±¤Ç¤¢¤ë¡£
449 .\"O command can be used to obtain a core dump of a running process.
453 ¥³¥Þ¥ó¥É¤ò»ÈÍѤ¹¤ë¤È¡¢¼Â¹ÔÃæ¤Î¥×¥í¥»¥¹¤Î¥³¥¢¥À¥ó¥×¤ò¼èÆÀ¤Ç¤¤ë¡£
455 .\"O If a multithreaded process (or, more precisely, a process that
456 .\"O shares its memory with another process by being created with the
460 .\"O dumps core, then the process ID is always appended to the core filename,
461 .\"O unless the process ID was already included elsewhere in the
462 .\"O filename via a %p specification in
463 .\"O .IR /proc/sys/kernel/core_pattern .
464 ¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¥×¥í¥»¥¹
469 ¤ÇÀ¸À®¤µ¤ì¤¿ÊÌ¥×¥í¥»¥¹¤È¥á¥â¥ê¤ò¶¦Í¤·¤Æ¤¤¤ë¥×¥í¥»¥¹)
470 ¤¬¥³¥¢¥À¥ó¥×¤òÀ¸À®¤¹¤ë¾ì¹ç¡¢
471 ¥³¥¢¥Õ¥¡¥¤¥ë̾¤Ë¥×¥í¥»¥¹ ID ¤¬É¬¤ºÉղ䵤ì¤ë¡£
473 .I /proc/sys/kernel/core_pattern
474 ¤Î %p »ØÄê¤Ë¤è¤ê¥³¥¢¥Õ¥¡¥¤¥ë̾¤Î¤É¤³¤«Â¾¤Î¾ì½ê¤Ë¥×¥í¥»¥¹ ID ¤¬
475 ¤¹¤Ç¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¥×¥í¥»¥¹ ID ¤¬ËöÈø¤ËÉղ䵤ì¤Ê¤¤¡£
476 .\"O (This is primarily useful when employing the LinuxThreads implementation,
477 .\"O where each thread of a process has a different PID.)
478 (¤³¤Îµ¡Ç½¤¬¤Þ¤ºÌò¤ËΩ¤Ä¤Î¤Ï LinuxThreads ¼ÂÁõ¤òÍøÍѤ·¤Æ¤¤¤ë¾ì¹ç¤Ç¤¢¤ë¡£
479 LinuxThreads ¼ÂÁõ¤Ç¤Ï¡¢¥×¥í¥»¥¹Æâ¤Î¸Ä¡¹¤Î¥¹¥ì¥Ã¥É¤Ï°Û¤Ê¤ë¥×¥í¥»¥¹ ID
481 .\" Always including the PID in the name of the core file made
482 .\" sense for LinuxThreads, where each thread had a unique PID,
483 .\" but doesn't seem to serve any purpose with NPTL, where all the
484 .\" threads in a process share the same PID (as POSIX.1 requires).
485 .\" Probably the behavior is maintained so that applications using
486 .\" LinuxThreads continue appending the PID (the kernel has no easy
487 .\" way of telling which threading implementation the userspace
488 .\" application is using). -- mtk, April 2006
491 .\"O The program below can be used to demonstrate the use of the
492 .\"O pipe syntax in the
493 .\"O .I /proc/sys/kernel/core_pattern
495 .\"O The following shell session demonstrates the use of this program
496 .\"O (compiled to create an executable named
497 .\"O .IR core_pattern_pipe_test ):
499 .I /proc/sys/kernel/core_pattern
500 ¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¤¥×¹½Ê¸¤Î»ÈÍÑÎã¤ò¼¨¤·¤Æ¤¤¤ë¡£
501 °Ê²¼¤Î¥·¥§¥ë¤Î¥»¥Ã¥·¥ç¥ó¤Ï¤³¤Î¥×¥í¥°¥é¥à¤Î»ÈÍÑÎã¤ò¼¨¤¹¤â¤Î¤Ç¤¢¤ë
503 .I core_pattern_pipe_test
504 ¤È¤¤¤¦Ì¾Á°¤Î¼Â¹Ô¥Õ¥¡¥¤¥ë¤òºîÀ®¤·¤Æ¤¤¤ë)¡£
508 .RB "$" " cc \-o core_pattern_pipe_test core_pattern_pipe_test.c"
511 .RB "#" " echo \(aq|$PWD/core_pattern_pipe_test %p \
512 UID=%u GID=%g sig=%s\(aq > \e"
513 .B " /proc/sys/kernel/core_pattern"
516 .BR "^\e" " # type control-backslash"
518 .RB "$" " cat core.info"
520 argc[0]=</home/mtk/core_pattern_pipe_test>
525 Total bytes in core dump: 282624
528 .\"O .SS Program source
529 .SS ¥×¥í¥°¥é¥à¤Î¥½¡¼¥¹
532 /* core_pattern_pipe_test.c */
535 #include <sys/stat.h>
542 #define BUF_SIZE 1024
545 main(int argc, char *argv[])
553 /* Change our current working directory to that of the
556 snprintf(cwd, PATH_MAX, "/proc/%s/cwd", argv[1]);
559 /* Write output to file "core.info" in that directory */
561 fp = fopen("core.info", "w+");
565 /* Display command\-line arguments given to core_pattern
568 fprintf(fp, "argc=%d\\n", argc);
569 for (j = 0; j < argc; j++)
570 fprintf(fp, "argc[%d]=<%s>\\n", j, argv[j]);
572 /* Count bytes in standard input (the core dump) */
575 while ((nread = read(STDIN_FILENO, buf, BUF_SIZE)) > 0)
577 fprintf(fp, "Total bytes in core dump: %d\\n", tot);