Module Name: src Committed By: pooka Date: Fri Jan 7 15:47:14 UTC 2011
Modified Files: src/lib/libp2k: p2k.c Log Message: In case of a P2K_DEBUG mount, dump mount point contents when the process receives SIGINFO. Additionally, dump vnode status if the process gets SIGUSR1 (can be quite quite verbose, therefore not displayed with SIGINFO). To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/lib/libp2k/p2k.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libp2k/p2k.c diff -u src/lib/libp2k/p2k.c:1.52 src/lib/libp2k/p2k.c:1.53 --- src/lib/libp2k/p2k.c:1.52 Fri Jan 7 15:30:09 2011 +++ src/lib/libp2k/p2k.c Fri Jan 7 15:47:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: p2k.c,v 1.52 2011/01/07 15:30:09 pooka Exp $ */ +/* $NetBSD: p2k.c,v 1.53 2011/01/07 15:47:14 pooka Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Antti Kantee. All Rights Reserved. @@ -150,6 +150,29 @@ rump_pub_allbetsareoff_setid(pid, lid); } +static volatile sig_atomic_t dodump; +static void +dumpmp(struct puffs_usermount *pu) +{ + struct statvfs svfsb; + + if (dodump && p2k_fs_statvfs(pu, &svfsb) == 0) { + rump_pub_vfs_mount_print(svfsb.f_mntonname, dodump-1); + } + + dodump = 0; +} + +static void +sighand(int sig) +{ + + if (sig == SIGINFO) + dodump = 1; + else if (sig == SIGUSR1) + dodump = 2; +} + static __inline struct p2k_vp_hash * gethash(struct p2k_mount *p2m, struct vnode *vp) { @@ -444,6 +467,18 @@ puffs_setstacksize(pu, PUFFS_STACKSIZE_MIN); puffs_fakecc = 1; puffs_set_prepost(pu, makelwp, NULL); + + if (p2m->p2m_hasdebug) { + struct timespec ts; + + signal(SIGINFO, sighand); + signal(SIGUSR1, sighand); + + ts.tv_sec = 0; + ts.tv_nsec = 1000*1000*10; /* 10ms */ + puffs_ml_setloopfn(pu, dumpmp); + puffs_ml_settimeout(pu, &ts); + } puffs_set_errnotify(pu, p2k_errcatcher); puffs_setspecific(pu, p2m);