fix mfs/isofs signal handling
This commit is contained in:
parent
5230a36c2e
commit
cfb108afc7
4 changed files with 28 additions and 0 deletions
|
@ -28,6 +28,8 @@ EXTERN char user_path[PATH_MAX+1]; /* pathname to be processed */
|
|||
EXTERN char *vfs_slink_storage;
|
||||
EXTERN int symloop;
|
||||
|
||||
EXTERN int unmountdone;
|
||||
|
||||
EXTERN dev_t fs_dev; /* the device that is handled by this FS proc */
|
||||
EXTERN char fs_dev_label[16]; /* Name of the device driver that is handled */
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ FORWARD _PROTOTYPE(void get_work, (message *m_in) );
|
|||
/* SEF functions and variables. */
|
||||
FORWARD _PROTOTYPE( void sef_local_startup, (void) );
|
||||
FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) );
|
||||
FORWARD _PROTOTYPE( void sef_cb_signal_handler, (int signo) );
|
||||
|
||||
/*===========================================================================*
|
||||
* main *
|
||||
|
@ -71,6 +72,9 @@ PRIVATE void sef_local_startup()
|
|||
|
||||
/* No live update support for now. */
|
||||
|
||||
/* Register signal callbacks. */
|
||||
sef_setcb_signal_handler(sef_cb_signal_handler);
|
||||
|
||||
/* Let SEF perform startup. */
|
||||
sef_startup();
|
||||
}
|
||||
|
@ -100,6 +104,22 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
|
|||
return(OK);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* sef_cb_signal_handler *
|
||||
*===========================================================================*/
|
||||
PRIVATE void sef_cb_signal_handler(int signo)
|
||||
{
|
||||
/* Only check for termination signal, ignore anything else. */
|
||||
if (signo != SIGTERM) return;
|
||||
|
||||
/* No need to do a sync, as this is a read-only file system. */
|
||||
|
||||
/* If the file system has already been unmounted, exit immediately.
|
||||
* We might not get another message.
|
||||
*/
|
||||
if (unmountdone) exit(0);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* get_work *
|
||||
*===========================================================================*/
|
||||
|
|
|
@ -101,6 +101,7 @@ PUBLIC int fs_mountpoint()
|
|||
PUBLIC int fs_unmount(void) {
|
||||
release_v_pri(&v_pri); /* Release the super block */
|
||||
dev_close(driver_endpoints[(fs_dev >> MAJOR) & BYTE].driver_e, fs_dev);
|
||||
unmountdone = TRUE;
|
||||
return(OK);
|
||||
}
|
||||
|
||||
|
|
|
@ -133,6 +133,11 @@ PRIVATE void sef_cb_signal_handler(int signo)
|
|||
|
||||
exitsignaled = 1;
|
||||
fs_sync();
|
||||
|
||||
/* If unmounting has already been performed, exit immediately.
|
||||
* We might not get another message.
|
||||
*/
|
||||
if (unmountdone) exit(0);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
|
Loading…
Reference in a new issue