fix mfs/isofs signal handling
This commit is contained in:
parent
5230a36c2e
commit
cfb108afc7
|
@ -28,6 +28,8 @@ EXTERN char user_path[PATH_MAX+1]; /* pathname to be processed */
|
||||||
EXTERN char *vfs_slink_storage;
|
EXTERN char *vfs_slink_storage;
|
||||||
EXTERN int symloop;
|
EXTERN int symloop;
|
||||||
|
|
||||||
|
EXTERN int unmountdone;
|
||||||
|
|
||||||
EXTERN dev_t fs_dev; /* the device that is handled by this FS proc */
|
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 */
|
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. */
|
/* SEF functions and variables. */
|
||||||
FORWARD _PROTOTYPE( void sef_local_startup, (void) );
|
FORWARD _PROTOTYPE( void sef_local_startup, (void) );
|
||||||
FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) );
|
FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) );
|
||||||
|
FORWARD _PROTOTYPE( void sef_cb_signal_handler, (int signo) );
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* main *
|
* main *
|
||||||
|
@ -71,6 +72,9 @@ PRIVATE void sef_local_startup()
|
||||||
|
|
||||||
/* No live update support for now. */
|
/* No live update support for now. */
|
||||||
|
|
||||||
|
/* Register signal callbacks. */
|
||||||
|
sef_setcb_signal_handler(sef_cb_signal_handler);
|
||||||
|
|
||||||
/* Let SEF perform startup. */
|
/* Let SEF perform startup. */
|
||||||
sef_startup();
|
sef_startup();
|
||||||
}
|
}
|
||||||
|
@ -100,6 +104,22 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
|
||||||
return(OK);
|
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 *
|
* get_work *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
|
|
@ -101,6 +101,7 @@ PUBLIC int fs_mountpoint()
|
||||||
PUBLIC int fs_unmount(void) {
|
PUBLIC int fs_unmount(void) {
|
||||||
release_v_pri(&v_pri); /* Release the super block */
|
release_v_pri(&v_pri); /* Release the super block */
|
||||||
dev_close(driver_endpoints[(fs_dev >> MAJOR) & BYTE].driver_e, fs_dev);
|
dev_close(driver_endpoints[(fs_dev >> MAJOR) & BYTE].driver_e, fs_dev);
|
||||||
|
unmountdone = TRUE;
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,11 @@ PRIVATE void sef_cb_signal_handler(int signo)
|
||||||
|
|
||||||
exitsignaled = 1;
|
exitsignaled = 1;
|
||||||
fs_sync();
|
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