/*
* Run the command.
*/
+ RunningIoctl = 1;
if ((pid = fork()) == 0) {
if (VerboseOpt < 2) {
int fd = open("/dev/null", O_RDWR);
res = 127;
} else {
int status;
+
while (waitpid(pid, &status, 0) != pid)
;
res = WEXITSTATUS(status);
}
+ RunningIoctl = 0;
+ if (DidInterrupt)
+ _exit(1);
free(cmd);
free(av);
reblock.free_level = HAMMER_LARGEBLOCK_SIZE - reblock.free_level;
if (reblock.free_level < 0)
reblock.free_level = 0;
- printf("reblock free level %d\n", reblock.free_level);
+ printf("reblock start %016llx:%04x free level %d\n",
+ reblock.key_beg.obj_id,
+ reblock.key_beg.localization,
+ reblock.free_level);
fd = open(filesystem, O_RDONLY);
if (fd < 0)
err(1, "Unable to open %s", filesystem);
+ RunningIoctl = 1;
if (ioctl(fd, HAMMERIOC_REBLOCK, &reblock) < 0) {
printf("Reblock %s failed: %s\n", filesystem, strerror(errno));
} else if (reblock.head.flags & HAMMER_IOC_HEAD_INTR) {
- printf("Reblock %s interrupted by timer at %016llx %04x\n",
+ printf("Reblock %s interrupted by timer at %016llx:%04x\n",
filesystem,
reblock.key_cur.obj_id,
reblock.key_cur.localization);
hammer_reset_cycle();
printf("Reblock %s succeeded\n", filesystem);
}
+ RunningIoctl = 0;
close(fd);
printf("Reblocked:\n"
" %lld/%lld btree nodes\n"
rcode = 1;
continue;
}
- printf("objspace %016llx %016llx\n",
+ printf("objspace %016llx:%04x %016llx:%04x\n",
scan->prune.key_beg.obj_id,
- scan->prune.key_end.obj_id);
+ scan->prune.key_beg.localization,
+ scan->prune.key_end.obj_id,
+ scan->prune.key_end.localization);
+ RunningIoctl = 1;
if (ioctl(fd, HAMMERIOC_PRUNE, &scan->prune) < 0) {
printf("Prune %s failed: %s\n",
scan->filesystem, strerror(errno));
scan->prune.stat_dirrecords,
scan->prune.stat_bytes
);
+ RunningIoctl = 0;
close(fd);
}
if (rcode)
static void hammer_parsedevs(const char *blkdevs);
static void sigalrm(int signo);
+static void sigintr(int signo);
static void usage(int exit_code);
int RecurseOpt;
int TwoWayPipeOpt;
int TimeoutOpt;
int DelayOpt = 5;
+int RunningIoctl;
+int DidInterrupt;
u_int64_t BandwidthOpt;
const char *CyclePath;
const char *LinkPath;
}
signal(SIGALRM, sigalrm);
+ signal(SIGINT, sigintr);
if (strcmp(av[0], "synctid") == 0) {
hammer_cmd_synctid(av + 1, ac - 1);
static
void
+sigintr(int signo __unused)
+{
+ if (RunningIoctl == 0)
+ _exit(1);
+ DidInterrupt = 1;
+ /* do nothing (interrupts HAMMER ioctl) */
+}
+
+static
+void
usage(int exit_code)
{
fprintf(stderr,
extern int TwoWayPipeOpt;
extern int TimeoutOpt;
extern int DelayOpt;
+extern int RunningIoctl;
+extern int DidInterrupt;
extern u_int64_t BandwidthOpt;
extern const char *LinkPath;
extern const char *CyclePath;