[haiku-3rdparty-dev] Re: Shutdown file writes

  • From: "Alexander G. M. Smith" <agmsmith@xxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Mon, 01 Sep 2014 17:49:14 -0400

On 01/09/14 05:30 PM, Earl Pottinger wrote:
Still working on my driver, since drivers can not detect the shut-down operation of Haiku I have depended on cache-flush IOCTL command set to the driver by the OS just before shut-down operations start. However, the full file does not appear to be written completely before the computer turns itself off. I am using the following code to write the buffer to the hard drive.
[...]

Kind of tricky since cache flushing is triggered by the fsync. Though your image file is presumably on a different device, so it could work, if the system is smart enough.

To see if your function actually delays shutdown (rather than running in parallel or timing out or something), add a sleep call in there for 10 seconds and see if that actually holds off the shutdown. If not, you'll have to find some other way of delaying shutdown.

- Alex

Other related posts: