LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-06-2010, 11:55 PM   #1
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
Question How to properly clean up on asynchronous or sudden shutdown?


I have an user space application that performs file I/O operations, when a SIGKILL is captured, some routines are done first to ensure that all I/O operations are completed before rebooting the application or system. My question is, this won't work if the power button is pressed or the power supply is disconnected, so there can be incomplete I/O operation or corrupted data written into the file, so is there a way to prevent data corruption or at least complete any ongoing operation when this scenario happens? Assuming there is at most 1 second before the power really went out, can I/O be still completed?'

I'm running the application on a busybox 2.6.14 kernel on an embedded system board.

Regards,
archieval

Last edited by archieval; 06-06-2010 at 11:57 PM.
 
Old 06-07-2010, 02:03 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

If you pull the plug - there's nothing *any* software can do.

However, if you hit the power-off button ...
... and if your BIOS supports ACPI
... then you CAN make use of ACPI to do a "graceful shutdown"

Here are more details:

http://tldp.org/HOWTO/ACPI-HOWTO/

http://www.columbia.edu/~ariel/acpi/...owto.0.2a.html

'Hope that helps .. PSM
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
overheating then sudden shutdown on acer laptop ethereal27 Linux - Laptop and Netbook 9 12-25-2009 06:29 AM
Sudden Shutdown - Multi-try Startups spud_linux Linux - General 10 08-13-2008 07:36 AM
Sudden shutdown on the login screen on OpenSuse 10.3 cool_thing76 SUSE / openSUSE 1 11-18-2007 06:42 AM
Sudden Shutdown haze Slackware 2 04-17-2005 04:28 PM
Sudden Shutdown sunderam_uccs Linux - Laptop and Netbook 5 02-27-2005 10:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration