1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2002 Cluster File Systems, Inc.
5 * Author: Peter J. Braam <braam@clusterfs.com>
6 * Author: Phil Schwan <phil@clusterfs.com>
7 * Author: Andreas Dilger <adilger@clusterfs.com>
8 * Author: Robert Read <rread@clusterfs.com>
10 * This file is part of Lustre, http://www.lustre.org.
12 * Lustre is free software; you can redistribute it and/or
13 * modify it under the terms of version 2 of the GNU General Public
14 * License as published by the Free Software Foundation.
16 * Lustre is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with Lustre; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <sys/ioctl.h>
31 #include <sys/socket.h>
32 #include <sys/types.h>
41 #include <linux/obd.h> /* for struct lov_stripe_md */
42 #include <linux/lustre_build_version.h>
51 #include <asm/page.h> /* needed for PAGE_SIZE - rread */
54 #include <linux/list.h>
57 #include <linux/obd_class.h>
58 #include <portals/ptlctl.h>
63 #define MAX_STRING_SIZE 128
64 #define DEVICES_LIST "/proc/fs/lustre/devices"
70 # define MAX_SHMEM_COUNT 1024
71 static long long *shared_counters;
72 static long long counter_snapshot[2][MAX_SHMEM_COUNT];
73 struct timeval prev_time;
76 static int jt_recording;
77 static char rawbuf[8192];
78 static char *buf = rawbuf;
79 static int max = sizeof(rawbuf);
83 static uint32_t cur_device = MAX_OBD_DEVICES;
87 struct lov_stripe_md lsm;
90 static int l2_ioctl(int dev_id, int opc, void *buf)
92 return l_ioctl(dev_id, opc, buf);
95 #define IOC_INIT(data) \
97 memset(&data, 0, sizeof(data)); \
98 data.ioc_dev = cur_device; \
101 #define IOC_PACK(func, data) \
103 memset(buf, 0, sizeof(rawbuf)); \
104 if (obd_ioctl_pack(&data, &buf, max)) { \
105 fprintf(stderr, "error: %s: invalid ioctl\n", \
111 #define IOC_UNPACK(func, data) \
113 if (obd_ioctl_unpack(&data, buf, max)) { \
114 fprintf(stderr, "error: %s: invalid reply\n", \
120 int obd_record(enum cfg_record_type type, int len, void *ptr)
122 struct obd_ioctl_data data;
125 data.ioc_type = type;
126 data.ioc_plen1 = len;
127 data.ioc_pbuf1 = ptr;
128 IOC_PACK("obd_record", data);
130 return l_ioctl(OBD_DEV_ID, OBD_IOC_DORECORD, &data);
133 int lcfg_ioctl(char * func, int dev_id, struct lustre_cfg *lcfg)
136 char lcfg_rawbuf[8192];
137 char * lcfg_buf= lcfg_rawbuf;
138 struct obd_ioctl_data data;
142 memset(lcfg_buf, 0, sizeof(lcfg_rawbuf));
143 if (lustre_cfg_pack(lcfg, &lcfg_buf, sizeof(lcfg_rawbuf), &len)) {
144 fprintf(stderr, "error: %s: invalid ioctl\n",
150 data.ioc_type = LUSTRE_CFG_TYPE;
151 data.ioc_plen1 = len;
152 data.ioc_pbuf1 = lcfg_buf;
153 IOC_PACK(func, data);
156 opc = OBD_IOC_DORECORD;
158 opc = OBD_IOC_PROCESS_CFG;
160 rc = l_ioctl(dev_id, opc, buf);
162 rc = lustre_cfg_unpack(lcfg, lcfg_buf, sizeof(lcfg_rawbuf));
167 char *obdo_print(struct obdo *obd)
171 sprintf(buf, "id: "LPX64"\ngrp: "LPX64"\natime: "LPU64"\nmtime: "LPU64
172 "\nctime: "LPU64"\nsize: "LPU64"\nblocks: "LPU64
173 "\nblksize: %u\nmode: %o\nuid: %d\ngid: %d\nflags: %x\n"
174 "misc: %x\nnlink: %d,\nvalid %x\n",
175 obd->o_id, obd->o_gr, obd->o_atime, obd->o_mtime, obd->o_ctime,
176 obd->o_size, obd->o_blocks, obd->o_blksize, obd->o_mode,
177 obd->o_uid, obd->o_gid, obd->o_flags, obd->o_misc,
178 obd->o_nlink, obd->o_valid);
183 #define BAD_VERBOSE (-999999999)
185 #define N2D_OFF 0x100 /* So we can tell between error codes and devices */
187 static int do_name2dev(char *func, char *name)
189 struct obd_ioctl_data data;
194 data.ioc_inllen1 = strlen(name) + 1;
195 data.ioc_inlbuf1 = name;
197 IOC_PACK(func, data);
198 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_NAME2DEV, buf);
201 IOC_UNPACK(func, data);
203 return data.ioc_dev + N2D_OFF;
207 * resolve a device name to a device number.
208 * supports a number, $name or %uuid.
210 int parse_devname(char *func, char *name)
217 if (name[0] == '$' || name[0] == '%') {
219 rc = do_name2dev(func, name);
222 printf("Name %s is device %d\n", name, ret);
224 printf("No device found for name %s: %s\n",
228 /* Assume it's a number. This means that bogus strings become
229 * 0. I might care about that some day. */
230 ret = strtoul(name, NULL, 0);
231 printf("Selected device %d\n", ret);
238 lsm_string (struct lov_stripe_md *lsm)
240 static char buffer[4096];
242 int space = sizeof (buffer);
249 nob = snprintf(p, space, LPX64, lsm->lsm_object_id);
253 if (lsm->lsm_stripe_count != 0) {
254 nob = snprintf (p, space, "=%u#%u",
255 lsm->lsm_stripe_size,
256 lsm->lsm_stripe_count);
260 for (i = 0; i < lsm->lsm_stripe_count; i++) {
261 nob = snprintf (p, space, "@%u:"LPX64,
262 lsm->lsm_oinfo[i].loi_ost_idx,
263 lsm->lsm_oinfo[i].loi_id);
269 if (space == 0) { /* probable overflow */
270 fprintf (stderr, "lsm_string() overflowed buffer\n");
278 reset_lsmb (union lsm_buffer *lsmb)
280 memset (lsmb->space, 0, sizeof (lsmb->space));
281 lsmb->lsm.lsm_magic = LOV_MAGIC;
285 parse_lsm (union lsm_buffer *lsmb, char *string)
287 struct lov_stripe_md *lsm = &lsmb->lsm;
292 * object_id[=size#count[@offset:id]*]
297 lsm->lsm_object_id = strtoull (string, &end, 0);
309 lsm->lsm_stripe_size = strtoul (string, &end, 0);
318 lsm->lsm_stripe_count = strtoul (string, &end, 0);
323 if (*string == 0) /* don't have to specify obj ids */
326 for (i = 0; i < lsm->lsm_stripe_count; i++) {
330 lsm->lsm_oinfo[i].loi_ost_idx = strtoul(string, &end, 0);
334 lsm->lsm_oinfo[i].loi_id = strtoull(string, &end, 0);
344 char *jt_cmdname(char *func)
346 static char buf[512];
349 sprintf(buf, "%s-%d", func, thread);
356 #define difftime(a, b) \
357 ((a)->tv_sec - (b)->tv_sec + \
358 ((a)->tv_usec - (b)->tv_usec) / 1000000.0)
360 static int be_verbose(int verbose, struct timeval *next_time,
361 __u64 num, __u64 *next_num, int num_total)
368 if (next_time != NULL)
369 gettimeofday(&now, NULL);
371 /* A positive verbosity means to print every X iterations */
373 (next_num == NULL || num >= *next_num || num >= num_total)) {
374 *next_num += verbose;
376 next_time->tv_sec = now.tv_sec - verbose;
377 next_time->tv_usec = now.tv_usec;
382 /* A negative verbosity means to print at most each X seconds */
383 if (verbose < 0 && next_time != NULL &&
384 difftime(&now, next_time) >= 0.0){
385 next_time->tv_sec = now.tv_sec - verbose;
386 next_time->tv_usec = now.tv_usec;
395 static int get_verbose(char *func, const char *arg)
400 if (!arg || arg[0] == 'v')
402 else if (arg[0] == 's' || arg[0] == 'q')
405 verbose = (int)strtoul(arg, &end, 0);
407 fprintf(stderr, "error: %s: bad verbose option '%s'\n",
408 jt_cmdname(func), arg);
414 printf("Print status every %d seconds\n", -verbose);
415 else if (verbose == 1)
416 printf("Print status every operation\n");
417 else if (verbose > 1)
418 printf("Print status every %d operations\n", verbose);
423 int do_disconnect(char *func, int verbose)
425 cur_device = MAX_OBD_DEVICES;
430 static void shmem_setup(void)
432 /* Create new segment */
433 int shmid = shmget(IPC_PRIVATE, sizeof(counter_snapshot[0]), 0600);
436 fprintf(stderr, "Can't create shared memory counters: %s\n",
441 /* Attatch to new segment */
442 shared_counters = (long long *)shmat(shmid, NULL, 0);
444 if (shared_counters == (long long *)(-1)) {
445 fprintf(stderr, "Can't attach shared memory counters: %s\n",
447 shared_counters = NULL;
451 /* Mark segment as destroyed, so it will disappear when we exit.
452 * Forks will inherit attached segments, so we should be OK.
454 if (shmctl(shmid, IPC_RMID, NULL) == -1) {
455 fprintf(stderr, "Can't destroy shared memory counters: %s\n",
460 static inline void shmem_reset(void)
462 if (shared_counters == NULL)
465 memset(shared_counters, 0, sizeof(counter_snapshot[0]));
466 memset(counter_snapshot, 0, sizeof(counter_snapshot));
467 gettimeofday(&prev_time, NULL);
470 static inline void shmem_bump(void)
472 if (shared_counters == NULL || thread <= 0 || thread > MAX_SHMEM_COUNT)
475 shared_counters[thread - 1]++;
478 static void shmem_snap(int n)
480 struct timeval this_time;
486 if (shared_counters == NULL || n > MAX_SHMEM_COUNT)
489 memcpy(counter_snapshot[1], counter_snapshot[0],
490 n * sizeof(counter_snapshot[0][0]));
491 memcpy(counter_snapshot[0], shared_counters,
492 n * sizeof(counter_snapshot[0][0]));
493 gettimeofday(&this_time, NULL);
495 for (i = 0; i < n; i++) {
496 long long this_count =
497 counter_snapshot[0][i] - counter_snapshot[1][i];
499 if (this_count != 0) {
505 secs = (this_time.tv_sec + this_time.tv_usec / 1000000.0) -
506 (prev_time.tv_sec + prev_time.tv_usec / 1000000.0);
508 printf("%d/%d Total: %f/second\n", non_zero, n, total / secs);
510 prev_time = this_time;
513 #define SHMEM_SETUP() shmem_setup()
514 #define SHMEM_RESET() shmem_reset()
515 #define SHMEM_BUMP() shmem_bump()
516 #define SHMEM_SNAP(n) shmem_snap(n)
518 #define SHMEM_SETUP()
519 #define SHMEM_RESET()
521 #define SHMEM_SNAP(n)
524 extern command_t cmdlist[];
526 static int do_device(char *func, char *devname)
528 struct obd_ioctl_data data;
531 memset(&data, 0, sizeof(data));
533 dev = parse_devname(func, devname);
541 int jt_obd_device(int argc, char **argv)
544 do_disconnect(argv[0], 1);
549 rc = do_device(argv[0], argv[1]);
553 int jt_obd_connect(int argc, char **argv)
558 int jt_obd_disconnect(int argc, char **argv)
563 return do_disconnect(argv[0], 0);
566 int jt_opt_device(int argc, char **argv)
574 rc = do_device("device", argv[1]);
577 rc = Parser_execarg(argc - 2, argv + 2, cmdlist);
579 ret = do_disconnect(argv[0], 0);
586 int jt_opt_threads(int argc, char **argv)
588 __u64 threads, next_thread;
597 threads = strtoull(argv[1], &end, 0);
599 fprintf(stderr, "error: %s: invalid page count '%s'\n",
600 jt_cmdname(argv[0]), argv[1]);
604 verbose = get_verbose(argv[0], argv[2]);
605 if (verbose == BAD_VERBOSE)
609 printf("%s: starting "LPD64" threads on device %s running %s\n",
610 argv[0], threads, argv[3], argv[4]);
614 for (i = 1, next_thread = verbose; i <= threads; i++) {
617 fprintf(stderr, "error: %s: #%d - %s\n", argv[0], i,
618 strerror(rc = errno));
620 } else if (rc == 0) {
622 argv[2] = "--device";
623 return jt_opt_device(argc - 2, argv + 2);
624 } else if (be_verbose(verbose, NULL, i, &next_thread, threads))
625 printf("%s: thread #%d (PID %d) started\n",
630 if (!thread) { /* parent process */
631 int live_threads = threads;
633 while (live_threads > 0) {
637 ret = waitpid(0, &status, verbose < 0 ? WNOHANG : 0);
648 fprintf(stderr, "error: %s: wait - %s\n",
649 argv[0], strerror(errno));
654 * This is a hack. We _should_ be able to use
655 * WIFEXITED(status) to see if there was an
656 * error, but it appears to be broken and it
657 * always returns 1 (OK). See wait(2).
659 int err = WEXITSTATUS(status);
660 if (err || WIFSIGNALED(status))
662 "%s: PID %d had rc=%d\n",
675 int jt_opt_net(int argc, char **argv)
686 rc = jt_ptl_network (2, arg2);
689 rc = Parser_execarg(argc - 2, argv + 2, cmdlist);
694 int jt_obd_no_transno(int argc, char **argv)
696 struct obd_ioctl_data data;
704 IOC_PACK(argv[0], data);
705 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_NO_TRANSNO, buf);
707 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
708 strerror(rc = errno));
713 int jt_obd_set_readonly(int argc, char **argv)
715 struct obd_ioctl_data data;
723 IOC_PACK(argv[0], data);
724 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_SET_READONLY, buf);
726 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
727 strerror(rc = errno));
732 int jt_obd_abort_recovery(int argc, char **argv)
734 struct obd_ioctl_data data;
742 IOC_PACK(argv[0], data);
743 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_ABORT_RECOVERY, buf);
745 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
746 strerror(rc = errno));
751 int jt_get_version(int argc, char **argv)
755 struct obd_ioctl_data *data = (struct obd_ioctl_data *)buf;
760 memset(buf, 0, sizeof(buf));
761 data->ioc_version = OBD_IOCTL_VERSION;
762 data->ioc_inllen1 = sizeof(buf) - size_round(sizeof(*data));
763 data->ioc_len = obd_ioctl_packlen(data);
765 rc = l2_ioctl(OBD_DEV_ID, OBD_GET_VERSION, buf);
767 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
768 strerror(rc = errno));
770 printf("Lustre version: %s\n", data->ioc_bulk);
773 printf("lctl version: %s\n", BUILD_VERSION);
777 int jt_obd_list(int argc, char **argv)
780 char buf[MAX_STRING_SIZE];
781 FILE *fp = fopen(DEVICES_LIST, "r");
784 fprintf(stderr, "error: %s: %s could not open file "
786 jt_cmdname(argv[0]), strerror(rc = errno));
793 while (fgets(buf, sizeof(buf), fp) != NULL)
801 /* Get echo client's stripe meta-data for the given object
803 int jt_obd_get_stripe (int argc, char **argv)
805 struct obd_ioctl_data data;
813 id = strtoull (argv[1], &end, 0);
815 fprintf (stderr, "Error: %s: invalid object id '%s'\n",
816 jt_cmdname (argv[0]), argv[1]);
820 memset (&lsm_buffer, 0, sizeof (lsm_buffer));
823 data.ioc_obdo1.o_id = id;
824 data.ioc_obdo1.o_mode = S_IFREG | 0644;
825 data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLMODE;
826 data.ioc_pbuf1 = (char *)&lsm_buffer;
827 data.ioc_plen1 = sizeof (lsm_buffer);
829 IOC_PACK(argv[0], data);
830 rc = l2_ioctl(OBD_DEV_ID, ECHO_IOC_GET_STRIPE, buf);
831 IOC_UNPACK(argv[0], data);
834 fprintf (stderr, "Error: %s: rc %d(%s)\n",
835 jt_cmdname (argv[0]), rc, strerror (errno));
839 printf ("%s\n", lsm_string (&lsm_buffer.lsm));
844 /* Set stripe meta-data for 1 or more objects. Object must be new to
845 * this echo client instance.
847 int jt_obd_set_stripe (int argc, char **argv)
849 struct obd_ioctl_data data;
855 if (argc < 2 || argc > 3)
858 rc = parse_lsm (&lsm_buffer, argv[1]);
860 fprintf (stderr, "error: %s: invalid object '%s'\n",
861 jt_cmdname (argv[0]), argv[1]);
866 count = strtol (argv[2], &end, 0);
868 fprintf (stderr, "error: %s: invalid count '%s'\n",
869 jt_cmdname (argv[0]), argv[1]);
874 for (i = 0; i < count; i++) {
876 data.ioc_obdo1.o_id = lsm_buffer.lsm.lsm_object_id + i;
877 data.ioc_obdo1.o_mode = S_IFREG | 0644;
878 data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLMODE;
879 data.ioc_pbuf1 = (char *)&lsm_buffer;
880 data.ioc_plen1 = sizeof (lsm_buffer);
882 IOC_PACK (argv[0], data);
883 rc = l2_ioctl (OBD_DEV_ID, ECHO_IOC_SET_STRIPE, buf);
884 IOC_UNPACK (argv[0], data);
887 fprintf (stderr, "Error: %s: rc %d(%s)\n",
888 jt_cmdname (argv[0]), rc, strerror (errno));
896 /* Clear stripe meta-data info for an object on this echo-client instance
898 int jt_obd_unset_stripe (int argc, char **argv)
900 struct obd_ioctl_data data;
908 id = strtoull (argv[1], &end, 0);
910 fprintf (stderr, "error: %s: invalid object id '%s'\n",
911 jt_cmdname (argv[0]), argv[1]);
916 data.ioc_obdo1.o_id = id;
917 data.ioc_obdo1.o_mode = S_IFREG | 0644;
918 data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLMODE;
920 IOC_PACK (argv[0], data);
921 rc = l2_ioctl (OBD_DEV_ID, ECHO_IOC_SET_STRIPE, buf);
922 IOC_UNPACK (argv[0], data);
925 fprintf (stderr, "Error: %s: rc %d(%s)\n",
926 jt_cmdname (argv[0]), rc, strerror (errno));
931 /* Create one or more objects, arg[4] may describe stripe meta-data. If
932 * not, defaults assumed. This echo-client instance stashes the stripe
933 * object ids. Use get_stripe on this node to print full lsm and
934 * set_stripe on another node to cut/paste between nodes.
936 int jt_obd_create(int argc, char **argv)
938 struct obd_ioctl_data data;
939 struct timeval next_time;
940 __u64 count = 1, next_count, base_id = 0;
941 int verbose = 1, mode = 0100644, rc = 0, i, valid_lsm = 0;
945 if (argc < 2 || argc > 5)
948 count = strtoull(argv[1], &end, 0);
950 fprintf(stderr, "error: %s: invalid iteration count '%s'\n",
951 jt_cmdname(argv[0]), argv[1]);
956 mode = strtoul(argv[2], &end, 0);
958 fprintf(stderr, "error: %s: invalid mode '%s'\n",
959 jt_cmdname(argv[0]), argv[2]);
962 if (!(mode & S_IFMT))
967 verbose = get_verbose(argv[0], argv[3]);
968 if (verbose == BAD_VERBOSE)
973 reset_lsmb (&lsm_buffer); /* will set default */
975 rc = parse_lsm (&lsm_buffer, argv[4]);
977 fprintf(stderr, "error: %s: invalid lsm '%s'\n",
978 jt_cmdname(argv[0]), argv[4]);
981 base_id = lsm_buffer.lsm.lsm_object_id;
985 printf("%s: "LPD64" objects\n", jt_cmdname(argv[0]), count);
986 gettimeofday(&next_time, NULL);
987 next_time.tv_sec -= verbose;
989 for (i = 1, next_count = verbose; i <= count; i++) {
990 data.ioc_obdo1.o_mode = mode;
991 data.ioc_obdo1.o_id = base_id;
992 data.ioc_obdo1.o_uid = 0;
993 data.ioc_obdo1.o_gid = 0;
994 data.ioc_obdo1.o_valid = OBD_MD_FLTYPE | OBD_MD_FLMODE |
995 OBD_MD_FLID | OBD_MD_FLUID | OBD_MD_FLGID;
998 data.ioc_plen1 = sizeof lsm_buffer;
999 data.ioc_pbuf1 = (char *)&lsm_buffer;
1002 IOC_PACK(argv[0], data);
1003 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_CREATE, buf);
1004 IOC_UNPACK(argv[0], data);
1007 fprintf(stderr, "error: %s: #%d - %s\n",
1008 jt_cmdname(argv[0]), i, strerror(rc = errno));
1011 if (!(data.ioc_obdo1.o_valid & OBD_MD_FLID)) {
1012 fprintf(stderr, "error: %s: objid not valid #%d:%08x\n",
1013 jt_cmdname(argv[0]), i, data.ioc_obdo1.o_valid);
1018 if (be_verbose(verbose, &next_time, i, &next_count, count))
1019 printf("%s: #%d is object id "LPX64"\n",
1020 jt_cmdname(argv[0]), i, data.ioc_obdo1.o_id);
1025 int jt_obd_setattr(int argc, char **argv)
1027 struct obd_ioctl_data data;
1035 data.ioc_obdo1.o_id = strtoull(argv[1], &end, 0);
1037 fprintf(stderr, "error: %s: invalid objid '%s'\n",
1038 jt_cmdname(argv[0]), argv[1]);
1041 data.ioc_obdo1.o_mode = S_IFREG | strtoul(argv[2], &end, 0);
1043 fprintf(stderr, "error: %s: invalid mode '%s'\n",
1044 jt_cmdname(argv[0]), argv[2]);
1047 data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE;
1049 IOC_PACK(argv[0], data);
1050 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_SETATTR, buf);
1052 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
1053 strerror(rc = errno));
1058 int jt_obd_destroy(int argc, char **argv)
1060 struct obd_ioctl_data data;
1061 struct timeval next_time;
1062 __u64 count = 1, next_count;
1069 if (argc < 2 || argc > 4)
1072 id = strtoull(argv[1], &end, 0);
1074 fprintf(stderr, "error: %s: invalid objid '%s'\n",
1075 jt_cmdname(argv[0]), argv[1]);
1079 count = strtoull(argv[2], &end, 0);
1082 "error: %s: invalid iteration count '%s'\n",
1083 jt_cmdname(argv[0]), argv[2]);
1089 verbose = get_verbose(argv[0], argv[3]);
1090 if (verbose == BAD_VERBOSE)
1094 printf("%s: "LPD64" objects\n", jt_cmdname(argv[0]), count);
1095 gettimeofday(&next_time, NULL);
1096 next_time.tv_sec -= verbose;
1098 for (i = 1, next_count = verbose; i <= count; i++, id++) {
1099 data.ioc_obdo1.o_id = id;
1100 data.ioc_obdo1.o_mode = S_IFREG | 0644;
1101 data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLMODE;
1103 IOC_PACK(argv[0], data);
1104 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_DESTROY, buf);
1105 IOC_UNPACK(argv[0], data);
1108 fprintf(stderr, "error: %s: objid "LPX64": %s\n",
1109 jt_cmdname(argv[0]), id, strerror(rc = errno));
1113 if (be_verbose(verbose, &next_time, i, &next_count, count))
1114 printf("%s: #%d is object id "LPX64"\n",
1115 jt_cmdname(argv[0]), i, id);
1121 int jt_obd_getattr(int argc, char **argv)
1123 struct obd_ioctl_data data;
1131 data.ioc_obdo1.o_id = strtoull(argv[1], &end, 0);
1133 fprintf(stderr, "error: %s: invalid objid '%s'\n",
1134 jt_cmdname(argv[0]), argv[1]);
1137 /* to help obd filter */
1138 data.ioc_obdo1.o_mode = 0100644;
1139 data.ioc_obdo1.o_valid = 0xffffffff;
1140 printf("%s: object id "LPX64"\n", jt_cmdname(argv[0]),data.ioc_obdo1.o_id);
1142 IOC_PACK(argv[0], data);
1143 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_GETATTR, buf);
1144 IOC_UNPACK(argv[0], data);
1146 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
1147 strerror(rc = errno));
1149 printf("%s: object id "LPX64", mode %o\n", jt_cmdname(argv[0]),
1150 data.ioc_obdo1.o_id, data.ioc_obdo1.o_mode);
1155 int jt_obd_test_getattr(int argc, char **argv)
1157 struct obd_ioctl_data data;
1158 struct timeval start, next_time;
1159 __u64 i, count, next_count;
1165 if (argc < 2 && argc > 4)
1169 count = strtoull(argv[1], &end, 0);
1171 fprintf(stderr, "error: %s: invalid iteration count '%s'\n",
1172 jt_cmdname(argv[0]), argv[1]);
1177 verbose = get_verbose(argv[0], argv[2]);
1178 if (verbose == BAD_VERBOSE)
1183 if (argv[3][0] == 't') {
1184 objid = strtoull(argv[3] + 1, &end, 0);
1186 objid += thread - 1;
1188 objid = strtoull(argv[3], &end, 0);
1190 fprintf(stderr, "error: %s: invalid objid '%s'\n",
1191 jt_cmdname(argv[0]), argv[3]);
1196 gettimeofday(&start, NULL);
1197 next_time.tv_sec = start.tv_sec - verbose;
1198 next_time.tv_usec = start.tv_usec;
1200 printf("%s: getting "LPD64" attrs (objid "LPX64"): %s",
1201 jt_cmdname(argv[0]), count, objid, ctime(&start.tv_sec));
1203 for (i = 1, next_count = verbose; i <= count; i++) {
1204 data.ioc_obdo1.o_id = objid;
1205 data.ioc_obdo1.o_mode = S_IFREG;
1206 data.ioc_obdo1.o_valid = 0xffffffff;
1207 IOC_PACK(argv[0], data);
1208 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_GETATTR, &data);
1211 fprintf(stderr, "error: %s: #"LPD64" - %d:%s\n",
1212 jt_cmdname(argv[0]), i, errno, strerror(rc = errno));
1216 (verbose, &next_time, i, &next_count, count))
1217 printf("%s: got attr #"LPD64"\n",
1218 jt_cmdname(argv[0]), i);
1226 gettimeofday(&end, NULL);
1228 diff = difftime(&end, &start);
1232 printf("%s: "LPD64" attrs in %.3fs (%.3f attr/s): %s",
1233 jt_cmdname(argv[0]), i, diff, i / diff,
1234 ctime(&end.tv_sec));
1239 int jt_obd_test_brw(int argc, char **argv)
1241 struct obd_ioctl_data data;
1242 struct timeval start, next_time;
1243 __u64 count, next_count, len, thr_offset = 0, objid = 3;
1244 int write = 0, verbose = 1, cmd, i, rc = 0, pages = 1;
1245 int repeat_offset = 0;
1248 if (argc < 2 || argc > 7) {
1249 fprintf(stderr, "error: %s: bad number of arguments: %d\n",
1250 jt_cmdname(argv[0]), argc);
1254 /* make each thread write to a different offset */
1255 if (argv[1][0] == 't') {
1256 count = strtoull(argv[1] + 1, &end, 0);
1258 thr_offset = thread - 1;
1260 count = strtoull(argv[1], &end, 0);
1263 fprintf(stderr, "error: %s: bad iteration count '%s'\n",
1264 jt_cmdname(argv[0]), argv[1]);
1269 if (argv[2][0] == 'w' || argv[2][0] == '1')
1271 /* else it's a read */
1273 if (argv[2][0] != 0 &&
1279 verbose = get_verbose(argv[0], argv[3]);
1280 if (verbose == BAD_VERBOSE)
1285 pages = strtoul(argv[4], &end, 0);
1287 fprintf(stderr, "error: %s: bad page count '%s'\n",
1288 jt_cmdname(argv[0]), argv[4]);
1293 if (argv[5][0] == 't') {
1294 objid = strtoull(argv[5] + 1, &end, 0);
1296 objid += thread - 1;
1298 objid = strtoull(argv[5], &end, 0);
1300 fprintf(stderr, "error: %s: bad objid '%s'\n",
1301 jt_cmdname(argv[0]), argv[5]);
1308 /* communicate the 'type' of brw test and batching to echo_client.
1309 * don't start. we'd love to refactor this lctl->echo_client
1311 data.ioc_pbuf1 = (void *)1;
1315 switch(argv[6][0]) {
1316 case 'g': /* plug and unplug */
1317 data.ioc_pbuf1 = (void *)2;
1318 data.ioc_plen1 = strtoull(argv[6] + 1, &end,
1321 case 'p': /* prep and commit */
1322 data.ioc_pbuf1 = (void *)3;
1323 data.ioc_plen1 = strtoull(argv[6] + 1, &end,
1327 fprintf(stderr, "error: %s: batching '%s' "
1328 "needs to specify 'p' or 'g'\n",
1329 jt_cmdname(argv[0]), argv[6]);
1334 fprintf(stderr, "error: %s: bad batching '%s'\n",
1335 jt_cmdname(argv[0]), argv[6]);
1338 data.ioc_plen1 *= PAGE_SIZE;
1341 len = pages * PAGE_SIZE;
1343 data.ioc_obdo1.o_id = objid;
1344 data.ioc_obdo1.o_mode = S_IFREG;
1345 data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE;
1346 data.ioc_count = len;
1347 data.ioc_offset = thr_offset * len * count;
1349 gettimeofday(&start, NULL);
1350 next_time.tv_sec = start.tv_sec - verbose;
1351 next_time.tv_usec = start.tv_usec;
1354 printf("%s: %s "LPU64"x%d pages (obj "LPX64", off "LPU64"): %s",
1355 jt_cmdname(argv[0]), write ? "writing" : "reading", count,
1356 pages, objid, data.ioc_offset, ctime(&start.tv_sec));
1358 cmd = write ? OBD_IOC_BRW_WRITE : OBD_IOC_BRW_READ;
1359 for (i = 1, next_count = verbose; i <= count; i++) {
1360 data.ioc_obdo1.o_valid &= ~(OBD_MD_FLBLOCKS|OBD_MD_FLGRANT);
1361 IOC_PACK(argv[0], data);
1362 rc = l2_ioctl(OBD_DEV_ID, cmd, buf);
1365 fprintf(stderr, "error: %s: #%d - %s on %s\n",
1366 jt_cmdname(argv[0]), i, strerror(rc = errno),
1367 write ? "write" : "read");
1369 } else if (be_verbose(verbose, &next_time,i, &next_count,count))
1370 printf("%s: %s number %dx%d\n", jt_cmdname(argv[0]),
1371 write ? "write" : "read", i, pages);
1374 data.ioc_offset += len;
1381 gettimeofday(&end, NULL);
1383 diff = difftime(&end, &start);
1387 printf("%s: %s %dx%d pages in %.3fs (%.3f MB/s): %s",
1388 jt_cmdname(argv[0]), write ? "wrote" : "read",
1390 ((double)i * pages * getpagesize()) /
1392 ctime(&end.tv_sec));
1398 int jt_obd_lov_getconfig(int argc, char **argv)
1400 struct obd_ioctl_data data;
1401 struct lov_desc desc;
1402 struct obd_uuid *uuidarray;
1412 fd = open(path, O_RDONLY);
1414 fprintf(stderr, "open \"%s\" failed: %s\n", path,
1419 memset(&desc, 0, sizeof(desc));
1420 obd_str2uuid(&desc.ld_uuid, argv[1]);
1421 desc.ld_tgt_count = ((OBD_MAX_IOCTL_BUFFER-sizeof(data)-sizeof(desc)) /
1422 sizeof(*uuidarray));
1425 uuidarray = calloc(desc.ld_tgt_count, sizeof(*uuidarray));
1427 fprintf(stderr, "error: %s: no memory for %d uuid's\n",
1428 jt_cmdname(argv[0]), desc.ld_tgt_count);
1433 data.ioc_inllen1 = sizeof(desc);
1434 data.ioc_inlbuf1 = (char *)&desc;
1435 data.ioc_inllen2 = desc.ld_tgt_count * sizeof(*uuidarray);
1436 data.ioc_inlbuf2 = (char *)uuidarray;
1438 if (obd_ioctl_pack(&data, &buf, max)) {
1439 fprintf(stderr, "error: %s: invalid ioctl\n",
1440 jt_cmdname(argv[0]));
1444 rc = ioctl(fd, OBD_IOC_LOV_GET_CONFIG, buf);
1445 if (rc == -ENOSPC) {
1449 fprintf(stderr, "error: %s: ioctl error: %s\n",
1450 jt_cmdname(argv[0]), strerror(rc = errno));
1452 struct obd_uuid *ptr;
1455 if (obd_ioctl_unpack(&data, buf, max)) {
1456 fprintf(stderr, "error: %s: invalid reply\n",
1457 jt_cmdname(argv[0]));
1461 printf("default_stripe_count: %u\n",
1462 desc.ld_default_stripe_count);
1463 printf("default_stripe_size: "LPU64"\n",
1464 desc.ld_default_stripe_size);
1465 printf("default_stripe_offset: "LPU64"\n",
1466 desc.ld_default_stripe_offset);
1467 printf("default_stripe_pattern: %u\n", desc.ld_pattern);
1468 printf("obd_count: %u\n", desc.ld_tgt_count);
1469 for (i = 0, ptr = uuidarray; i < desc.ld_tgt_count; i++, ptr++)
1470 printf("%u: %s\n", i, (char *)ptr);
1478 int jt_obd_test_ldlm(int argc, char **argv)
1480 struct obd_ioctl_data data;
1487 IOC_PACK(argv[0], data);
1488 rc = l2_ioctl(OBD_DEV_ID, IOC_LDLM_TEST, buf);
1490 fprintf(stderr, "error: %s: test failed: %s\n",
1491 jt_cmdname(argv[0]), strerror(rc = errno));
1495 int jt_obd_dump_ldlm(int argc, char **argv)
1497 struct obd_ioctl_data data;
1504 IOC_PACK(argv[0], data);
1505 rc = l2_ioctl(OBD_DEV_ID, IOC_LDLM_DUMP, buf);
1507 fprintf(stderr, "error: %s failed: %s\n",
1508 jt_cmdname(argv[0]), strerror(rc = errno));
1512 int jt_obd_ldlm_regress_start(int argc, char **argv)
1515 struct obd_ioctl_data data;
1516 char argstring[200];
1517 int i, count = sizeof(argstring) - 1;
1523 argstring[0] = '\0';
1524 for (i = 1; i < argc; i++) {
1525 strncat(argstring, " ", count);
1527 strncat(argstring, argv[i], count);
1528 count -= strlen(argv[i]);
1531 if (strlen(argstring)) {
1532 data.ioc_inlbuf1 = argstring;
1533 data.ioc_inllen1 = strlen(argstring) + 1;
1536 IOC_PACK(argv[0], data);
1537 rc = l2_ioctl(OBD_DEV_ID, IOC_LDLM_REGRESS_START, buf);
1539 fprintf(stderr, "error: %s: test failed: %s\n",
1540 jt_cmdname(argv[0]), strerror(rc = errno));
1545 int jt_obd_ldlm_regress_stop(int argc, char **argv)
1548 struct obd_ioctl_data data;
1554 IOC_PACK(argv[0], data);
1555 rc = l2_ioctl(OBD_DEV_ID, IOC_LDLM_REGRESS_STOP, buf);
1558 fprintf(stderr, "error: %s: test failed: %s\n",
1559 jt_cmdname(argv[0]), strerror(rc = errno));
1563 static int do_activate(int argc, char **argv, int flag)
1565 struct obd_ioctl_data data;
1572 /* reuse offset for 'active' */
1573 data.ioc_offset = flag;
1575 IOC_PACK(argv[0], data);
1576 rc = l2_ioctl(OBD_DEV_ID, IOC_OSC_SET_ACTIVE, buf);
1578 fprintf(stderr, "error: %s: failed: %s\n",
1579 jt_cmdname(argv[0]), strerror(rc = errno));
1584 int jt_obd_deactivate(int argc, char **argv)
1586 return do_activate(argc, argv, 0);
1589 int jt_obd_activate(int argc, char **argv)
1591 return do_activate(argc, argv, 1);
1594 int jt_obd_recover(int argc, char **argv)
1597 struct obd_ioctl_data data;
1604 data.ioc_inllen1 = strlen(argv[1]) + 1;
1605 data.ioc_inlbuf1 = argv[1];
1608 IOC_PACK(argv[0], data);
1609 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_CLIENT_RECOVER, buf);
1611 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
1612 strerror(rc = errno));
1618 int jt_obd_mdc_lookup(int argc, char **argv)
1620 struct obd_ioctl_data data;
1621 char *parent, *child;
1622 int rc, fd, verbose = 1;
1624 if (argc < 3 || argc > 4)
1630 verbose = get_verbose(argv[0], argv[3]);
1634 data.ioc_inllen1 = strlen(child) + 1;
1635 data.ioc_inlbuf1 = child;
1637 IOC_PACK(argv[0], data);
1639 fd = open(parent, O_RDONLY);
1641 fprintf(stderr, "open \"%s\" failed: %s\n", parent,
1646 rc = ioctl(fd, IOC_MDC_LOOKUP, buf);
1648 fprintf(stderr, "error: %s: ioctl error: %s\n",
1649 jt_cmdname(argv[0]), strerror(rc = errno));
1654 IOC_UNPACK(argv[0], data);
1655 printf("%s: mode %o uid %d gid %d\n", child,
1656 data.ioc_obdo1.o_mode, data.ioc_obdo1.o_uid,
1657 data.ioc_obdo1.o_gid);
1664 int jt_obd_close_uuid(int argc, char **argv)
1667 struct obd_ioctl_data data;
1670 fprintf(stderr, "usage: %s <uuid> <net-type>\n", argv[0]);
1674 nal = ptl_name2nal(argv[2]);
1677 fprintf (stderr, "Can't parse NAL %s\n", argv[2]);
1682 data.ioc_inllen1 = strlen(argv[1]) + 1;
1683 data.ioc_inlbuf1 = argv[1];
1686 IOC_PACK(argv[0], data);
1687 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_CLOSE_UUID, buf);
1689 fprintf(stderr, "IOC_PORTAL_CLOSE_UUID failed: %s\n",
1697 int jt_cfg_record(int argc, char **argv)
1699 struct obd_ioctl_data data;
1707 data.ioc_inllen1 = strlen(argv[1]) + 1;
1708 data.ioc_inlbuf1 = argv[1];
1710 IOC_PACK(argv[0], data);
1711 rc = l_ioctl(OBD_DEV_ID, OBD_IOC_RECORD, buf);
1714 ptl_set_cfg_record_cb(obd_record);
1716 fprintf(stderr, "OBD_IOC_RECORD failed: %s\n",
1723 int jt_cfg_parse(int argc, char **argv)
1725 struct obd_ioctl_data data;
1733 data.ioc_inllen1 = strlen(argv[1]) + 1;
1734 data.ioc_inlbuf1 = argv[1];
1736 IOC_PACK(argv[0], data);
1737 rc = l_ioctl(OBD_DEV_ID, OBD_IOC_PARSE, buf);
1739 fprintf(stderr, "OBD_IOC_PARSE failed: %s\n",
1746 int jt_cfg_dump_log(int argc, char **argv)
1748 struct obd_ioctl_data data;
1756 data.ioc_inllen1 = strlen(argv[1]) + 1;
1757 data.ioc_inlbuf1 = argv[1];
1759 IOC_PACK(argv[0], data);
1760 rc = l_ioctl(OBD_DEV_ID, OBD_IOC_DUMP_LOG, buf);
1762 fprintf(stderr, "OBD_IOC_DUMP_LOG failed: %s\n",
1768 int jt_cfg_clear_log(int argc, char **argv)
1770 struct obd_ioctl_data data;
1778 data.ioc_inllen1 = strlen(argv[1]) + 1;
1779 data.ioc_inlbuf1 = argv[1];
1781 IOC_PACK(argv[0], data);
1782 rc = l_ioctl(OBD_DEV_ID, OBD_IOC_CLEAR_LOG, buf);
1784 fprintf(stderr, "OBD_IOC_CLEAR_LOG failed: %s\n",
1792 int jt_cfg_endrecord(int argc, char **argv)
1794 struct obd_ioctl_data data;
1802 if (!jt_recording) {
1803 fprintf(stderr, "Not recording, so endrecord doesn't make sense.\n");
1807 IOC_PACK(argv[0], data);
1808 rc = l_ioctl(OBD_DEV_ID, OBD_IOC_ENDRECORD, buf);
1811 ptl_set_cfg_record_cb(NULL);
1813 fprintf(stderr, "OBD_IOC_ENDRECORD failed: %s\n",
1819 int jt_llog_catlist(int argc, char **argv)
1821 struct obd_ioctl_data data;
1828 data.ioc_inllen1 = max - size_round(sizeof(data));
1829 IOC_PACK(argv[0], data);
1831 rc = l_ioctl(OBD_DEV_ID, OBD_IOC_CATLOGLIST, buf);
1833 fprintf(stdout, "%s", ((struct obd_ioctl_data*)buf)->ioc_bulk);
1835 fprintf(stderr, "OBD_IOC_CATLOGLIST failed: %s\n",
1841 int jt_llog_info(int argc, char **argv)
1843 struct obd_ioctl_data data;
1850 data.ioc_inllen1 = strlen(argv[1]) + 1;
1851 data.ioc_inlbuf1 = argv[1];
1852 data.ioc_inllen2 = max - size_round(sizeof(data)) -
1853 size_round(data.ioc_inllen1);
1854 IOC_PACK(argv[0], data);
1856 rc = l_ioctl(OBD_DEV_ID, OBD_IOC_LLOG_INFO, buf);
1858 fprintf(stdout, "%s", ((struct obd_ioctl_data*)buf)->ioc_bulk);
1860 fprintf(stderr, "OBD_IOC_LLOG_INFO failed: %s\n",
1866 int jt_llog_print(int argc, char **argv)
1868 struct obd_ioctl_data data;
1871 if (argc != 2 && argc != 4)
1875 data.ioc_inllen1 = strlen(argv[1]) + 1;
1876 data.ioc_inlbuf1 = argv[1];
1878 data.ioc_inllen2 = strlen(argv[2]) + 1;
1879 data.ioc_inlbuf2 = argv[2];
1880 data.ioc_inllen3 = strlen(argv[3]) + 1;
1881 data.ioc_inlbuf3 = argv[3];
1883 char from[2] = "1", to[3] = "-1";
1884 data.ioc_inllen2 = strlen(from) + 1;
1885 data.ioc_inlbuf2 = from;
1886 data.ioc_inllen3 = strlen(to) + 1;
1887 data.ioc_inlbuf3 = to;
1889 data.ioc_inllen4 = max - size_round(sizeof(data)) -
1890 size_round(data.ioc_inllen1) -
1891 size_round(data.ioc_inllen2) -
1892 size_round(data.ioc_inllen3);
1893 IOC_PACK(argv[0], data);
1895 rc = l_ioctl(OBD_DEV_ID, OBD_IOC_LLOG_PRINT, buf);
1897 fprintf(stdout, "%s", ((struct obd_ioctl_data*)buf)->ioc_bulk);
1899 fprintf(stderr, "OBD_IOC_LLOG_PRINT failed: %s\n",
1905 int jt_llog_cancel(int argc, char **argv)
1907 struct obd_ioctl_data data;
1914 data.ioc_inllen1 = strlen(argv[1]) + 1;
1915 data.ioc_inlbuf1 = argv[1];
1916 data.ioc_inllen2 = strlen(argv[2]) + 1;
1917 data.ioc_inlbuf2 = argv[2];
1918 data.ioc_inllen3 = strlen(argv[3]) + 1;
1919 data.ioc_inlbuf3 = argv[3];
1920 IOC_PACK(argv[0], data);
1922 rc = l_ioctl(OBD_DEV_ID, OBD_IOC_LLOG_CANCEL, buf);
1924 fprintf(stdout, "index %s be canceled.\n", argv[3]);
1926 fprintf(stderr, "OBD_IOC_LLOG_CANCEL failed: %s\n",
1932 int jt_llog_check(int argc, char **argv)
1934 struct obd_ioctl_data data;
1937 if (argc != 2 && argc != 4)
1941 data.ioc_inllen1 = strlen(argv[1]) + 1;
1942 data.ioc_inlbuf1 = argv[1];
1944 data.ioc_inllen2 = strlen(argv[2]) + 1;
1945 data.ioc_inlbuf2 = argv[2];
1946 data.ioc_inllen3 = strlen(argv[3]) + 1;
1947 data.ioc_inlbuf3 = argv[3];
1949 char from[2] = "1", to[3] = "-1";
1950 data.ioc_inllen2 = strlen(from) + 1;
1951 data.ioc_inlbuf2 = from;
1952 data.ioc_inllen3 = strlen(to) + 1;
1953 data.ioc_inlbuf3 = to;
1955 data.ioc_inllen4 = max - size_round(sizeof(data)) -
1956 size_round(data.ioc_inllen1) -
1957 size_round(data.ioc_inllen2) -
1958 size_round(data.ioc_inllen3);
1959 IOC_PACK(argv[0], data);
1961 rc = l_ioctl(OBD_DEV_ID, OBD_IOC_LLOG_CHECK, buf);
1963 fprintf(stdout, "%s", ((struct obd_ioctl_data*)buf)->ioc_bulk);
1965 fprintf(stderr, "OBD_IOC_LLOG_CHECK failed: %s\n",
1970 int jt_llog_remove(int argc, char **argv)
1972 struct obd_ioctl_data data;
1975 if (argc != 3 && argc != 2)
1979 data.ioc_inllen1 = strlen(argv[1]) + 1;
1980 data.ioc_inlbuf1 = argv[1];
1982 data.ioc_inllen2 = strlen(argv[2]) + 1;
1983 data.ioc_inlbuf2 = argv[2];
1985 IOC_PACK(argv[0], data);
1987 rc = l_ioctl(OBD_DEV_ID, OBD_IOC_LLOG_REMOVE, buf);
1990 fprintf(stdout, "log %s are removed.\n", argv[2]);
1992 fprintf(stdout, "the log in catlog %s are removed. \n", argv[1]);
1994 fprintf(stderr, "OBD_IOC_LLOG_REMOVE failed: %s\n",
2000 static void signal_server(int sig)
2002 if (sig == SIGINT) {
2003 do_disconnect("sigint", 1);
2006 fprintf(stderr, "%s: got signal %d\n", jt_cmdname("sigint"), sig);
2009 int obd_initialize(int argc, char **argv)
2012 register_ioc_dev(OBD_DEV_ID, OBD_DEV_PATH);
2018 void obd_finalize(int argc, char **argv)
2020 struct sigaction sigact;
2022 sigact.sa_handler = signal_server;
2023 sigfillset(&sigact.sa_mask);
2024 sigact.sa_flags = SA_RESTART;
2025 sigaction(SIGINT, &sigact, NULL);
2028 printf("END RECORD\n");
2029 jt_cfg_endrecord(argc, argv);
2032 do_disconnect(argv[0], 1);