diff options
author | tron <tron@pkgsrc.org> | 1998-04-26 09:32:56 +0000 |
---|---|---|
committer | tron <tron@pkgsrc.org> | 1998-04-26 09:32:56 +0000 |
commit | 1bef3ce69a74d72867073def443a186e6ded87aa (patch) | |
tree | 0ed651971ff31ce41fb3b33eb172dcf4c6eb5764 /net/rumba/files | |
parent | 7595c3dcae852fe388b06f572342355b3de53eed (diff) | |
download | pkgsrc-1bef3ce69a74d72867073def443a186e6ded87aa.tar.gz |
Initial import of FreeBSD's "rumba" port.
Diffstat (limited to 'net/rumba/files')
-rw-r--r-- | net/rumba/files/Makefile.unrumba | 4 | ||||
-rw-r--r-- | net/rumba/files/md5 | 1 | ||||
-rw-r--r-- | net/rumba/files/unrumba.c | 73 |
3 files changed, 78 insertions, 0 deletions
diff --git a/net/rumba/files/Makefile.unrumba b/net/rumba/files/Makefile.unrumba new file mode 100644 index 00000000000..d7830b93f2d --- /dev/null +++ b/net/rumba/files/Makefile.unrumba @@ -0,0 +1,4 @@ +PROG=unrumba +NOMAN=sorry + +.include <bsd.prog.mk> diff --git a/net/rumba/files/md5 b/net/rumba/files/md5 new file mode 100644 index 00000000000..f64f6faa789 --- /dev/null +++ b/net/rumba/files/md5 @@ -0,0 +1 @@ +MD5 (rumba.0.4.s.gnutar.gz) = 7a3fc82f8e108b8d05decb11d45c09c4 diff --git a/net/rumba/files/unrumba.c b/net/rumba/files/unrumba.c new file mode 100644 index 00000000000..8dd157c1179 --- /dev/null +++ b/net/rumba/files/unrumba.c @@ -0,0 +1,73 @@ +#include <sys/param.h> +#include <sys/mount.h> + +#include <err.h> +#include <sysexits.h> +#include <unistd.h> +#include <stdlib.h> +#include <signal.h> + +static void usage(void); + +int +main(int argc, char** argv) +{ + struct statfs* mntbuf; + int mntcount, i; + int aflag=0; + int ch; + + while ( (ch = getopt(argc, argv, "a")) != -1) { + switch (ch) { + case 'a': + aflag=1; + break; + case '?': + default: + usage(); + } + } + argc -= optind; + argv += optind; + if (aflag && argc != 0) + usage(); + if (!aflag && argc == 0) + usage(); + + for (; argc>0 || aflag; aflag?(void)(aflag=0):(void)(argc--, argv++)) { + char abspath[MAXPATHLEN]; + pid_t pid=0; + if (argc > 0) { + if (realpath(argv[0], abspath) == 0) { + warn(abspath); + continue; + } + } + mntcount=getmntinfo(&mntbuf, MNT_NOWAIT); + if (mntcount < 0) + err(EX_OSERR, "getmntinfo"); + for (i=0; i<mntcount; i++) { + char* s; + int error; + if (argc > 0 && strcmp(abspath, mntbuf[i].f_mntonname) != 0) continue; + if (mntbuf[i].f_type != MOUNT_NFS) continue; + if (strncmp(mntbuf[i].f_mntfromname, "rumba-", 6) != 0) continue; + pid=strtoul(mntbuf[i].f_mntfromname+6, &s, 10); + if (*s) continue; + error = unmount (mntbuf[i].f_mntonname, 0); + if (error == 0) { + kill (pid, SIGHUP); + } else { + warn(mntbuf[i].f_mntonname); + } + } + if (argc > 0 && !pid) + warnx("%s: not currently mounted", abspath); + } +} + +void +usage(void) +{ + errx(EX_USAGE, "Usage: unrumba [-a] [node]"); +} |