An embedded Linux system that continuously writes files (~1/s) to a FAT32 partition occasionally corrupts the partition when interrupted. The process can be interrupted 2 ways: a power cycle, or using musb_hdrc/gadget to copy files to and from the host via USB. The musb_hdrc/gadget is used to switch access to the partition from internal embedded control to USB for transferring files to and from an external host. The solution may be to do a killall process-name but will this safely kill the Linux process? IOW: will the process complete any file IO already started or will there still be corrupted partitions? According to the killall man page If no signal name is specified SIGTERM is sent. Does something need to be added to the code to make sure the kill is clean and/or is there a special killall signal name to do a clean kill?
An embedded Linux system that continuously writes files (~1/s) to a FAT32 partition occasionally
Share
Well, you can modify your application to catch any signal except SIGKILL.
Shutdown operation or cleanup can be performed in a signal handler
Here is a simple example of setting up a handler to delete temporary files when certain fatal signals happen:
Code after signal handler will not execute in case of SIGTERM.