public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Question about core file generation
@ 2007-07-24 15:39 Ravinandan Arakali (rarakali)
  2007-07-26  2:38 ` Carlo Florendo
  0 siblings, 1 reply; 2+ messages in thread
From: Ravinandan Arakali (rarakali) @ 2007-07-24 15:39 UTC (permalink / raw)
  To: linux-kernel

Hi,
When a process dumps core, the do_coredump() initiates the core
file generation. Is this operation synchronous(does the kernel
wait for core to be completely written to disk) ?
Basically, if I have the parent process waiting for exit of
child which dumped core, can the parent access the core immediately
on receipt of "child exit" message ? Is it possible that the
core is still in the process of being written ? If so, what's
the event the parent needs to wait for to be assured of a complete
core.

Thanks,
Ravi

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question about core file generation
  2007-07-24 15:39 Question about core file generation Ravinandan Arakali (rarakali)
@ 2007-07-26  2:38 ` Carlo Florendo
  0 siblings, 0 replies; 2+ messages in thread
From: Carlo Florendo @ 2007-07-26  2:38 UTC (permalink / raw)
  To: Ravinandan Arakali (rarakali); +Cc: linux-kernel

Ravinandan Arakali (rarakali) wrote:
> Hi,
> When a process dumps core, the do_coredump() initiates the core
> file generation. Is this operation synchronous(does the kernel
> wait for core to be completely written to disk) ?

The operations whereby

(1) a process is in the process of exiting while;
(2) the kernel is doing a coredump

is asynchronous with respect to each other, since the process could have 
received an abort signal while the the kernel initiated the core dump.

> Basically, if I have the parent process waiting for exit of
> child which dumped core, can the parent access the core immediately
> on receipt of "child exit" message ? Is it possible that the
> core is still in the process of being written ? If so, what's
> the event the parent needs to wait for to be assured of a complete
> core.

When a child exits, check if the core dump file is still opened by a handle 
(HINT: lsof).

AFAICS from the kernel code, the core dump data or file routine is mutexed 
to ensure that there is only one process handling the core dump file.

You could check if there are still open file handles on the dump.  If there 
are none, it means that the dump had been completed.

HTH.

Best Regards,

Carlo

-- 
Carlo Florendo
Softare Engineer/Network Co-Administrator
Astra Philippines Inc.
UP-Ayala Technopark, Diliman 1101, Quezon City
Philippines
http://www.astra.ph

--
The Astra Group of Companies
5-3-11 Sekido, Tama City
Tokyo 206-0011, Japan
http://www.astra.co.jp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-26  2:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-24 15:39 Question about core file generation Ravinandan Arakali (rarakali)
2007-07-26  2:38 ` Carlo Florendo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox