diff options
| author | Jason King <jason.king@joyent.com> | 2020-11-16 16:37:31 +0000 |
|---|---|---|
| committer | Jason King <jason.king@joyent.com> | 2020-11-16 16:37:31 +0000 |
| commit | 5ffcb7f72a2f7a214b40ea8d0ef402f68aeada38 (patch) | |
| tree | 86b767ee8b3625c219d1f5438eb25530c9703534 /usr/src/cmd/ctfconvert/ctfconvert.c | |
| parent | 45f7bf1d4508f8d85c7add1bdeb9f7ea099f0ab2 (diff) | |
| parent | de0f04687a2a3fe3692d9ad1254738343bf9c4eb (diff) | |
| download | illumos-joyent-5ffcb7f72a2f7a214b40ea8d0ef402f68aeada38.tar.gz | |
[illumos-gate merge]
commit de0f04687a2a3fe3692d9ad1254738343bf9c4eb
13310 Remove auto_ef.3ext as we don't have the software
commit 25befe07d3c1488cbbdecdb765cd0558e12cc364
13302 pthread_attr_get_np.3c erroneously refers to pthread_getattr_np
commit 509a605d87b8005c687f8d8264f1be379620e886
13304 bhyve ioport handling bungled on reinit
commit 83cd75bb2949d26e6eb38ddefc60fdeed1909643
13309 bhyve movs emulation leaks mem refcnt
commit b713c91e508f40be7797bedd4ae1146ef0652625
7537 want nextboot (one time boot) support
commit 09fcda9fe16a733cc35aa3156a47ef4b909251a6
13172 Port OpenZFS: zfs label bootenv should store data as nvlist
commit c4ecba8aa5f13f00c2439c06af2aa1198771ee66
13025 Port OpenZFS: Add support for boot environment data to be stored in the label
commit 1a2acdcd3ce765904dbf2bfc511e92d68022d100
13308 testrunner/run needs updates for python 3.9
commit 04573c73a7ab1505c46b2c4db26bfde5176dd6a5
13286 bhyve ins/outs emulation misuses %rax
commit 3dfdac06b0c70e672dbe56a2f38ec05fc0254d07
13278 CTF assertion failed cmp->cm_tmap[id].cmt_map == suid
commit a676209deb2ce5d0c98f331659de25e2483f8c4c
13252 ctf_update()/ctf_dwarf_convert_function() leak memory
commit effb27ee30c48fe502152c38487ced379d9f8693
13247 CTF conversion fails with large files
13251 CTF conversion fails if any CU is missing DWARF data
Conflicts:
usr/src/test/test-runner/cmd/run
usr/src/lib/libctf/common/libctf.h
usr/src/lib/libctf/common/ctf_convert.c
Diffstat (limited to 'usr/src/cmd/ctfconvert/ctfconvert.c')
| -rw-r--r-- | usr/src/cmd/ctfconvert/ctfconvert.c | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/usr/src/cmd/ctfconvert/ctfconvert.c b/usr/src/cmd/ctfconvert/ctfconvert.c index 0e37d070f1..bae355be22 100644 --- a/usr/src/cmd/ctfconvert/ctfconvert.c +++ b/usr/src/cmd/ctfconvert/ctfconvert.c @@ -37,6 +37,7 @@ #define CTFCONVERT_FATAL 1 #define CTFCONVERT_USAGE 2 +#define CTFCONVERT_DEFAULT_BATCHSIZE 256 #define CTFCONVERT_DEFAULT_NTHREADS 4 static char *ctfconvert_progname; @@ -67,17 +68,21 @@ ctfconvert_usage(const char *fmt, ...) va_end(ap); } - (void) fprintf(stderr, "Usage: %s [-ims] [-j nthrs] [-l label | " - "-L labelenv] [-o outfile] input\n" + (void) fprintf(stderr, "Usage: %s [-ikm] [-j nthrs] [-l label | " + "-L labelenv] [-b batchsize]\n" + " [-o outfile] input\n" "\n" + "\t-b batch process this many dies at a time (default %d)\n" "\t-i ignore files not built partially from C sources\n" - "\t-j use nthrs threads to perform the merge\n" + "\t-j use nthrs threads to perform the merge (default %d)\n" "\t-k keep around original input file on failure\n" - "\t-m allow input to have missing debug info\n" - "\t-o copy input to outfile and add CTF\n" "\t-l set output container's label to specified value\n" - "\t-L set output container's label to value from environment\n", - ctfconvert_progname); + "\t-L set output container's label to value from environment\n" + "\t-m allow input to have missing debug info\n" + "\t-o copy input to outfile and add CTF\n", + ctfconvert_progname, + CTFCONVERT_DEFAULT_BATCHSIZE, + CTFCONVERT_DEFAULT_NTHREADS); } /* @@ -226,35 +231,48 @@ main(int argc, char *argv[]) int c, ifd, err; boolean_t keep = B_FALSE; uint_t flags = 0; + uint_t bsize = CTFCONVERT_DEFAULT_BATCHSIZE; uint_t nthreads = CTFCONVERT_DEFAULT_NTHREADS; const char *outfile = NULL; const char *label = NULL; const char *infile = NULL; char *tmpfile; ctf_file_t *ofp; - long argj; - char *eptr; char buf[4096]; boolean_t optx = B_FALSE; boolean_t ignore_non_c = B_FALSE; ctfconvert_progname = basename(argv[0]); - while ((c = getopt(argc, argv, ":ij:kl:L:mo:X")) != -1) { + while ((c = getopt(argc, argv, ":b:ij:kl:L:mo:X")) != -1) { switch (c) { + case 'b': { + long argno; + const char *errstr; + + argno = strtonum(optarg, 1, UINT_MAX, &errstr); + if (errstr != NULL) { + ctfconvert_fatal("invalid argument for -b: " + "%s - %s\n", optarg, errstr); + } + bsize = (uint_t)argno; + break; + } case 'i': ignore_non_c = B_TRUE; break; - case 'j': - errno = 0; - argj = strtol(optarg, &eptr, 10); - if (errno != 0 || argj == LONG_MAX || - argj > 1024 || *eptr != '\0') { + case 'j': { + long argno; + const char *errstr; + + argno = strtonum(optarg, 1, 1024, &errstr); + if (errstr != NULL) { ctfconvert_fatal("invalid argument for -j: " - "%s\n", optarg); + "%s - %s\n", optarg, errstr); } - nthreads = (uint_t)argj; + nthreads = (uint_t)argno; break; + } case 'k': keep = B_TRUE; break; @@ -309,7 +327,7 @@ main(int argc, char *argv[]) if (outfile != NULL && strcmp(infile, outfile) != 0) keep = B_TRUE; - ofp = ctf_fdconvert(ifd, label, nthreads, flags, &err, buf, + ofp = ctf_fdconvert(ifd, label, bsize, nthreads, flags, &err, buf, sizeof (buf)); if (ofp == NULL) { /* |
