Make r/w servers unmount themselves cleanly upon receiving SIGINT/TERM.

This commit is contained in:
pooka 2010-01-12 18:43:37 +00:00
parent b95be6c682
commit ef38ca9933
9 changed files with 31 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: psshfs.c,v 1.58 2010/01/07 21:26:49 pooka Exp $ */
/* $NetBSD: psshfs.c,v 1.59 2010/01/12 18:43:37 pooka Exp $ */
/*
* Copyright (c) 2006-2009 Antti Kantee. All Rights Reserved.
@ -41,7 +41,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: psshfs.c,v 1.58 2010/01/07 21:26:49 pooka Exp $");
__RCSID("$NetBSD: psshfs.c,v 1.59 2010/01/12 18:43:37 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -121,6 +121,8 @@ main(int argc, char *argv[])
int nargs;
setprogname(argv[0]);
puffs_unmountonsignal(SIGINT, true);
puffs_unmountonsignal(SIGTERM, true);
if (argc < 3)
usage();

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_ext2fs.c,v 1.8 2009/12/13 21:16:54 pooka Exp $ */
/* $NetBSD: rump_ext2fs.c,v 1.9 2010/01/12 18:43:37 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -50,6 +50,8 @@ main(int argc, char *argv[])
int rv;
setprogname(argv[0]);
puffs_unmountonsignal(SIGINT, true);
puffs_unmountonsignal(SIGTERM, true);
UKFS_DEVICE_ARGVPROBE(&part);
mount_ext2fs_parseargs(argc, argv, &args, &mntflags,

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_ffs.c,v 1.6 2009/12/13 21:16:54 pooka Exp $ */
/* $NetBSD: rump_ffs.c,v 1.7 2010/01/12 18:43:37 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -50,6 +50,8 @@ main(int argc, char *argv[])
int rv;
setprogname(argv[0]);
puffs_unmountonsignal(SIGINT, true);
puffs_unmountonsignal(SIGTERM, true);
UKFS_DEVICE_ARGVPROBE(&part);
mount_ffs_parseargs(argc, argv, &args, &mntflags, canon_dev, canon_dir);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_lfs.c,v 1.14 2009/12/13 21:16:54 pooka Exp $ */
/* $NetBSD: rump_lfs.c,v 1.15 2010/01/12 18:43:37 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -32,6 +32,7 @@
#include <err.h>
#include <pthread.h>
#include <puffs.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -69,6 +70,8 @@ main(int argc, char *argv[])
int rv;
setprogname(argv[0]);
puffs_unmountonsignal(SIGINT, true);
puffs_unmountonsignal(SIGTERM, true);
UKFS_DEVICE_ARGVPROBE(&part);
if (part != ukfs_part_none) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_msdos.c,v 1.7 2009/12/13 21:16:55 pooka Exp $ */
/* $NetBSD: rump_msdos.c,v 1.8 2010/01/12 18:43:37 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -50,6 +50,8 @@ main(int argc, char *argv[])
int rv;
setprogname(argv[0]);
puffs_unmountonsignal(SIGINT, true);
puffs_unmountonsignal(SIGTERM, true);
UKFS_DEVICE_ARGVPROBE(&part);
mount_msdos_parseargs(argc, argv, &args, &mntflags,

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_nfs.c,v 1.9 2009/10/18 16:02:15 pooka Exp $ */
/* $NetBSD: rump_nfs.c,v 1.10 2010/01/12 18:43:37 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -48,6 +48,9 @@ main(int argc, char *argv[])
int rv, mntflags;
setprogname(argv[0]);
puffs_unmountonsignal(SIGINT, true);
puffs_unmountonsignal(SIGTERM, true);
mount_nfs_parseargs(argc, argv, &args, &mntflags, canon_dev, canon_dir);
rv = p2k_run_fs(MOUNT_NFS, canon_dev, canon_dir, mntflags, &args,

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_smbfs.c,v 1.5 2009/10/20 02:14:12 pooka Exp $ */
/* $NetBSD: rump_smbfs.c,v 1.6 2010/01/12 18:43:37 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -59,6 +59,8 @@ main(int argc, char *argv[])
int mntflags;
setprogname(argv[0]);
puffs_unmountonsignal(SIGINT, true);
puffs_unmountonsignal(SIGTERM, true);
p2m = p2k_init(PUFFS_KFLAG_WTCACHE);
atexit(pcancel);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_sysvbfs.c,v 1.4 2009/12/13 21:16:55 pooka Exp $ */
/* $NetBSD: rump_sysvbfs.c,v 1.5 2010/01/12 18:43:38 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -32,6 +32,7 @@
#include <rump/ukfs.h>
#include <err.h>
#include <puffs.h>
#include <stdlib.h>
#include <string.h>
@ -47,6 +48,8 @@ main(int argc, char *argv[])
int rv;
setprogname(argv[0]);
puffs_unmountonsignal(SIGINT, true);
puffs_unmountonsignal(SIGTERM, true);
UKFS_DEVICE_ARGVPROBE(&part);
mount_sysvbfs_parseargs(argc, argv, &args, &mntflags,

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_udf.c,v 1.6 2009/12/13 21:16:55 pooka Exp $ */
/* $NetBSD: rump_udf.c,v 1.7 2010/01/12 18:43:38 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -50,6 +50,8 @@ main(int argc, char *argv[])
int rv;
setprogname(argv[0]);
puffs_unmountonsignal(SIGINT, true);
puffs_unmountonsignal(SIGTERM, true);
UKFS_DEVICE_ARGVPROBE(&part);
mount_udf_parseargs(argc, argv, &args, &mntflags, canon_dev, canon_dir);