Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/lfs_cleanerd Add a method for posting a semaphore wh...
details: https://anonhg.NetBSD.org/src/rev/263daea14e98
branches: trunk
changeset: 756706:263daea14e98
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Jul 29 14:07:39 2010 +0000
description:
Add a method for posting a semaphore when cleaner init has reached
the main loop. This is useful for very quickly executed lfs runs
such as those in tests, as an initialization phase cleaner may
prevent file system unmount.
diffstat:
libexec/lfs_cleanerd/lfs_cleanerd.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diffs (57 lines):
diff -r db5e71091c24 -r 263daea14e98 libexec/lfs_cleanerd/lfs_cleanerd.c
--- a/libexec/lfs_cleanerd/lfs_cleanerd.c Thu Jul 29 13:07:14 2010 +0000
+++ b/libexec/lfs_cleanerd/lfs_cleanerd.c Thu Jul 29 14:07:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.23 2010/02/16 23:13:13 mlelstv Exp $ */
+/* $NetBSD: lfs_cleanerd.c,v 1.24 2010/07/29 14:07:39 pooka Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -45,6 +45,7 @@
#include <err.h>
#include <errno.h>
#include <fcntl.h>
+#include <semaphore.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -1339,6 +1340,7 @@
{
int i, opt, error, r, loopcount, nodetach;
struct timeval tv;
+ sem_t *semaddr = NULL;
CLEANERINFO ci;
#ifndef USE_CLIENT_SERVER
char *cp, *pidname;
@@ -1358,7 +1360,7 @@
/*
* Parse command-line arguments
*/
- while ((opt = getopt(argc, argv, "bC:cdDfi:l:mn:qr:st:")) != -1) {
+ while ((opt = getopt(argc, argv, "bC:cdDfi:l:mn:qr:sS:t:")) != -1) {
switch (opt) {
case 'b': /* Use bytes written, not segments read */
use_bytes = 1;
@@ -1399,6 +1401,13 @@
case 's': /* Small writes */
do_small = 1;
break;
+ case 'S': /* semaphore */
+#ifndef LFS_CLEANER_AS_LIB
+ usage();
+ /*NOTREACHED*/
+#endif
+ semaddr = (void*)(uintptr_t)strtoull(optarg,NULL,0);
+ break;
case 't': /* timeout */
segwait_timeout = atoi(optarg);
break;
@@ -1530,6 +1539,8 @@
* Main cleaning loop.
*/
loopcount = 0;
+ if (semaddr)
+ sem_post(semaddr);
while (nfss > 0) {
int cleaned_one;
do {
Home |
Main Index |
Thread Index |
Old Index