diff options
author | Dan McDonald <danmcd@joyent.com> | 2020-09-22 10:39:49 -0400 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2020-09-22 10:39:49 -0400 |
commit | 267e12a7d9bf6e5fcefb9cc00f46bfff0dc5226e (patch) | |
tree | 19a3941920d0039c35d53a5cbee189b5ca51995a /usr/src/cmd | |
parent | 517abc5c668925e6092495bf332233c3599980d2 (diff) | |
parent | e9faba760cdf80d7dfa110fe0830917ab94668c2 (diff) | |
download | illumos-joyent-vpc.tar.gz |
Merge branch 'master' into vpcvpc
Diffstat (limited to 'usr/src/cmd')
40 files changed, 1923 insertions, 835 deletions
diff --git a/usr/src/cmd/bhyve/bhyverun.c b/usr/src/cmd/bhyve/bhyverun.c index bb3e0721c8..c4ebef1b31 100644 --- a/usr/src/cmd/bhyve/bhyverun.c +++ b/usr/src/cmd/bhyve/bhyverun.c @@ -741,7 +741,12 @@ vmexit_spinup_ap(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu) return (VMEXIT_CONTINUE); } +#ifdef __FreeBSD__ #define DEBUG_EPT_MISCONFIG +#else +/* EPT misconfig debugging not possible now that raw VMCS access is gone */ +#endif + #ifdef DEBUG_EPT_MISCONFIG #define VMCS_GUEST_PHYSICAL_ADDRESS 0x00002400 diff --git a/usr/src/cmd/bhyvectl/bhyvectl.c b/usr/src/cmd/bhyvectl/bhyvectl.c index 22c72cf5df..7f8847b184 100644 --- a/usr/src/cmd/bhyvectl/bhyvectl.c +++ b/usr/src/cmd/bhyvectl/bhyvectl.c @@ -400,6 +400,7 @@ dump_vm_run_exitcode(struct vm_exit *vmexit, int vcpu) #define MSR_AMD7TH_START 0xC0010000 #define MSR_AMD7TH_END 0xC0011FFF +#ifdef __FreeBSD__ static const char * msr_name(uint32_t msr) { @@ -563,8 +564,24 @@ vm_set_vmcs_field(struct vmctx *ctx, int vcpu, int field, uint64_t val) return (vm_set_register(ctx, vcpu, VMCS_IDENT(field), val)); } +#else /* __FreeBSD__ */ +/* VMCS does not allow arbitrary reads/writes */ +static int +vm_get_vmcs_field(struct vmctx *ctx, int vcpu, int field, uint64_t *ret_val) +{ + *ret_val = 0; + return (0); +} static int +vm_set_vmcs_field(struct vmctx *ctx, int vcpu, int field, uint64_t val) +{ + return (EINVAL); +} +#endif /* __FreeBSD__ */ + +#ifdef __FreeBSD__ +static int vm_get_vmcb_field(struct vmctx *ctx, int vcpu, int off, int bytes, uint64_t *ret_val) { @@ -579,6 +596,23 @@ vm_set_vmcb_field(struct vmctx *ctx, int vcpu, int off, int bytes, return (vm_set_register(ctx, vcpu, VMCB_ACCESS(off, bytes), val)); } +#else /* __FreeBSD__ */ +/* Arbitrary VMCB read/write is not allowed */ +static int +vm_get_vmcb_field(struct vmctx *ctx, int vcpu, int off, int bytes, + uint64_t *ret_val) +{ + *ret_val = 0; + return (0); +} + +static int +vm_set_vmcb_field(struct vmctx *ctx, int vcpu, int off, int bytes, + uint64_t val) +{ + return (EINVAL); +} +#endif /* __FreeBSD__ */ enum { VMNAME = 1000, /* avoid collision with return values from getopt */ @@ -2182,8 +2216,15 @@ main(int argc, char *argv[]) &addr); } +#ifdef __FreeBSD__ if (error == 0) error = dump_msr_bitmap(vcpu, addr, cpu_intel); +#else + /* + * Skip dumping the MSR bitmap since raw access to the VMCS is + * currently not possible. + */ +#endif /* __FreeBSD__ */ } if (!error && (get_vpid_asid || get_all)) { diff --git a/usr/src/cmd/cron/crontab.c b/usr/src/cmd/cron/crontab.c index 2d9eea8755..18716bc8c2 100644 --- a/usr/src/cmd/cron/crontab.c +++ b/usr/src/cmd/cron/crontab.c @@ -26,7 +26,7 @@ /* All Rights Reserved */ /* - * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ #include <sys/types.h> @@ -72,10 +72,9 @@ #define WARNSHELL "warning: commands will be executed using /usr/bin/sh\n" #define BADUSAGE \ "usage:\n" \ - "\tcrontab [file]\n" \ - "\tcrontab -e [username]\n" \ - "\tcrontab -l [-g] [username]\n" \ - "\tcrontab -r [username]" + "\tcrontab [-u username] [file]\n" \ + "\tcrontab [-u username] { -e | -g | -l | -r }\n" \ + "\tcrontab { -e | -g | -l | -r } [username]" #define INVALIDUSER "you are not a valid user (no entry in /etc/passwd)." #define NOTALLOWED "you are not authorized to use cron. Sorry." #define NOTROOT \ @@ -137,6 +136,7 @@ main(int argc, char **argv) int stat_loc; int ret; char real_login[UNAMESIZE]; + char *user = NULL; int tmpfd = -1; pam_handle_t *pamh; int pam_error; @@ -145,7 +145,7 @@ main(int argc, char **argv) (void) setlocale(LC_ALL, ""); #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ -#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ +#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it wasn't */ #endif (void) textdomain(TEXT_DOMAIN); @@ -155,7 +155,7 @@ main(int argc, char **argv) exit(1); } - while ((c = getopt(argc, argv, "eglr")) != EOF) + while ((c = getopt(argc, argv, "eglru:")) != EOF) { switch (c) { case 'e': eflag++; @@ -169,10 +169,17 @@ main(int argc, char **argv) case 'r': rflag++; break; + case 'u': + user = optarg; + break; case '?': errflg++; break; } + } + + argc -= optind; + argv += optind; if (eflag + lflag + rflag > 1) errflg++; @@ -180,8 +187,13 @@ main(int argc, char **argv) if (gflag && !lflag) errflg++; - argc -= optind; - argv += optind; + if ((eflag || lflag || rflag) && argc > 0) { + if (user != NULL) + errflg++; + else + user = *argv; + } + if (errflg || argc > 1) crabort(BADUSAGE); @@ -190,11 +202,12 @@ main(int argc, char **argv) crabort(INVALIDUSER); if (strlcpy(real_login, pwp->pw_name, sizeof (real_login)) - >= sizeof (real_login)) + >= sizeof (real_login)) { crabort(NAMETOOLONG); + } - if ((eflag || lflag || rflag) && argc == 1) { - if ((pwp = getpwnam(*argv)) == NULL) + if (user != NULL) { + if ((pwp = getpwnam(user)) == NULL) crabort(INVALIDUSER); if (!cron_admin(real_login)) { @@ -202,8 +215,9 @@ main(int argc, char **argv) crabort(NOTROOT); else pp = getuser(ruid); - } else - pp = *argv++; + } else { + pp = user; + } } else { pp = getuser(ruid); } diff --git a/usr/src/cmd/dtrace/test/cmd/jdtrace/Makefile b/usr/src/cmd/dtrace/test/cmd/jdtrace/Makefile index ee93b7a258..a71f59e549 100644 --- a/usr/src/cmd/dtrace/test/cmd/jdtrace/Makefile +++ b/usr/src/cmd/dtrace/test/cmd/jdtrace/Makefile @@ -66,8 +66,6 @@ clobber: clean -$(RM) $(JDTRACE_JAR) -$(RM) $(PROG) -lint: - install: all $(PROTO_JDTRACE_JAR) $(CMD) $(XLIST) $(PROG): $(SRCS) @@ -75,7 +73,7 @@ $(PROG): $(SRCS) $(POST_PROCESS) ; $(STRIP_STABS) JFLAGS= -g -cp $(CLASSPATH) -d $(CLASSDIR) -JFLAGS += -source 1.5 -target 1.6 -Xlint:all,-options,-path +JFLAGS += -source 7 -target 7 -Xlint:all,-options,-path COMPILE.java=$(JAVAC) $(JFLAGS) JAVASRC= JDTrace.java Getopt.java diff --git a/usr/src/cmd/dtrace/test/tst/common/java_api/Makefile b/usr/src/cmd/dtrace/test/tst/common/java_api/Makefile index 04e6cca7b4..f8f6131c44 100644 --- a/usr/src/cmd/dtrace/test/tst/common/java_api/Makefile +++ b/usr/src/cmd/dtrace/test/tst/common/java_api/Makefile @@ -55,12 +55,10 @@ clobber: clean all: default -lint: - install: all $(PROTO_TEST_JAR) JFLAGS= -g -cp $(CLASSPATH) -d $(CLASSDIR) -JFLAGS += -source 1.5 -target 1.6 -Xlint:all,-options,-rawtypes,-path +JFLAGS += -source 7 -target 7 -Xlint:all,-deprecation,-options,-rawtypes,-path COMPILE.java=$(JAVAC) $(JFLAGS) $(TEST_JAR): $(SRCDIR)/*.java diff --git a/usr/src/cmd/grep/grep.c b/usr/src/cmd/grep/grep.c index ac51023678..6becff5a58 100644 --- a/usr/src/cmd/grep/grep.c +++ b/usr/src/cmd/grep/grep.c @@ -39,6 +39,7 @@ * Copyright 2018 RackTop Systems. * Copyright 2018 Nexenta Systems, Inc. * Copyright 2013 Damian Bogel. All rights reserved. + * Copyright 2020 Oxide Computer Company */ #include <string.h> @@ -58,6 +59,7 @@ #include <wctype.h> #include <ftw.h> #include <sys/param.h> +#include <getopt.h> #define STDIN_FILENAME gettext("(standard input)") @@ -76,7 +78,6 @@ static int bmgtab[M_CSETSIZE]; /* BMG delta1 table */ typedef struct _PATTERN { char *pattern; /* original pattern */ - wchar_t *wpattern; /* wide, lowercased pattern */ struct _PATTERN *next; regex_t re; /* compiled pattern */ } PATTERN; @@ -94,6 +95,7 @@ static uchar_t iflag; /* Case insensitve matching */ static uchar_t Hflag; /* Precede lines by file name */ static uchar_t hflag; /* Suppress printing of filename */ static uchar_t lflag; /* Print file names of matches */ +static uchar_t Lflag; /* Print file names of non-matches */ static uchar_t nflag; /* Precede lines by line number */ static uchar_t rflag; /* Search directories recursively */ static uchar_t bflag; /* Precede matches by block number */ @@ -106,14 +108,15 @@ static uchar_t Fflag; /* Fgrep or -F flag */ static uchar_t Rflag; /* Like rflag, but follow symlinks */ static uchar_t outfn; /* Put out file name */ static uchar_t conflag; /* show context of matches */ +static uchar_t oflag; /* Print only matching output */ static char *cmdname; +static char *stdin_label; /* Optional lable for stdin */ -static int use_wchar, use_bmg, mblocale; +static int use_bmg, mblocale; -static size_t outbuflen, prntbuflen, conbuflen; +static size_t prntbuflen, conbuflen; static unsigned long conalen, conblen, conmatches; static char *prntbuf, *conbuf; -static wchar_t *outline; static void addfile(const char *fn); static void addpattern(char *s); @@ -127,6 +130,20 @@ static void process_path(const char *); static void process_file(const char *, int); /* + * These are values that we use to return from getopt_long. They start at + * SHRT_MAX to avoid any possible conflict with the normal options. These are + * used for long options that have no short option equivalent. + */ +enum grep_opts { + OPT_LABEL = SHRT_MAX + 1 +}; + +static struct option grep_options[] = { + { "label", required_argument, NULL, OPT_LABEL }, + { NULL } +}; + +/* * mainline for grep */ int @@ -166,6 +183,7 @@ main(int argc, char **argv) } else { if (*ap == 'f' || *ap == 'F') { fgrep++; + regflags |= REG_NOSPEC; } } @@ -201,7 +219,8 @@ main(int argc, char **argv) } } - while ((c = getopt(argc, argv, "vwchHilnrbse:f:qxEFIRA:B:C:")) != EOF) { + while ((c = getopt_long(argc, argv, "+vwchHilLnrbse:f:qxEFIRA:B:C:o", + grep_options, NULL)) != EOF) { unsigned long tval; switch (c) { case 'v': /* POSIX: negate matches */ @@ -217,8 +236,17 @@ main(int argc, char **argv) regflags |= REG_ICASE; break; + /* + * The last of -l and -L are honored. + */ case 'l': /* POSIX: Write filenames only */ lflag++; + Lflag = 0; + break; + + case 'L': /* Write non-matching filenames */ + Lflag++; + lflag = 0; break; case 'n': /* POSIX: Write line numbers */ @@ -294,6 +322,7 @@ main(int argc, char **argv) case 'F': /* POSIX: strings, not RE's */ Fflag++; + regflags |= REG_NOSPEC; break; case 'R': /* Solaris: like rflag, but follow symlinks */ @@ -352,6 +381,14 @@ main(int argc, char **argv) } break; + case OPT_LABEL: + stdin_label = optarg; + break; + + case 'o': + oflag++; + break; + default: usage(); } @@ -399,18 +436,46 @@ main(int argc, char **argv) usage(); /* - * -l overrides -H like in GNU grep + * -l or -L overrides -H like in GNU grep. It also overrides -o. */ - if (lflag) + if (lflag || Lflag) { Hflag = 0; + oflag = 0; + } /* * -c, -l and -q flags are mutually exclusive * We have -c override -l like in Solaris. * -q overrides -l & -c programmatically in grep() function. + * -c overrides -o in GNU grep, we honor that. */ - if (cflag && lflag) + if (cflag) { lflag = 0; + Lflag = 0; + oflag = 0; + } + + /* + * If -o is set then we ignore all context related options, like other + * greps. + */ + if (oflag) { + conflag = 0; + } + + /* + * These flags are a semantic mess with no clear answers as to their + * behvaior. Based on some experimentation GNU grep will exit zero if a + * non-match is present, but never print anything. BSD grep seems to + * exit 1 and not print anything, even if there would have been a match. + * Also, you probably don't want to ask about what happens with grep -x + * -o -v, some implementations seem to just ignore -v. + */ + if (oflag && !nvflag) { + (void) fprintf(stderr, gettext("%s: the combination of -v and " + "-o is not supported currently\n"), argv[0]); + exit(2); + } argv += optind - 1; argc -= optind - 1; @@ -443,21 +508,17 @@ main(int argc, char **argv) } /* - * If -x flag is not specified or -i flag is specified - * with fgrep in a multibyte locale, need to use - * the wide character APIs. Otherwise, byte-oriented - * process will be done. - */ - use_wchar = Fflag && mblocale && (!xflag || iflag); - - /* * Compile Patterns and also decide if BMG can be used */ fixpatterns(); + if (stdin_label == NULL) { + stdin_label = STDIN_FILENAME; + } + /* Process all files: stdin, or rest of arg list */ if (argc < 2) { - matched = grep(0, STDIN_FILENAME); + matched = grep(0, stdin_label); } else { if (Hflag || (argc > 2 && hflag == 0)) outfn = 1; /* Print filename on match line */ @@ -695,6 +756,51 @@ addpattern(char *s) } /* + * Check if a given grep pattern that is being used with egrep or grep can be + * considered 'simple'. That is there are no characters that would be treated + * differently from fgrep. In this particular case, we're a little bit + * conservative and look for characters that are: + * + * o 7-bit ASCII + * o Letters + * o Numbers + * o Meta-characters not used in BREs/EREs: !, @, #, /, -, _, <, >, = + * + * This can certianly be made more complex and less restrictive with additional + * testing. + */ +static boolean_t +simple_pattern(const char *str) +{ + for (; *str != '\0'; str++) { + if (!isascii(*str)) { + return (B_FALSE); + } + + if (isalnum(*str)) { + continue; + } + + switch (*str) { + case '!': + case '@': + case '#': + case '/': + case '-': + case '_': + case '<': + case '>': + case '=': + continue; + default: + return (B_FALSE); + } + } + + return (B_TRUE); +} + +/* * Fix patterns. * Must do after all arguments read, in case later -i option. */ @@ -702,15 +808,38 @@ static void fixpatterns(void) { PATTERN *pp; - int rv, fix_pattern, npatterns; + int rv, fix_pattern; + + /* + * Decide if we are able to run the Boyer-Moore-Gosper algorithm. + * Use the Boyer-Moore-Gosper algorithm if: + * - fgrep or non-BRE/ERE (Fflag || simple_pattern()) + * - singlebyte locale (!mblocale) + * - no ignoring case (!iflag) + * - no printing line numbers (!nflag) + * - no negating the output (nvflag) + * - only one pattern (patterns != NULL && patterns->next == + * NULL) + * - non zero length pattern (strlen(patterns->pattern) != 0) + * - no context required (conflag == 0) + * - no exact matches (!oflag) + * - no word matches (!wlag) + */ + use_bmg = !mblocale && !iflag && !nflag && nvflag && !oflag && + (patterns != NULL && patterns->next == NULL) && !wflag && + (strlen(patterns->pattern) != 0) && conflag == 0 && + (Fflag || simple_pattern(patterns->pattern)); + + if (use_bmg) { + return; + } /* * Fix the specified pattern if -x is specified. */ fix_pattern = !Fflag && xflag; - for (npatterns = 0, pp = patterns; pp != NULL; pp = pp->next) { - npatterns++; + for (pp = patterns; pp != NULL; pp = pp->next) { if (fix_pattern) { char *cp, *cq; size_t plen, nplen; @@ -733,61 +862,9 @@ fixpatterns(void) pp->pattern = cp; } - if (Fflag) { - if (use_wchar) { - /* - * Fflag && mblocale && iflag - * Fflag && mblocale && !xflag - */ - size_t n; - n = strlen(pp->pattern) + 1; - if ((pp->wpattern = - malloc(sizeof (wchar_t) * n)) == NULL) { - (void) fprintf(stderr, - gettext("%s: out of memory\n"), - cmdname); - exit(2); - } - if (mbstowcs(pp->wpattern, pp->pattern, n) == - (size_t)-1) { - (void) fprintf(stderr, - gettext("%s: failed to convert " - "\"%s\" to wide-characters\n"), - cmdname, pp->pattern); - exit(2); - } - if (iflag) { - wchar_t *wp; - for (wp = pp->wpattern; *wp != L'\0'; - wp++) { - *wp = towlower((wint_t)*wp); - } - } - free(pp->pattern); - } else { - /* - * Fflag && mblocale && !iflag - * Fflag && !mblocale && iflag - * Fflag && !mblocale && !iflag - */ - if (iflag) { - unsigned char *cp; - for (cp = (unsigned char *)pp->pattern; - *cp != '\0'; cp++) { - *cp = tolower(*cp); - } - } - } - /* - * fgrep: No regular expressions. - */ - continue; - } - /* - * For non-fgrep, compile the regular expression, - * give an informative error message, and exit if - * it didn't compile. + * Compile the regular expression, give an informative error + * message, and exit if it didn't compile. */ if ((rv = regcomp(&pp->re, pp->pattern, regflags)) != 0) { (void) regerror(rv, &pp->re, errstr, sizeof (errstr)); @@ -798,25 +875,6 @@ fixpatterns(void) } free(pp->pattern); } - - /* - * Decide if we are able to run the Boyer-Moore-Gosper algorithm. - * Use the Boyer-Moore-Gosper algorithm if: - * - fgrep (Fflag) - * - singlebyte locale (!mblocale) - * - no ignoring case (!iflag) - * - no printing line numbers (!nflag) - * - no negating the output (nvflag) - * - only one pattern (npatterns == 1) - * - non zero length pattern (strlen(patterns->pattern) != 0) - * - no context required (conflag == 0) - * - * It's guaranteed patterns->pattern is still alive - * when Fflag && !mblocale. - */ - use_bmg = Fflag && !mblocale && !iflag && !nflag && nvflag && - (npatterns == 1) && (strlen(patterns->pattern) != 0) && - conflag == 0; } /* @@ -849,36 +907,6 @@ rfind_nl(const char *ptr, size_t len) } /* - * Duplicate the specified string converting each character - * into a lower case. - */ -static char * -istrdup(const char *s1) -{ - static size_t ibuflen = 0; - static char *ibuf = NULL; - size_t slen; - char *p; - - slen = strlen(s1); - if (slen >= ibuflen) { - /* ibuf does not fit to s1 */ - ibuflen = slen + 1; - ibuf = realloc(ibuf, ibuflen); - if (ibuf == NULL) { - (void) fprintf(stderr, - gettext("%s: out of memory\n"), cmdname); - exit(2); - } - } - p = ibuf; - do { - *p++ = tolower(*s1); - } while (*s1++ != '\0'); - return (ibuf); -} - -/* * Do grep on a single file. * Return true in any lines matched. * @@ -909,6 +937,7 @@ grep(int fd, const char *fn) int conaprnt = 0, conbprnt = 0, lastmatch = 0; boolean_t nearmatch; /* w/in N+1 of last match */ boolean_t havematch = B_FALSE; /* have a match in context */ + boolean_t sameline = B_FALSE; /* Are we still on the same line? */ size_t prntlen; if (patterns == NULL) @@ -920,16 +949,6 @@ grep(int fd, const char *fn) bmgcomp(pp->pattern, strlen(pp->pattern)); } - if (use_wchar && outline == NULL) { - outbuflen = BUFSIZE + 1; - outline = malloc(sizeof (wchar_t) * outbuflen); - if (outline == NULL) { - (void) fprintf(stderr, gettext("%s: out of memory\n"), - cmdname); - exit(2); - } - } - if (prntbuf == NULL) { prntbuflen = BUFSIZE; if ((prntbuf = malloc(prntbuflen + 1)) == NULL) { @@ -958,6 +977,8 @@ grep(int fd, const char *fn) long count; off_t offset = 0; char separate; + char *startmatch = NULL; /* -o, start of match */ + char *postmatch = NULL; /* -o, character after match */ boolean_t last_ctx = B_FALSE, eof = B_FALSE; if (data_len == 0) { @@ -1129,7 +1150,18 @@ L_start_process: } goto L_next_line; } - lineno++; + + /* + * When using -o, we might actually loop around while still on + * the same line. In such a case, we need to make sure we don't + * increment the line number. + */ + if (!sameline) { + lineno++; + } else { + sameline = B_FALSE; + } + /* * Line starts from ptr and ends at ptrend. * line_len will be the length of the line. @@ -1141,108 +1173,59 @@ L_start_process: * From now, the process will be performed based * on the line from ptr to ptrend. */ - if (use_wchar) { - size_t len; - - if (line_len >= outbuflen) { - outbuflen = line_len + 1; - outline = realloc(outline, - sizeof (wchar_t) * outbuflen); - if (outline == NULL) { - (void) fprintf(stderr, - gettext("%s: out of memory\n"), - cmdname); - exit(2); - } - } + for (pp = patterns; pp; pp = pp->next) { + int rv; + regmatch_t rm; + size_t nmatch = 0; - len = mbstowcs(outline, ptr, line_len); - if (len == (size_t)-1) { - (void) fprintf(stderr, gettext( - "%s: input file \"%s\": line %lld: invalid multibyte character\n"), - cmdname, fn, lineno); - /* never match a line with invalid sequence */ - goto L_skip_line; - } - outline[len] = L'\0'; + /* + * The current implementation of regexec has a higher + * cost when you ask for match information. As a result, + * we only ask for a match when we know that we need it + * specifically. This is always needed for -o because we + * rely on it to tell us what we matched. For fgrep -x + * we need it so we can determine whether we matched the + * entire line. + */ + if (oflag || (Fflag && xflag)) + nmatch = 1; - if (iflag) { - wchar_t *cp; - for (cp = outline; *cp != '\0'; cp++) { - *cp = towlower((wint_t)*cp); + rv = regexec(&pp->re, ptr, nmatch, &rm, 0); + if (rv == REG_OK) { + /* + * fgrep in this form cannot insert the + * metacharacters to verify whether or not we + * were the entire line. As a result, we check + * the pattern length against the line length. + */ + if (Fflag && xflag && + line_len != rm.rm_eo - rm.rm_so) { + continue; } - } - if (xflag) { - for (pp = patterns; pp; pp = pp->next) { - if (outline[0] == pp->wpattern[0] && - wcscmp(outline, - pp->wpattern) == 0) { - /* matched */ - break; - } - } - } else { - for (pp = patterns; pp; pp = pp->next) { - if (wcswcs(outline, pp->wpattern) - != NULL) { - /* matched */ - break; - } + /* matched */ + if (oflag) { + startmatch = ptr + rm.rm_so; + postmatch = ptr + rm.rm_eo; } + break; } - } else if (Fflag) { - /* fgrep in byte-oriented handling */ - char *fptr; - if (iflag) { - fptr = istrdup(ptr); - } else { - fptr = ptr; - } - if (xflag) { - /* fgrep -x */ - for (pp = patterns; pp; pp = pp->next) { - if (fptr[0] == pp->pattern[0] && - strcmp(fptr, pp->pattern) == 0) { - /* matched */ - break; - } - } - } else { - for (pp = patterns; pp; pp = pp->next) { - if (strstr(fptr, pp->pattern) != NULL) { - /* matched */ - break; - } - } - } - } else { - /* grep or egrep */ - for (pp = patterns; pp; pp = pp->next) { - int rv; - - rv = regexec(&pp->re, ptr, 0, NULL, 0); - if (rv == REG_OK) { - /* matched */ - break; - } - switch (rv) { - case REG_NOMATCH: - break; - case REG_ECHAR: - (void) fprintf(stderr, gettext( + switch (rv) { + case REG_NOMATCH: + break; + case REG_ECHAR: + (void) fprintf(stderr, gettext( "%s: input file \"%s\": line %lld: invalid multibyte character\n"), - cmdname, fn, lineno); - break; - default: - (void) regerror(rv, &pp->re, errstr, - sizeof (errstr)); - (void) fprintf(stderr, gettext( + cmdname, fn, lineno); + break; + default: + (void) regerror(rv, &pp->re, errstr, + sizeof (errstr)); + (void) fprintf(stderr, gettext( "%s: input file \"%s\": line %lld: %s\n"), - cmdname, fn, lineno, errstr); - exit(2); - } + cmdname, fn, lineno, errstr); + exit(2); } } @@ -1368,8 +1351,21 @@ L_next_line: */ if (!last_ctx && nvflag == (pp != NULL)) { matches++; - if (!nextend) - matchptr = (conflag != 0) ? conptrend : ptrend; + if (!nextend) { + if (conflag != 0) { + matchptr = conptrend; + } else if (oflag) { + matchptr = postmatch - 1; + } else { + matchptr = ptrend; + } + } + } + + if (pp != NULL && oflag && postmatch == NULL) { + (void) fprintf(stderr, gettext("%s: internal error, " + "-o set, but failed to find postmatch\n"), cmdname); + abort(); } /* @@ -1396,10 +1392,17 @@ L_next_line: (void) fwrite("--\n", 1, 3, stdout); } else if (conflag == 0 && nvflag == (pp != NULL)) { *ptrend = '\n'; + if (oflag) { + prntptr = startmatch; + } else { + prntptr = ptr; + } prntlen = line_len + 1; - prntptr = ptr; linenum = lineno; blkoffset = line_offset; + if (oflag) { + blkoffset += startmatch - ptr; + } } else if (eof) { /* No match and no more data */ goto out; @@ -1408,10 +1411,13 @@ L_next_line: goto L_skip_line; } - prntptrend = prntptr - 1; - while ((prntptrend = find_nl(prntptrend + 1, + if (oflag) { + prntptrend = postmatch - 1; + } else { + prntptrend = prntptr - 1; + } + while (oflag || (prntptrend = find_nl(prntptrend + 1, prntlen)) != NULL) { - /* * GNU grep uses '-' for context lines and ':' for * matching lines, so replicate that here. @@ -1446,6 +1452,9 @@ L_next_line: (void) printf("%s\n", fn); goto out; } + if (Lflag) { + goto out; + } if (!cflag) { if (Hflag || outfn) { (void) printf("%s%c", fn, separate); @@ -1460,10 +1469,23 @@ L_next_line: } (void) fwrite(prntptr, 1, prntptrend - prntptr + 1, stdout); + + if (oflag) { + (void) fputc('\n', stdout); + } } if (ferror(stdout)) { return (0); } + + /* + * With -o we'll only ever take this loop once. Manually + * break out. + */ + if (oflag) { + goto L_skip_line; + } + linenum++; prntlen -= prntptrend - prntptr + 1; blkoffset += prntptrend - prntptr + 1; @@ -1504,9 +1526,15 @@ L_skip_line: if (!newlinep) break; + if (oflag && postmatch != NULL) { + line_len = postmatch - 1 - ptr; + ptr = postmatch; + sameline = B_TRUE; + } else { + ptr = ptrend + 1; + } data_len -= line_len + 1; line_offset += line_len + 1; - ptr = ptrend + 1; } out: @@ -1518,6 +1546,20 @@ out: (void) printf("%lld\n", matches); } } + + /* + * -L tells us to print the filename only when it doesn't match. So we + * run through the normal operationa and then invert it. + */ + if (Lflag) { + if (matches == 0) { + (void) printf("%s\n", fn); + matches = 1; + } else { + matches = 0; + } + } + return (matches != 0); } @@ -1530,9 +1572,9 @@ usage(void) (void) fprintf(stderr, gettext("usage: %5s"), cmdname); if (!egrep && !fgrep) (void) fprintf(stderr, gettext(" [-E|-F]")); - (void) fprintf(stderr, gettext(" [-bchHilnqrRsvx] [-A num] [-B num] " - "[-C num|-num]\n [-e pattern_list]... " - "[-f pattern_file]... [pattern_list] [file]...\n")); + (void) fprintf(stderr, gettext(" [-bchHilLnoqrRsvx] [-A num] [-B num] " + "[-C num|-num]\n [--label=name] [-e pattern_list]... " + "[-f pattern_file]...\n [pattern_list] [file]...\n")); exit(2); /* NOTREACHED */ } diff --git a/usr/src/cmd/idmap/idmapd/krb5_lookup.c b/usr/src/cmd/idmap/idmapd/krb5_lookup.c index a45fc5d8f3..bdd0d56759 100644 --- a/usr/src/cmd/idmap/idmapd/krb5_lookup.c +++ b/usr/src/cmd/idmap/idmapd/krb5_lookup.c @@ -10,7 +10,7 @@ */ /* - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2020 Nexenta by DDN, Inc. All rights reserved. */ #include <stdio.h> @@ -27,6 +27,8 @@ #include <synch.h> #include <thread.h> +#include <ads/dsgetdc.h> + #include "idmapd.h" #include "libadutils.h" #include "locate_plugin.h" @@ -102,6 +104,12 @@ _krb5_override_service_locator( goto out; } + if ((ds->flags & DS_KDC_FLAG) == 0) { + idmapdlog(LOG_WARNING, "Domain Controller is not a KDC: " + "Kerberos auth may be slow"); + goto out; + } + switch (family) { case AF_UNSPEC: break; /* OK */ diff --git a/usr/src/cmd/idmap/idmapd/mapfile-intf b/usr/src/cmd/idmap/idmapd/mapfile-intf index 1ab5c033d7..d2f8c7cb04 100644 --- a/usr/src/cmd/idmap/idmapd/mapfile-intf +++ b/usr/src/cmd/idmap/idmapd/mapfile-intf @@ -21,6 +21,7 @@ # # Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright 2019 Nexenta by DDN, Inc. All rights reserved. # # @@ -43,4 +44,5 @@ $mapfile_version 2 SYMBOL_SCOPE { global: app_krb5_user_uid; + _krb5_override_service_locator; }; diff --git a/usr/src/cmd/mdb/intel/amd64/Makefile b/usr/src/cmd/mdb/intel/amd64/Makefile index 6ddc6b59d5..39d3574f15 100644 --- a/usr/src/cmd/mdb/intel/amd64/Makefile +++ b/usr/src/cmd/mdb/intel/amd64/Makefile @@ -27,7 +27,7 @@ include ../../Makefile.common MODULES = $(COMMON_MODULES_PROC) $(COMMON_MODULES_KVM) -MODULES += disk_label uhci +MODULES += disk_label uhci libsmbios SUBDIRS = mdb mdb_ks kmdb libstandctf libstand .WAIT $(MODULES) diff --git a/usr/src/cmd/mdb/intel/amd64/libsmbios/Makefile b/usr/src/cmd/mdb/intel/amd64/libsmbios/Makefile new file mode 100644 index 0000000000..a04ca7df17 --- /dev/null +++ b/usr/src/cmd/mdb/intel/amd64/libsmbios/Makefile @@ -0,0 +1,27 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2020 Oxide Computer Company +# + +MODULE = libsmbios.so +MDBTGT = proc + +MODSRCS = smbios.c + +include ../../../../Makefile.cmd +include ../../../../Makefile.cmd.64 +include ../../Makefile.amd64 +include ../../../Makefile.module + +MODSRCS_DIR = ../../modules/smbios +LDLIBS += -lsmbios diff --git a/usr/src/cmd/mdb/intel/ia32/Makefile b/usr/src/cmd/mdb/intel/ia32/Makefile index cb544a52d2..9d8f9efe87 100644 --- a/usr/src/cmd/mdb/intel/ia32/Makefile +++ b/usr/src/cmd/mdb/intel/ia32/Makefile @@ -28,7 +28,7 @@ include ../../Makefile.common MODULES = $(COMMON_MODULES_PROC) $(COMMON_MODULES_PROC_32BIT) -MODULES += disk_label +MODULES += disk_label libsmbios SUBDIRS = mdb .WAIT $(MODULES) diff --git a/usr/src/cmd/mdb/intel/ia32/libsmbios/Makefile b/usr/src/cmd/mdb/intel/ia32/libsmbios/Makefile new file mode 100644 index 0000000000..14491786c2 --- /dev/null +++ b/usr/src/cmd/mdb/intel/ia32/libsmbios/Makefile @@ -0,0 +1,26 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2020 Oxide Computer Company +# + +MODULE = libsmbios.so +MDBTGT = proc + +MODSRCS = smbios.c + +include ../../../../Makefile.cmd +include ../../Makefile.ia32 +include ../../../Makefile.module + +MODSRCS_DIR = ../../modules/smbios +LDLIBS += -lsmbios diff --git a/usr/src/cmd/mdb/intel/modules/smbios/smbios.c b/usr/src/cmd/mdb/intel/modules/smbios/smbios.c index 429a5fba0e..1b692d45b1 100644 --- a/usr/src/cmd/mdb/intel/modules/smbios/smbios.c +++ b/usr/src/cmd/mdb/intel/modules/smbios/smbios.c @@ -28,7 +28,7 @@ * _KERNEL. Therefore we have to manually declare an extern delaration for * strerror(). */ -extern const char *strerror(int); +extern char *strerror(int); /* * Take an existing smbios_hdl_t from a dump and slurp out its memory so we can diff --git a/usr/src/cmd/nsadmin/system b/usr/src/cmd/nsadmin/system index 6216e0789b..8ab13b7d3f 100644 --- a/usr/src/cmd/nsadmin/system +++ b/usr/src/cmd/nsadmin/system @@ -138,12 +138,6 @@ set dump_plat_mincpu=0 set dump_bzip2_level=1 * -* See OS-1361 for dealing with the timer woes. -* -set pcplusmp:apic_timer_preferred_mode=0 -set apix:apic_timer_preferred_mode=0 - -* * Want additional crash dump metrics * set dump_metrics_on=1 diff --git a/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c b/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c index 1bb24230cd..82f7262de7 100644 --- a/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c +++ b/usr/src/cmd/picl/plugins/sun4u/lib/fruaccess/fru_access.c @@ -639,9 +639,9 @@ get_container_info(const char *def_file, const char *cont_desc_str, token = tokenizer(buf, "#", &field, &matched); /* find the names */ token = tokenizer(buf, ":", &field, &matched); - if (token != 0x00) { + if (token != NULL) { token = tokenizer(token, "|", &item, &matched); - while (token != 0x00) { + while (token != NULL) { if (strcmp(token, cont_desc_str) == 0) { foundIt = 1; goto found; @@ -649,7 +649,7 @@ get_container_info(const char *def_file, const char *cont_desc_str, token = tokenizer(item, "|", &item, &matched); } /* check the last remaining item */ - if ((item != 0x00) && + if ((item != NULL) && (strcmp(item, cont_desc_str) == 0)) { foundIt = 1; goto found; @@ -660,16 +660,16 @@ get_container_info(const char *def_file, const char *cont_desc_str, found : if (foundIt == 1) { token = tokenizer(field, ":", &field, &matched); - if (token == 0x00) { + if (token == NULL) { (void) fclose(file); return (-1); } cont_info->header_ver = (headerrev_t)atoi(token); token = tokenizer(field, ":\n", &field, &matched); - while (token != 0x00) { + while (token != NULL) { token = tokenizer(token, ",", &item, &matched); - if (token == 0x00) { + if (token == NULL) { (void) fclose(file); return (-1); } @@ -696,7 +696,7 @@ found : } token = tokenizer(item, ",", &item, &matched); - if (token == 0x00) { + if (token == NULL) { (void) fclose(file); return (-1); } @@ -708,12 +708,12 @@ found : * data interpreter */ token = tokenizer(item, ",", &item, &matched); - if (token == 0x00) { + if (token == NULL) { (void) fclose(file); return (-1); } } - if (item == '\0') { + if (*item == '\0') { (void) fclose(file); return (-1); } diff --git a/usr/src/cmd/pools/poold/Makefile b/usr/src/cmd/pools/poold/Makefile index 757f882219..9dfb547196 100644 --- a/usr/src/cmd/pools/poold/Makefile +++ b/usr/src/cmd/pools/poold/Makefile @@ -23,6 +23,8 @@ # Use is subject to license terms. # # Copyright (c) 2018, Joyent, Inc. +# Copyright 2020 Peter Tribble +# PROG = poold OBJS = poold.o @@ -32,7 +34,7 @@ MANIFEST= poold.xml SVCMETHOD= svc-poold include $(SRC)/cmd/Makefile.cmd -$(BLD_JAVA_8)include $(SRC)/cmd/Makefile.cmd.64 +include $(SRC)/cmd/Makefile.cmd.64 JAVA_SUBDIRS = com/sun/solaris/service/exception \ com/sun/solaris/service/kstat \ @@ -53,18 +55,16 @@ all := TARGET = all install := TARGET = install clean := TARGET = clean clobber := TARGET = clobber -lint := TARGET = lint msg := TARGET = msg $(ROOTMANIFEST):= FILEMODE= 444 JARFILE = JPool.jar -JAVA_LIB_PATH = $(JAVA_ROOT)/jre/lib/$(MACH)/client -LIBPOOL_PATH = $(ROOTLIB) -$(BLD_JAVA_8)JAVA_LIB_PATH = $(JAVA_ROOT)/jre/lib/$(MACH64)/server -$(BLD_JAVA_8)LIBPOOL_PATH = $(ROOTLIB64) +JAVA_LIB_PATH = $(JAVA_ROOT)/jre/lib/$(MACH64)/server +$(BLD_JAVA_11)JAVA_LIB_PATH = $(JAVA_ROOT)/lib/server +LIBPOOL_PATH = $(ROOTLIB64) -# JAVA_SUBDIRS and PACKAGEDOCS must be synchronized to ensure +# JAVA_SUBDIRS and PACKAGEDOCS must be synchronized to ensure # javadoc documentation is generated for all packages. PACKAGEDOCS = com.sun.solaris.service.exception \ @@ -83,10 +83,6 @@ LDLIBS += -lpool -L$(JAVA_LIB_PATH) -ljvm # runpath should point to runtime JAVA_HOME LDFLAGS += -R$(JAVA_LIB_PATH) -LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2 -$(BLD_JAVA_8)LINTFLAGS64 += -erroff=E_NAME_USED_NOT_DEF2 -LINTLIBS += -L$(LIBPOOL_PATH) -lpool - # not linted SMATCH=off @@ -120,8 +116,6 @@ clobber : $(JAVA_SUBDIRS) $(SUBDIRS) clobber_local clobber_local: clean_local $(RM) $(CLOBBERFILES) -lint: $(SUBDIRS) - msg: $(POFILES) install: $(ROOTCMD) $(JAVA_SUBDIRS) $(JARFILE) \ @@ -147,7 +141,7 @@ $(SUBDIRS): FRC doc: all $(JAVADOC) -private -classpath $(JARFILE): -sourcepath . \ - -source 1.4 -d $(DOCDIR) $(PACKAGEDOCS) + -source 7 -d $(DOCDIR) $(PACKAGEDOCS) $(PROG): $(OBJS) $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS) @@ -158,7 +152,4 @@ $(ROOTUSRLIBDRP)/%: % FRC: -lint: - $(LINT.c) $(PROG).c $(LINTLIBS) - include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/pools/poold/libjkstat/Makefile b/usr/src/cmd/pools/poold/libjkstat/Makefile index 810de1da26..117d8f73e7 100644 --- a/usr/src/cmd/pools/poold/libjkstat/Makefile +++ b/usr/src/cmd/pools/poold/libjkstat/Makefile @@ -22,34 +22,22 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2020 Peter Tribble +# include $(SRC)/lib/Makefile.lib -SUBDIRS = $(MACH) -$(BLD_JAVA_8)SUBDIRS = $(MACH64) +SUBDIRS = $(MACH64) all := TARGET = all clean := TARGET = clean clobber := TARGET = clobber install := TARGET = install -lint := TARGET = lint - -JNI_CLASSES = \ - com.sun.solaris.service.kstat.Kstat \ - com.sun.solaris.service.kstat.KstatCtl - -JNI_GENERATED_HEADERS = \ - jkstat.h -CLEANFILES += $(JNI_GENERATED_HEADERS) - -all install lint: $(JNI_GENERATED_HEADERS) .WAIT $(SUBDIRS) +all install: $(SUBDIRS) clean clobber: $(SUBDIRS) -$(JNI_GENERATED_HEADERS): $(SRC)/cmd/pools/poold/JPool.jar - $(JAVAH) -classpath $? -o $@ $(JNI_CLASSES) - $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) diff --git a/usr/src/cmd/pools/poold/libjkstat/i386/Makefile b/usr/src/cmd/pools/poold/libjkstat/i386/Makefile deleted file mode 100644 index 35ac6d4219..0000000000 --- a/usr/src/cmd/pools/poold/libjkstat/i386/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include ../Makefile.com - -install: all $(ROOTLIBS) $(ROOTLINKS) diff --git a/usr/src/cmd/pools/poold/libjkstat/jkstat.h b/usr/src/cmd/pools/poold/libjkstat/jkstat.h new file mode 100644 index 0000000000..c42acee6a1 --- /dev/null +++ b/usr/src/cmd/pools/poold/libjkstat/jkstat.h @@ -0,0 +1,96 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class com_sun_solaris_service_kstat_Kstat */ + +#ifndef _Included_com_sun_solaris_service_kstat_Kstat +#define _Included_com_sun_solaris_service_kstat_Kstat +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sun_solaris_service_kstat_Kstat + * Method: getSnapTime + * Signature: ()Lcom/sun/solaris/service/pools/HRTime; + */ +JNIEXPORT jobject JNICALL Java_com_sun_solaris_service_kstat_Kstat_getSnapTime + (JNIEnv *, jobject); + +/* + * Class: com_sun_solaris_service_kstat_Kstat + * Method: getCreationTime + * Signature: ()Lcom/sun/solaris/service/pools/HRTime; + */ +JNIEXPORT jobject JNICALL Java_com_sun_solaris_service_kstat_Kstat_getCreationTime + (JNIEnv *, jobject); + +/* + * Class: com_sun_solaris_service_kstat_Kstat + * Method: getValue + * Signature: (Ljava/lang/String;)Ljava/lang/Object; + */ +JNIEXPORT jobject JNICALL Java_com_sun_solaris_service_kstat_Kstat_getValue + (JNIEnv *, jobject, jstring); + +/* + * Class: com_sun_solaris_service_kstat_Kstat + * Method: read + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_kstat_Kstat_read + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class com_sun_solaris_service_kstat_KstatCtl */ + +#ifndef _Included_com_sun_solaris_service_kstat_KstatCtl +#define _Included_com_sun_solaris_service_kstat_KstatCtl +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sun_solaris_service_kstat_KstatCtl + * Method: open + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_kstat_KstatCtl_open + (JNIEnv *, jobject); + +/* + * Class: com_sun_solaris_service_kstat_KstatCtl + * Method: close + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_kstat_KstatCtl_close + (JNIEnv *, jobject, jlong); + +/* + * Class: com_sun_solaris_service_kstat_KstatCtl + * Method: lookup + * Signature: (Ljava/lang/String;ILjava/lang/String;)Lcom/sun/solaris/service/kstat/Kstat; + */ +JNIEXPORT jobject JNICALL Java_com_sun_solaris_service_kstat_KstatCtl_lookup + (JNIEnv *, jobject, jstring, jint, jstring); + +/* + * Class: com_sun_solaris_service_kstat_KstatCtl + * Method: chainUpdate + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_kstat_KstatCtl_chainUpdate + (JNIEnv *, jobject); + +/* + * Class: com_sun_solaris_service_kstat_KstatCtl + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_kstat_KstatCtl_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/usr/src/cmd/pools/poold/libjkstat/sparc/Makefile b/usr/src/cmd/pools/poold/libjkstat/sparc/Makefile deleted file mode 100644 index 35ac6d4219..0000000000 --- a/usr/src/cmd/pools/poold/libjkstat/sparc/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include ../Makefile.com - -install: all $(ROOTLIBS) $(ROOTLINKS) diff --git a/usr/src/cmd/pools/poold/libjlgrp/Makefile b/usr/src/cmd/pools/poold/libjlgrp/Makefile index e8481498b8..117d8f73e7 100644 --- a/usr/src/cmd/pools/poold/libjlgrp/Makefile +++ b/usr/src/cmd/pools/poold/libjlgrp/Makefile @@ -22,34 +22,22 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2020 Peter Tribble +# include $(SRC)/lib/Makefile.lib -SUBDIRS = $(MACH) -$(BLD_JAVA_8)SUBDIRS = $(MACH64) +SUBDIRS = $(MACH64) all := TARGET = all clean := TARGET = clean clobber := TARGET = clobber install := TARGET = install -lint := TARGET = lint - -JNI_CLASSES = \ - com.sun.solaris.service.locality.LocalityDomain \ - com.sun.solaris.service.locality.LocalityGroup - -JNI_GENERATED_HEADERS = \ - jlgrp.h -CLEANFILES += $(JNI_GENERATED_HEADERS) - -all install lint: $(JNI_GENERATED_HEADERS) .WAIT $(SUBDIRS) +all install: $(SUBDIRS) clean clobber: $(SUBDIRS) -$(JNI_GENERATED_HEADERS): $(SRC)/cmd/pools/poold/JPool.jar - $(JAVAH) -classpath $? -o $@ $(JNI_CLASSES) - $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) diff --git a/usr/src/cmd/pools/poold/libjlgrp/i386/Makefile b/usr/src/cmd/pools/poold/libjlgrp/i386/Makefile deleted file mode 100644 index 35ac6d4219..0000000000 --- a/usr/src/cmd/pools/poold/libjlgrp/i386/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include ../Makefile.com - -install: all $(ROOTLIBS) $(ROOTLINKS) diff --git a/usr/src/cmd/pools/poold/libjlgrp/jlgrp.h b/usr/src/cmd/pools/poold/libjlgrp/jlgrp.h new file mode 100644 index 0000000000..a1cdb6846f --- /dev/null +++ b/usr/src/cmd/pools/poold/libjlgrp/jlgrp.h @@ -0,0 +1,76 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class com_sun_solaris_service_locality_LocalityDomain */ + +#ifndef _Included_com_sun_solaris_service_locality_LocalityDomain +#define _Included_com_sun_solaris_service_locality_LocalityDomain +#ifdef __cplusplus +extern "C" { +#endif +#undef com_sun_solaris_service_locality_LocalityDomain_LGRP_VIEW_CALLER +#define com_sun_solaris_service_locality_LocalityDomain_LGRP_VIEW_CALLER 0L +#undef com_sun_solaris_service_locality_LocalityDomain_LGRP_VIEW_OS +#define com_sun_solaris_service_locality_LocalityDomain_LGRP_VIEW_OS 1L +/* + * Class: com_sun_solaris_service_locality_LocalityDomain + * Method: jl_init + * Signature: (I)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_locality_LocalityDomain_jl_1init + (JNIEnv *, jobject, jint); + +/* + * Class: com_sun_solaris_service_locality_LocalityDomain + * Method: jl_fini + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_locality_LocalityDomain_jl_1fini + (JNIEnv *, jobject); + +/* + * Class: com_sun_solaris_service_locality_LocalityDomain + * Method: jl_root + * Signature: ()Lcom/sun/solaris/service/locality/LocalityGroup; + */ +JNIEXPORT jobject JNICALL Java_com_sun_solaris_service_locality_LocalityDomain_jl_1root + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class com_sun_solaris_service_locality_LocalityGroup */ + +#ifndef _Included_com_sun_solaris_service_locality_LocalityGroup +#define _Included_com_sun_solaris_service_locality_LocalityGroup +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sun_solaris_service_locality_LocalityGroup + * Method: jl_children + * Signature: ()[J + */ +JNIEXPORT jlongArray JNICALL Java_com_sun_solaris_service_locality_LocalityGroup_jl_1children + (JNIEnv *, jobject); + +/* + * Class: com_sun_solaris_service_locality_LocalityGroup + * Method: jl_cpus + * Signature: ()[I + */ +JNIEXPORT jintArray JNICALL Java_com_sun_solaris_service_locality_LocalityGroup_jl_1cpus + (JNIEnv *, jobject); + +/* + * Class: com_sun_solaris_service_locality_LocalityGroup + * Method: jl_latency + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_locality_LocalityGroup_jl_1latency + (JNIEnv *, jobject, jlong, jlong); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/usr/src/cmd/pools/poold/libjlgrp/sparc/Makefile b/usr/src/cmd/pools/poold/libjlgrp/sparc/Makefile deleted file mode 100644 index 35ac6d4219..0000000000 --- a/usr/src/cmd/pools/poold/libjlgrp/sparc/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include ../Makefile.com - -install: all $(ROOTLIBS) $(ROOTLINKS) diff --git a/usr/src/cmd/pools/poold/libjpool/Makefile b/usr/src/cmd/pools/poold/libjpool/Makefile index 1a1b192654..117d8f73e7 100644 --- a/usr/src/cmd/pools/poold/libjpool/Makefile +++ b/usr/src/cmd/pools/poold/libjpool/Makefile @@ -22,36 +22,22 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2020 Peter Tribble +# include $(SRC)/lib/Makefile.lib -SUBDIRS = $(MACH) -$(BLD_JAVA_8)SUBDIRS = $(MACH64) +SUBDIRS = $(MACH64) all := TARGET = all clean := TARGET = clean clobber := TARGET = clobber install := TARGET = install -lint := TARGET = lint - -JNI_CLASSES = \ - com.sun.solaris.service.pools.PoolInternal \ - com.sun.solaris.service.pools.Element \ - com.sun.solaris.service.pools.Value \ - com.sun.solaris.service.pools.HRTime - -JNI_GENERATED_HEADERS = \ - jpool.h -CLEANFILES += $(JNI_GENERATED_HEADERS) - -all install lint: $(JNI_GENERATED_HEADERS) .WAIT $(SUBDIRS) +all install: $(SUBDIRS) clean clobber: $(SUBDIRS) -$(JNI_GENERATED_HEADERS): $(SRC)/cmd/pools/poold/JPool.jar - $(JAVAH) -classpath $? -o $@ $(JNI_CLASSES) - $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) diff --git a/usr/src/cmd/pools/poold/libjpool/i386/Makefile b/usr/src/cmd/pools/poold/libjpool/i386/Makefile deleted file mode 100644 index 35ac6d4219..0000000000 --- a/usr/src/cmd/pools/poold/libjpool/i386/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include ../Makefile.com - -install: all $(ROOTLIBS) $(ROOTLINKS) diff --git a/usr/src/cmd/pools/poold/libjpool/jpool.h b/usr/src/cmd/pools/poold/libjpool/jpool.h new file mode 100644 index 0000000000..42e3ce4e9d --- /dev/null +++ b/usr/src/cmd/pools/poold/libjpool/jpool.h @@ -0,0 +1,840 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class com_sun_solaris_service_pools_PoolInternal */ + +#ifndef _Included_com_sun_solaris_service_pools_PoolInternal +#define _Included_com_sun_solaris_service_pools_PoolInternal +#ifdef __cplusplus +extern "C" { +#endif +#undef com_sun_solaris_service_pools_PoolInternal_POOL_VER_CURRENT +#define com_sun_solaris_service_pools_PoolInternal_POOL_VER_CURRENT 1L +#undef com_sun_solaris_service_pools_PoolInternal_POOL_VER_NONE +#define com_sun_solaris_service_pools_PoolInternal_POOL_VER_NONE 0L +#undef com_sun_solaris_service_pools_PoolInternal_PO_TRUE +#define com_sun_solaris_service_pools_PoolInternal_PO_TRUE 1L +#undef com_sun_solaris_service_pools_PoolInternal_PO_FALSE +#define com_sun_solaris_service_pools_PoolInternal_PO_FALSE 0L +#undef com_sun_solaris_service_pools_PoolInternal_PO_SUCCESS +#define com_sun_solaris_service_pools_PoolInternal_PO_SUCCESS 0L +#undef com_sun_solaris_service_pools_PoolInternal_PO_FAIL +#define com_sun_solaris_service_pools_PoolInternal_PO_FAIL -1L +#undef com_sun_solaris_service_pools_PoolInternal_POE_OK +#define com_sun_solaris_service_pools_PoolInternal_POE_OK 0L +#undef com_sun_solaris_service_pools_PoolInternal_POE_BAD_PROP_TYPE +#define com_sun_solaris_service_pools_PoolInternal_POE_BAD_PROP_TYPE 1L +#undef com_sun_solaris_service_pools_PoolInternal_POE_INVALID_CONF +#define com_sun_solaris_service_pools_PoolInternal_POE_INVALID_CONF 2L +#undef com_sun_solaris_service_pools_PoolInternal_POE_NOTSUP +#define com_sun_solaris_service_pools_PoolInternal_POE_NOTSUP 3L +#undef com_sun_solaris_service_pools_PoolInternal_POE_INVALID_SEARCH +#define com_sun_solaris_service_pools_PoolInternal_POE_INVALID_SEARCH 4L +#undef com_sun_solaris_service_pools_PoolInternal_POE_BADPARAM +#define com_sun_solaris_service_pools_PoolInternal_POE_BADPARAM 5L +#undef com_sun_solaris_service_pools_PoolInternal_POE_PUTPROP +#define com_sun_solaris_service_pools_PoolInternal_POE_PUTPROP 6L +#undef com_sun_solaris_service_pools_PoolInternal_POE_DATASTORE +#define com_sun_solaris_service_pools_PoolInternal_POE_DATASTORE 7L +#undef com_sun_solaris_service_pools_PoolInternal_POE_SYSTEM +#define com_sun_solaris_service_pools_PoolInternal_POE_SYSTEM 8L +#undef com_sun_solaris_service_pools_PoolInternal_POE_ACCESS +#define com_sun_solaris_service_pools_PoolInternal_POE_ACCESS 9L +#undef com_sun_solaris_service_pools_PoolInternal_PO_RDONLY +#define com_sun_solaris_service_pools_PoolInternal_PO_RDONLY 0L +#undef com_sun_solaris_service_pools_PoolInternal_PO_RDWR +#define com_sun_solaris_service_pools_PoolInternal_PO_RDWR 1L +#undef com_sun_solaris_service_pools_PoolInternal_PO_CREAT +#define com_sun_solaris_service_pools_PoolInternal_PO_CREAT 2L +#undef com_sun_solaris_service_pools_PoolInternal_PO_DISCO +#define com_sun_solaris_service_pools_PoolInternal_PO_DISCO 4L +#undef com_sun_solaris_service_pools_PoolInternal_PO_UPDATE +#define com_sun_solaris_service_pools_PoolInternal_PO_UPDATE 8L +#undef com_sun_solaris_service_pools_PoolInternal_POU_SYSTEM +#define com_sun_solaris_service_pools_PoolInternal_POU_SYSTEM 1L +#undef com_sun_solaris_service_pools_PoolInternal_POU_POOL +#define com_sun_solaris_service_pools_PoolInternal_POU_POOL 2L +#undef com_sun_solaris_service_pools_PoolInternal_POU_PSET +#define com_sun_solaris_service_pools_PoolInternal_POU_PSET 4L +#undef com_sun_solaris_service_pools_PoolInternal_POU_CPU +#define com_sun_solaris_service_pools_PoolInternal_POU_CPU 8L +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_pools_PoolInternal_init + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_version + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1version + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POX_NATIVE + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POX_1NATIVE + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POX_TEXT + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POX_1TEXT + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POC_INVAL + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POC_1INVAL + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POC_UINT + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POC_1UINT + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POC_INT + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POC_1INT + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POC_DOUBLE + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POC_1DOUBLE + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POC_BOOL + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POC_1BOOL + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POC_STRING + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POC_1STRING + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POV_NONE + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POV_1NONE + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POV_LOOSE + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POV_1LOOSE + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POV_STRICT + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POV_1STRICT + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POV_RUNTIME + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POV_1RUNTIME + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POF_INVALID + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POF_1INVALID + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POF_VALID + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POF_1VALID + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: get_POF_DESTROY + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_get_1POF_1DESTROY + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_error + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1error + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_strerror + * Signature: (I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1strerror + (JNIEnv *, jclass, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_strerror_sys + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1strerror_1sys + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_resource_type_list + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1resource_1type_1list + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_get_status + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1get_1status + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_set_status + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1set_1status + (JNIEnv *, jclass, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_alloc + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1alloc + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_status + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1status + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_close + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1close + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_remove + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1remove + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_open + * Signature: (JLjava/lang/String;I)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1open + (JNIEnv *, jclass, jlong, jstring, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_rollback + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1rollback + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_commit + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1commit + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_export + * Signature: (JLjava/lang/String;I)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1export + (JNIEnv *, jclass, jlong, jstring, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_validate + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1validate + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_update + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1update + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_get_pool + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1get_1pool + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_query_pools + * Signature: (JLjava/util/List;)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1query_1pools + (JNIEnv *, jclass, jlong, jobject); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_get_resource + * Signature: (JLjava/lang/String;Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1get_1resource + (JNIEnv *, jclass, jlong, jstring, jstring); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_query_resources + * Signature: (JLjava/util/List;)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1query_1resources + (JNIEnv *, jclass, jlong, jobject); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_query_components + * Signature: (JLjava/util/List;)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1query_1components + (JNIEnv *, jclass, jlong, jobject); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_location + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1location + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_info + * Signature: (JI)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1info + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_resource_create + * Signature: (JLjava/lang/String;Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1resource_1create + (JNIEnv *, jclass, jlong, jstring, jstring); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_resource_destroy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1resource_1destroy + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_resource_transfer + * Signature: (JJJJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1resource_1transfer + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_resource_xtransfer + * Signature: (JJJLjava/util/List;)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1resource_1xtransfer + (JNIEnv *, jclass, jlong, jlong, jlong, jobject); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_query_resource_components + * Signature: (JJLjava/util/List;)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1query_1resource_1components + (JNIEnv *, jclass, jlong, jlong, jobject); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_resource_info + * Signature: (JJI)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1resource_1info + (JNIEnv *, jclass, jlong, jlong, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_create + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1create + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_destroy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1destroy + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_associate + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1associate + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_dissociate + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1dissociate + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_info + * Signature: (JJI)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1info + (JNIEnv *, jclass, jlong, jlong, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_query_pool_resources + * Signature: (JJLjava/util/List;)Ljava/util/List; + */ +JNIEXPORT jobject JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1query_1pool_1resources + (JNIEnv *, jclass, jlong, jlong, jobject); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_get_owning_resource + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1get_1owning_1resource + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_component_info + * Signature: (JJI)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1component_1info + (JNIEnv *, jclass, jlong, jlong, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_get_property + * Signature: (JJLjava/lang/String;J)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1get_1property + (JNIEnv *, jclass, jlong, jlong, jstring, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_put_property + * Signature: (JJLjava/lang/String;J)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1put_1property + (JNIEnv *, jclass, jlong, jlong, jstring, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_rm_property + * Signature: (JJLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1rm_1property + (JNIEnv *, jclass, jlong, jlong, jstring); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_walk_properties + * Signature: (JJJJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1walk_1properties + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_conf_to_elem + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1conf_1to_1elem + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_to_elem + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1to_1elem + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_resource_to_elem + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1resource_1to_1elem + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_component_to_elem + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1component_1to_1elem + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_get_uint64 + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1get_1uint64 + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_get_int64 + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1get_1int64 + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_get_double + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1get_1double + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_get_bool + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1get_1bool + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_get_string + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1get_1string + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_get_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1get_1type + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_set_uint64 + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1set_1uint64 + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_set_int64 + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1set_1int64 + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_set_double + * Signature: (JD)V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1set_1double + (JNIEnv *, jclass, jlong, jdouble); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_set_bool + * Signature: (JS)V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1set_1bool + (JNIEnv *, jclass, jlong, jshort); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_set_string + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1set_1string + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_get_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1get_1name + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_set_name + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1set_1name + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_alloc + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1alloc + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_value_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1value_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_static_location + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1static_1location + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_dynamic_location + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1dynamic_1location + (JNIEnv *, jclass); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_set_binding + * Signature: (Ljava/lang/String;II)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1set_1binding + (JNIEnv *, jclass, jstring, jint, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_get_binding + * Signature: (I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1get_1binding + (JNIEnv *, jclass, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_get_resource_binding + * Signature: (Ljava/lang/String;I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1get_1resource_1binding + (JNIEnv *, jclass, jstring, jint); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_walk_pools + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1walk_1pools + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_walk_resources + * Signature: (JJJJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1walk_1resources + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + +/* + * Class: com_sun_solaris_service_pools_PoolInternal + * Method: pool_walk_components + * Signature: (JJJJ)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_PoolInternal_pool_1walk_1components + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class com_sun_solaris_service_pools_Element */ + +#ifndef _Included_com_sun_solaris_service_pools_Element +#define _Included_com_sun_solaris_service_pools_Element +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sun_solaris_service_pools_Element + * Method: walkProps + * Signature: (JJLcom/sun/solaris/service/pools/PropertyWalk;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL Java_com_sun_solaris_service_pools_Element_walkProps + (JNIEnv *, jobject, jlong, jlong, jobject, jobject); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class com_sun_solaris_service_pools_Value */ + +#ifndef _Included_com_sun_solaris_service_pools_Value +#define _Included_com_sun_solaris_service_pools_Value +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sun_solaris_service_pools_Value + * Method: getUnsignedInt64Value + * Signature: (J)Lcom/sun/solaris/service/pools/UnsignedInt64; + */ +JNIEXPORT jobject JNICALL Java_com_sun_solaris_service_pools_Value_getUnsignedInt64Value + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_Value + * Method: getLongValue + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_solaris_service_pools_Value_getLongValue + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_Value + * Method: getStringValue + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_solaris_service_pools_Value_getStringValue + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_Value + * Method: getBoolValue + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_com_sun_solaris_service_pools_Value_getBoolValue + (JNIEnv *, jclass, jlong); + +/* + * Class: com_sun_solaris_service_pools_Value + * Method: getDoubleValue + * Signature: (J)D + */ +JNIEXPORT jdouble JNICALL Java_com_sun_solaris_service_pools_Value_getDoubleValue + (JNIEnv *, jclass, jlong); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class com_sun_solaris_service_pools_HRTime */ + +#ifndef _Included_com_sun_solaris_service_pools_HRTime +#define _Included_com_sun_solaris_service_pools_HRTime +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sun_solaris_service_pools_HRTime + * Method: timestamp + * Signature: ()Lcom/sun/solaris/service/pools/UnsignedInt64; + */ +JNIEXPORT jobject JNICALL Java_com_sun_solaris_service_pools_HRTime_timestamp + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/usr/src/cmd/pools/poold/libjpool/sparc/Makefile b/usr/src/cmd/pools/poold/libjpool/sparc/Makefile deleted file mode 100644 index 35ac6d4219..0000000000 --- a/usr/src/cmd/pools/poold/libjpool/sparc/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include ../Makefile.com - -install: all $(ROOTLIBS) $(ROOTLINKS) diff --git a/usr/src/cmd/pools/poold/libjsyslog/Makefile b/usr/src/cmd/pools/poold/libjsyslog/Makefile index e92960f43a..117d8f73e7 100644 --- a/usr/src/cmd/pools/poold/libjsyslog/Makefile +++ b/usr/src/cmd/pools/poold/libjsyslog/Makefile @@ -22,33 +22,22 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2020 Peter Tribble +# include $(SRC)/lib/Makefile.lib -SUBDIRS = $(MACH) -$(BLD_JAVA_8)SUBDIRS = $(MACH64) +SUBDIRS = $(MACH64) all := TARGET = all clean := TARGET = clean clobber := TARGET = clobber install := TARGET = install -lint := TARGET = lint - -JNI_CLASSES = \ - com.sun.solaris.service.logging.SyslogHandler - -JNI_GENERATED_HEADERS = \ - jsyslog.h -CLEANFILES += $(JNI_GENERATED_HEADERS) - -all install lint: $(JNI_GENERATED_HEADERS) .WAIT $(SUBDIRS) +all install: $(SUBDIRS) clean clobber: $(SUBDIRS) -$(JNI_GENERATED_HEADERS): $(SRC)/cmd/pools/poold/JPool.jar - $(JAVAH) -classpath $? -o $@ $(JNI_CLASSES) - $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) diff --git a/usr/src/cmd/pools/poold/libjsyslog/i386/Makefile b/usr/src/cmd/pools/poold/libjsyslog/i386/Makefile deleted file mode 100644 index 35ac6d4219..0000000000 --- a/usr/src/cmd/pools/poold/libjsyslog/i386/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include ../Makefile.com - -install: all $(ROOTLIBS) $(ROOTLINKS) diff --git a/usr/src/cmd/pools/poold/libjsyslog/jsyslog.h b/usr/src/cmd/pools/poold/libjsyslog/jsyslog.h new file mode 100644 index 0000000000..24e631e351 --- /dev/null +++ b/usr/src/cmd/pools/poold/libjsyslog/jsyslog.h @@ -0,0 +1,39 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class com_sun_solaris_service_logging_SyslogHandler */ + +#ifndef _Included_com_sun_solaris_service_logging_SyslogHandler +#define _Included_com_sun_solaris_service_logging_SyslogHandler +#ifdef __cplusplus +extern "C" { +#endif +#undef com_sun_solaris_service_logging_SyslogHandler_DEF_LOGOPT +#define com_sun_solaris_service_logging_SyslogHandler_DEF_LOGOPT 0L +/* + * Class: com_sun_solaris_service_logging_SyslogHandler + * Method: syslog + * Signature: (ILjava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_logging_SyslogHandler_syslog + (JNIEnv *, jclass, jint, jstring); + +/* + * Class: com_sun_solaris_service_logging_SyslogHandler + * Method: openlog + * Signature: (Ljava/lang/String;II)V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_logging_SyslogHandler_openlog + (JNIEnv *, jclass, jstring, jint, jint); + +/* + * Class: com_sun_solaris_service_logging_SyslogHandler + * Method: closelog + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_sun_solaris_service_logging_SyslogHandler_closelog + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/usr/src/cmd/pools/poold/libjsyslog/sparc/Makefile b/usr/src/cmd/pools/poold/libjsyslog/sparc/Makefile deleted file mode 100644 index 35ac6d4219..0000000000 --- a/usr/src/cmd/pools/poold/libjsyslog/sparc/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -include ../Makefile.com - -install: all $(ROOTLIBS) $(ROOTLINKS) diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Makefile b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Makefile index 67be7d0b27..e3ad77dd61 100644 --- a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Makefile +++ b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/Makefile @@ -23,6 +23,8 @@ # Use is subject to license terms. # # Copyright (c) 2018, Joyent, Inc. +# Copyright 2020 Peter Tribble +# # # Makefile for Java Print Manager server @@ -31,8 +33,6 @@ LIBRARY = libpmgr.a VERS = .1 -JNIHDR_FILES = com_sun_admin_pm_server_DoPrinterNS.h - OBJECTS = DoPrinterNS.o NS.o CLASSFILES = Printer.class \ @@ -59,8 +59,6 @@ CLASSFILES = Printer.class \ pmNSNotConfiguredException.class \ pmMisc.class -JNICLASSFILES = DoPrinterNS.class - include $(SRC)/lib/Makefile.lib SRCDIR = . @@ -93,29 +91,19 @@ SMATCH=off LDLIBS += -lprint -lnsl -lsocket -lc CLEANFILES= *.class -CLOBBERFILES= $(JNIHDR_FILES) $(LIBLINKS) +CLOBBERFILES= $(LIBLINKS) -all: $(CLASSFILES) $(JNIHDR_FILES) $(DYNLIB) +all: $(CLASSFILES) $(DYNLIB) install: all $(ROOTDIRS) $(ROOTLINKS) # -# Build jni header file -# Use $@ instead of the "unreliable" $* -# -$(JNIHDR_FILES): $(JNICLASSFILES) - $(JAVAH) -jni -classpath $(CLASSPATH) \ - `echo $@ | sed 's/.h$$//' | tr _ .` - -# # Build standalone programs for testing # NS: NS.c $(CC) NS.c $(CCGDEBUG) $(ILDOFF) -o NS -DMAIN=1 $(ENVLDLIBS1) $(ENVLIBS2) \ -lprint -lnsl -lsocket -lint: $(JNIHDR_FILES) - cstyle: cstyle $(SRCS) diff --git a/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/com_sun_admin_pm_server_DoPrinterNS.h b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/com_sun_admin_pm_server_DoPrinterNS.h new file mode 100644 index 0000000000..c841395820 --- /dev/null +++ b/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/com_sun_admin_pm_server_DoPrinterNS.h @@ -0,0 +1,53 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class com_sun_admin_pm_server_DoPrinterNS */ + +#ifndef _Included_com_sun_admin_pm_server_DoPrinterNS +#define _Included_com_sun_admin_pm_server_DoPrinterNS +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sun_admin_pm_server_DoPrinterNS + * Method: dorexec + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_com_sun_admin_pm_server_DoPrinterNS_dorexec + (JNIEnv *, jclass, jstring, jstring, jstring, jstring, jstring); + +/* + * Class: com_sun_admin_pm_server_DoPrinterNS + * Method: updateoldyp + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_com_sun_admin_pm_server_DoPrinterNS_updateoldyp + (JNIEnv *, jclass, jstring, jstring, jstring, jstring, jstring, jstring); + +/* + * Class: com_sun_admin_pm_server_DoPrinterNS + * Method: updateldap + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_com_sun_admin_pm_server_DoPrinterNS_updateldap + (JNIEnv *, jclass, jstring, jstring, jstring, jstring, jstring, jstring, jstring, jstring, jstring); + +/* + * Class: com_sun_admin_pm_server_DoPrinterNS + * Method: getstderr + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_admin_pm_server_DoPrinterNS_getstderr + (JNIEnv *, jclass); + +/* + * Class: com_sun_admin_pm_server_DoPrinterNS + * Method: getstdout + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_sun_admin_pm_server_DoPrinterNS_getstdout + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/usr/src/cmd/prtvtoc/Makefile b/usr/src/cmd/prtvtoc/Makefile index 1a64695fa6..adf9f5396a 100644 --- a/usr/src/cmd/prtvtoc/Makefile +++ b/usr/src/cmd/prtvtoc/Makefile @@ -31,11 +31,7 @@ RELUSRSBIN= ../usr/sbin ROOTSYMLINK= $(ROOTETC)/$(PROG) LDLIBS += -ladm -lefi -CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += $(CNOWARN_UNINIT) - -# not linted -SMATCH=off +CSTD = $(CSTD_GNU99) .KEEP_STATE: diff --git a/usr/src/cmd/prtvtoc/prtvtoc.c b/usr/src/cmd/prtvtoc/prtvtoc.c index 531fd244e8..16a1a5a4c3 100644 --- a/usr/src/cmd/prtvtoc/prtvtoc.c +++ b/usr/src/cmd/prtvtoc/prtvtoc.c @@ -18,12 +18,12 @@ * * CDDL HEADER END */ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ -/* Copyright (c) 1984 AT&T */ -/* All Rights Reserved */ +/* Copyright (c) 1984 AT&T */ +/* All Rights Reserved */ /* @@ -42,6 +42,7 @@ #include <string.h> #include <stdio.h> #include <limits.h> +#include <err.h> #include <sys/types.h> #include <sys/stat.h> @@ -56,10 +57,10 @@ * Assumes V_NUMPAR must be a power of 2. * * for V_NUMPAR = 8, we have - * parttn(x)=(x & 0x07) noparttn(x)=(x & 0x3fff8) + * parttn(x)=(x & 0x07) noparttn(x)=(x & 0x3fff8) * * for V_NUMPAR = 16, we have - * parttn(x)=(x & 0x0f) noparttn(x)=(x & 0x3fff0) + * parttn(x)=(x & 0x0f) noparttn(x)=(x & 0x3fff0) */ #define parttn(x) (x % V_NUMPAR) #define noparttn(x) (x & (MAXMIN & ~(V_NUMPAR-1))) @@ -86,8 +87,11 @@ static int readgeom(int, char *, struct dk_geom *); static int readvtoc(int, char *, struct extvtoc *); static int readefi(int, char *, struct dk_gpt **); static void usage(void); -static int warn(char *, char *); -static char *safe_strdup(char *); +static char *safe_strdup(const char *, const char *); +static void *safe_calloc(const char *, size_t, size_t); + +#define SAFE_STRDUP(a) safe_strdup(__func__, (a)) +#define SAFE_CALLOC(a, b) safe_calloc(__func__, (a), (b)) /* * External variables. @@ -101,19 +105,15 @@ static short hflag; /* Omit headers */ static short sflag; /* Omit all but the column header */ static char *fstab = VFSTAB; /* Fstab pathname */ static char *mnttab = MNTTAB; /* mnttab pathname */ -static char *progname; /* Last qualifier of arg0 */ int -main(int ac, char **av) +main(int argc, char *argv[]) { - int idx; + int status = EXIT_SUCCESS; + int c; - if (progname = strrchr(av[0], '/')) - ++progname; - else - progname = av[0]; - while ((idx = getopt(ac, av, "fhst:m:")) != -1) - switch (idx) { + while ((c = getopt(argc, argv, "fhst:m:")) != -1) { + switch (c) { case 'f': ++fflag; break; @@ -132,12 +132,18 @@ main(int ac, char **av) default: usage(); } - if (optind >= ac) + } + + if (optind >= argc) usage(); - idx = 0; - while (optind < ac) - idx |= prtvtoc(av[optind++]); - return (idx == 0 ? 0 : 1); + + for (int i = optind; i < argc; i++) { + if (prtvtoc(argv[i]) != 0) { + status = EXIT_FAILURE; + } + } + + return (status); } static freemap_t *freemap; @@ -147,36 +153,38 @@ static freemap_t *freemap; static freemap_t * findfree(struct dk_geom *geom, struct extvtoc *vtoc) { - struct extpartition *part; - struct extpartition **list; - freemap_t *freeidx; - diskaddr_t fullsize; - ulong_t cylsize; - struct extpartition *sorted[V_NUMPAR + 1]; - - freemap = calloc(sizeof (freemap_t), V_NUMPAR + 1); - cylsize = (geom->dkg_nsect) * (geom->dkg_nhead); - fullsize = (diskaddr_t)(geom->dkg_ncyl) * cylsize; + struct extpartition *part; + struct extpartition **list; + freemap_t *freeidx; + diskaddr_t fullsize; + ulong_t cylsize; + struct extpartition *sorted[V_NUMPAR + 1]; + if (vtoc->v_nparts > V_NUMPAR) { - (void) warn("putfree()", "Too many partitions on disk!"); - exit(1); + errx(EXIT_FAILURE, "putfree(): Too many partitions on disk!"); } + + freemap = SAFE_CALLOC(sizeof (freemap_t), V_NUMPAR + 1); + cylsize = (geom->dkg_nsect) * (geom->dkg_nhead); + fullsize = (diskaddr_t)(geom->dkg_ncyl) * cylsize; list = sorted; - for (part = vtoc->v_part; part < vtoc->v_part + vtoc->v_nparts; ++part) + for (part = vtoc->v_part; part < vtoc->v_part + vtoc->v_nparts; + ++part) { if (part->p_size && part->p_tag != V_BACKUP) *list++ = part; + } *list = 0; - qsort((char *)sorted, (uint_t)(list - sorted), - sizeof (*sorted), partcmp); + qsort(sorted, list - sorted, sizeof (*sorted), partcmp); freeidx = freemap; freeidx->fr_start = 0; - for (list = sorted; (part = *list) != NULL; ++list) - if (part->p_start <= freeidx->fr_start) + for (list = sorted; (part = *list) != NULL; ++list) { + if (part->p_start <= freeidx->fr_start) { freeidx->fr_start += part->p_size; - else { + } else { freeidx->fr_size = part->p_start - freeidx->fr_start; (++freeidx)->fr_start = part->p_start + part->p_size; } + } if (freeidx->fr_start < fullsize) { freeidx->fr_size = fullsize - freeidx->fr_start; ++freeidx; @@ -191,33 +199,33 @@ findfree(struct dk_geom *geom, struct extvtoc *vtoc) static freemap_t * findfree64(struct dk_gpt *efi) { - struct dk_part *part; - struct dk_part **list; - freemap_t *freeidx; - diskaddr_t fullsize; - struct dk_part **sorted; - - freemap = calloc(sizeof (freemap_t), efi->efi_nparts + 1); - sorted = calloc(sizeof (struct dk_part), efi->efi_nparts + 1); + struct dk_part *part; + struct dk_part **list; + freemap_t *freeidx; + diskaddr_t fullsize; + struct dk_part **sorted; + + freemap = SAFE_CALLOC(sizeof (freemap_t), efi->efi_nparts + 1); + sorted = SAFE_CALLOC(sizeof (struct dk_part), efi->efi_nparts + 1); fullsize = efi->efi_last_u_lba; list = sorted; - for (part = efi->efi_parts; - part < efi->efi_parts + efi->efi_nparts; - ++part) + for (part = efi->efi_parts; part < efi->efi_parts + efi->efi_nparts; + ++part) { if (part->p_size && part->p_tag != V_BACKUP) *list++ = part; + } *list = 0; - qsort((char *)sorted, (uint_t)(list - sorted), - sizeof (*sorted), partcmp64); + qsort(sorted, list - sorted, sizeof (*sorted), partcmp64); freeidx = freemap; freeidx->fr_start = efi->efi_first_u_lba; - for (list = sorted; (part = *list) != NULL; ++list) - if (part->p_start == freeidx->fr_start) + for (list = sorted; (part = *list) != NULL; ++list) { + if (part->p_start == freeidx->fr_start) { freeidx->fr_start += part->p_size; - else { + } else { freeidx->fr_size = part->p_start - freeidx->fr_start; (++freeidx)->fr_start = part->p_start + part->p_size; } + } if (freeidx->fr_start < fullsize) { freeidx->fr_size = fullsize - freeidx->fr_start; ++freeidx; @@ -236,7 +244,6 @@ findfree64(struct dk_gpt *efi) static char ** getmntpt(major_t slot, minor_t nopartminor) { - int idx; FILE *file; char devbuf[PATH_MAX], *item; static char *list[V_NUMPAR]; @@ -244,22 +251,22 @@ getmntpt(major_t slot, minor_t nopartminor) struct mnttab mtab; struct vfstab vtab; - for (idx = 0; idx < V_NUMPAR; ++idx) + for (unsigned idx = 0; idx < V_NUMPAR; ++idx) list[idx] = NULL; /* read mnttab for partition mountpoints */ if ((file = fopen(mnttab, "r")) == NULL) { - (void) warn(mnttab, strerror(errno)); + warn("failed to open %s", mnttab); } else { while (getmntent(file, &mtab) == 0) { item = mtab.mnt_special; - if ((item == NULL) || (mtab.mnt_mountp == NULL)) + if (item == NULL || mtab.mnt_mountp == NULL) continue; /* * Is it from /dev? */ - if (strncmp(item, "/dev/", strlen("/dev/") != 0)) + if (strncmp(item, "/dev/", strlen("/dev/")) != 0) continue; /* @@ -268,25 +275,27 @@ getmntpt(major_t slot, minor_t nopartminor) (void) snprintf(devbuf, sizeof (devbuf), "/dev/r%s", item + strlen("/dev/")); - if ((stat(devbuf, &sb) != 0) || - ((sb.st_mode & S_IFMT) != S_IFCHR)) + if (stat(devbuf, &sb) != 0 || + (sb.st_mode & S_IFMT) != S_IFCHR) { continue; + } /* * device must match input slot and nopartminor */ - if ((major(sb.st_rdev) != slot) || - (noparttn(minor(sb.st_rdev)) != nopartminor)) + if (major(sb.st_rdev) != slot || + noparttn(minor(sb.st_rdev)) != nopartminor) { continue; + } list[parttn(minor(sb.st_rdev))] = - safe_strdup(mtab.mnt_mountp); + SAFE_STRDUP(mtab.mnt_mountp); } (void) fclose(file); } if ((file = fopen(fstab, "r")) == NULL) { - (void) warn(fstab, strerror(errno)); + warn("failed to open %s", fstab); return (list); } @@ -296,7 +305,7 @@ getmntpt(major_t slot, minor_t nopartminor) */ while (getvfsent(file, &vtab) == 0) { item = vtab.vfs_special; - if ((item == NULL) || (vtab.vfs_mountp == NULL)) + if (item == NULL || vtab.vfs_mountp == NULL) continue; if (strncmp(item, "/dev/", strlen("/dev/")) != 0) @@ -308,16 +317,18 @@ getmntpt(major_t slot, minor_t nopartminor) (void) snprintf(devbuf, sizeof (devbuf), "/dev/r%s", item + strlen("/dev/")); - if ((stat(devbuf, &sb) != 0) || - ((sb.st_mode & S_IFMT) != S_IFCHR)) + if (stat(devbuf, &sb) != 0 || + (sb.st_mode & S_IFMT) != S_IFCHR) { continue; + } /* * device must match input slot and nopartminor */ - if ((major(sb.st_rdev) != slot) || - (noparttn(minor(sb.st_rdev)) != nopartminor)) + if (major(sb.st_rdev) != slot || + noparttn(minor(sb.st_rdev)) != nopartminor) { continue; + } /* * use mnttab entry if both tables have entries @@ -325,7 +336,7 @@ getmntpt(major_t slot, minor_t nopartminor) if (list[parttn(minor(sb.st_rdev))] != NULL) continue; - list[parttn(minor(sb.st_rdev))] = safe_strdup(vtab.vfs_mountp); + list[parttn(minor(sb.st_rdev))] = SAFE_STRDUP(vtab.vfs_mountp); } (void) fclose(file); @@ -338,22 +349,31 @@ getmntpt(major_t slot, minor_t nopartminor) static int partcmp(const void *one, const void *two) { - return ((*(struct partition **)one)->p_start - - (*(struct partition **)two)->p_start); + struct partition *p1 = *(struct partition **)one; + struct partition *p2 = *(struct partition **)two; + + if (p1->p_start > p2->p_start) { + return (1); + } else if (p1->p_start < p2->p_start) { + return (-1); + } else { + return (0); + } } static int partcmp64(const void *one, const void *two) { - if ((*(struct dk_part **)one)->p_start > - (*(struct dk_part **)two)->p_start) - return (1); - else if ((*(struct dk_part **)one)->p_start < - (*(struct dk_part **)two)->p_start) - return (-1); - else - return (0); + dk_part_t *p1 = *(dk_part_t **)one; + dk_part_t *p2 = *(dk_part_t **)two; + if (p1->p_start > p2->p_start) { + return (1); + } else if (p1->p_start < p2->p_start) { + return (-1); + } else { + return (0); + } } /* @@ -362,37 +382,46 @@ partcmp64(const void *one, const void *two) static int prtvtoc(char *devname) { - int fd; - int idx; - freemap_t *freemap; - struct stat sb; - struct extvtoc vtoc; - int geo; - struct dk_geom geom; - char *name; - int newvtoc = 0; - struct dk_gpt *efi; + int fd; + int idx; + freemap_t *freemap; + struct stat sb; + struct extvtoc vtoc; + int geo; + struct dk_geom geom; + char *name; + int newvtoc = 0; + struct dk_gpt *efi; name = getfullrawname(devname); - if (name == NULL) - return (warn(devname, - "internal administrative call (getfullrawname) failed")); + if (name == NULL) { + warnx("%s: internal administrative call (getfullrawname) " + "failed", devname); + return (-1); + } if (strcmp(name, "") == 0) name = devname; - if ((fd = open(name, O_NONBLOCK|O_RDONLY)) < 0) - return (warn(name, strerror(errno))); - if (fstat(fd, &sb) < 0) - return (warn(name, strerror(errno))); - if ((sb.st_mode & S_IFMT) != S_IFCHR) - return (warn(name, "Not a raw device")); + if ((fd = open(name, O_NONBLOCK|O_RDONLY)) < 0) { + warn("%s: failed to open device", name); + return (-1); + } + if (fstat(fd, &sb) < 0) { + warn("%s: failed to stat device", name); + return (-1); + } + if ((sb.st_mode & S_IFMT) != S_IFCHR) { + warnx("%s: Not a raw device", name); + return (-1); + } geo = (readgeom(fd, name, &geom) == 0); if (geo) { if ((idx = readvtoc(fd, name, &vtoc)) == VT_ENOTSUP) { idx = (readefi(fd, name, &efi) == 0); newvtoc = 1; - } else + } else { idx = (idx == 0); + } } (void) close(fd); if ((!geo) || (!idx)) @@ -407,14 +436,15 @@ prtvtoc(char *devname) else putfree64(efi, freemap); } else { - if (!newvtoc) + if (!newvtoc) { puttable(&geom, &vtoc, freemap, devname, getmntpt(major(sb.st_rdev), noparttn(minor(sb.st_rdev)))); - else + } else { puttable64(efi, freemap, devname, getmntpt(major(sb.st_rdev), noparttn(minor(sb.st_rdev)))); + } } if (newvtoc) efi_free(efi); @@ -468,6 +498,51 @@ putfree64(struct dk_gpt *efi, freemap_t *freemap) (void) printf("\n"); } +static void +print_table_header() +{ + (void) printf("* First Sector" + " Last\n"); + (void) printf("* Partition Tag Flags Sector Count" + " Sector Mount Directory\n"); +} + +static void +print_table_row(uint_t partition, uint_t tag, uint_t flag, + u_longlong_t first_sector, u_longlong_t sector_count, + u_longlong_t last_sector, const char *mount_dir) +{ + (void) printf(" %6u %4u %02x %11llu %11llu %11llu", + partition, tag, flag, first_sector, sector_count, last_sector); + if (mount_dir != NULL) { + (void) printf(" %s", mount_dir); + } + (void) printf("\n"); +} + +static void +print_freemap(freemap_t *freemap) +{ + if (freemap->fr_size == 0) { + /* + * The freemap is completely empty, so do not print the header. + */ + return; + } + + (void) printf("* Unallocated space:\n" + "* First Sector Last\n" + "* Sector Count Sector\n"); + + do { + (void) printf("* %11llu %11llu %11llu\n", + freemap->fr_start, freemap->fr_size, + freemap->fr_size + freemap->fr_start - 1); + } while ((++freemap)->fr_size != 0); + + (void) printf("*\n"); +} + /* * puttable(): Print a human-readable VTOC. */ @@ -475,54 +550,47 @@ static void puttable(struct dk_geom *geom, struct extvtoc *vtoc, freemap_t *freemap, char *name, char **mtab) { - ushort_t idx; - ulong_t cylsize; + ushort_t idx; + ulong_t cylsize; cylsize = (geom->dkg_nsect) * (geom->dkg_nhead); if (!hflag && !sflag) { (void) printf("* %s", name); - if (*vtoc->v_volume) + if (vtoc->v_volume[0] != '\0') (void) printf(" (volume \"%.8s\")", vtoc->v_volume); (void) printf(" partition map\n"); (void) printf("*\n* Dimensions:\n"); - (void) printf("* %7u bytes/sector\n", vtoc->v_sectorsz); - (void) printf("* %7u sectors/track\n", geom->dkg_nsect); - (void) printf("* %7u tracks/cylinder\n", geom->dkg_nhead); - (void) printf("* %7lu sectors/cylinder\n", cylsize); - (void) printf("* %7u cylinders\n", geom->dkg_pcyl); - (void) printf("* %7u accessible cylinders\n", geom->dkg_ncyl); + (void) printf("* %11u bytes/sector\n", vtoc->v_sectorsz); + (void) printf("* %11u sectors/track\n", geom->dkg_nsect); + (void) printf("* %11u tracks/cylinder\n", geom->dkg_nhead); + (void) printf("* %11lu sectors/cylinder\n", cylsize); + (void) printf("* %11u cylinders\n", geom->dkg_pcyl); + (void) printf("* %11u accessible cylinders\n", geom->dkg_ncyl); (void) printf("*\n* Flags:\n"); (void) printf("* 1: unmountable\n"); (void) printf("* 10: read-only\n*\n"); - if (freemap->fr_size) { - (void) printf("* Unallocated space:\n"); - (void) printf("*\tFirst Sector Last\n"); - (void) printf("*\tSector Count Sector \n"); - do { - (void) printf("* %9llu %9llu %9llu\n", - freemap->fr_start, freemap->fr_size, - freemap->fr_size + freemap->fr_start - 1); - } while ((++freemap)->fr_size); - (void) printf("*\n"); - } + print_freemap(freemap); } - if (!hflag) { - (void) printf(\ -"* First Sector Last\n" -"* Partition Tag Flags Sector Count Sector Mount Directory\n"); + + if (!hflag) { + print_table_header(); } + for (idx = 0; idx < vtoc->v_nparts; ++idx) { - if (vtoc->v_part[idx].p_size == 0) + const char *mount_dir = NULL; + struct extpartition *p = &vtoc->v_part[idx]; + + if (p->p_size == 0) continue; - (void) printf(" %2u %5u %02x %9llu %9llu %9llu", - idx, vtoc->v_part[idx].p_tag, vtoc->v_part[idx].p_flag, - vtoc->v_part[idx].p_start, vtoc->v_part[idx].p_size, - vtoc->v_part[idx].p_start + vtoc->v_part[idx].p_size - 1); - if (mtab && mtab[idx]) - (void) printf(" %s", mtab[idx]); - (void) printf("\n"); + + if (mtab != NULL) { + mount_dir = mtab[idx]; + } + + print_table_row(idx, p->p_tag, p->p_flag, p->p_start, + p->p_size, p->p_start + p->p_size - 1, mount_dir); } } @@ -530,55 +598,47 @@ puttable(struct dk_geom *geom, struct extvtoc *vtoc, freemap_t *freemap, * puttable(): Print a human-readable VTOC. */ static void -puttable64(struct dk_gpt *efi, freemap_t *freemap, char *name, - char **mtab) +puttable64(struct dk_gpt *efi, freemap_t *freemap, char *name, char **mtab) { - ushort_t idx; - if (!hflag && !sflag) { (void) printf("* %s", name); - for (idx = 0; idx < efi->efi_nparts; idx++) - if (efi->efi_parts[idx].p_tag == V_RESERVED && - *efi->efi_parts[idx].p_name) - (void) printf(" (volume \"%.8s\")", + for (uint_t idx = 0; idx < efi->efi_nparts; idx++) { + if (efi->efi_parts[idx].p_tag == V_RESERVED && + efi->efi_parts[idx].p_name[0] != '\0') { + (void) printf(" (volume \"%.8s\")", efi->efi_parts[idx].p_name); + } + } (void) printf(" partition map\n"); (void) printf("*\n* Dimensions:\n"); - (void) printf("* %7u bytes/sector\n", efi->efi_lbasize); - (void) printf("* %llu sectors\n", efi->efi_last_lba + 1); - (void) printf("* %llu accessible sectors\n", + (void) printf("* %11u bytes/sector\n", efi->efi_lbasize); + (void) printf("* %11llu sectors\n", efi->efi_last_lba + 1); + (void) printf("* %11llu accessible sectors\n", efi->efi_last_u_lba - efi->efi_first_u_lba + 1); (void) printf("*\n* Flags:\n"); (void) printf("* 1: unmountable\n"); (void) printf("* 10: read-only\n*\n"); - if (freemap->fr_size) { - (void) printf("* Unallocated space:\n"); - (void) printf("*\tFirst Sector Last\n"); - (void) printf("*\tSector Count Sector \n"); - do { - (void) printf("* %9llu %9llu %9llu\n", - freemap->fr_start, freemap->fr_size, - freemap->fr_size + freemap->fr_start - 1); - } while ((++freemap)->fr_size); - (void) printf("*\n"); - } + print_freemap(freemap); } - if (!hflag) { - (void) printf(\ -"* First Sector Last\n" -"* Partition Tag Flags Sector Count Sector Mount Directory\n"); + + if (!hflag) { + print_table_header(); } - for (idx = 0; idx < efi->efi_nparts; ++idx) { - if (efi->efi_parts[idx].p_size == 0) - continue; - (void) printf(" %2u %5u %02x %9llu %9llu %9llu", - idx, efi->efi_parts[idx].p_tag, efi->efi_parts[idx].p_flag, - efi->efi_parts[idx].p_start, efi->efi_parts[idx].p_size, - efi->efi_parts[idx].p_start + efi->efi_parts[idx].p_size - 1); - if ((idx < 7) && mtab && mtab[idx]) - (void) printf(" %s", mtab[idx]); - (void) printf("\n"); + + for (uint_t idx = 0; idx < efi->efi_nparts; ++idx) { + const char *mount_dir = NULL; + dk_part_t *p = &efi->efi_parts[idx]; + + if (p->p_size == 0) + continue; + + if (idx < 7 && mtab != NULL) { + mount_dir = mtab[idx]; + } + + print_table_row(idx, p->p_tag, p->p_flag, p->p_start, + p->p_size, p->p_start + p->p_size - 1, mount_dir); } } @@ -588,16 +648,16 @@ puttable64(struct dk_gpt *efi, freemap_t *freemap, char *name, static int readgeom(int fd, char *name, struct dk_geom *geom) { - char err_string[128]; - - if ((ioctl(fd, DKIOCGGEOM, geom) < 0) && (errno != ENOTSUP)) { - (void) sprintf(err_string, - "Unable to read Disk geometry errno = 0x%x", - errno); - return (warn(name, err_string)); - } else if (errno == ENOTSUP) { + if (ioctl(fd, DKIOCGGEOM, geom) < 0) { + if (errno != ENOTSUP) { + warnx("%s: Unable to read Disk geometry errno = 0x%x", + name, errno); + return (-1); + } + (void) memset(geom, 0, sizeof (struct dk_geom)); } + return (0); } @@ -607,19 +667,23 @@ readgeom(int fd, char *name, struct dk_geom *geom) static int readvtoc(int fd, char *name, struct extvtoc *vtoc) { - int retval; + int retval; if ((retval = read_extvtoc(fd, vtoc)) >= 0) return (0); switch (retval) { - case (VT_EIO): - return (warn(name, "Unable to read VTOC")); - case (VT_EINVAL): - return (warn(name, "Invalid VTOC")); - case (VT_ERROR): - return (warn(name, "Unknown problem reading VTOC")); + case VT_EIO: + warnx("%s: Unable to read VTOC", name); + return (-1); + case VT_EINVAL: + warnx("%s: Invalid VTOC", name); + return (-1); + case VT_ERROR: + warnx("%s: Unknown problem reading VTOC", name); + return (-1); } + return (retval); } @@ -635,25 +699,64 @@ readefi(int fd, char *name, struct dk_gpt **efi) return (0); switch (retval) { - case (VT_EIO): - return (warn(name, "Unable to read VTOC")); - case (VT_EINVAL): - return (warn(name, "Invalid VTOC")); - case (VT_ERROR): - return (warn(name, "Unknown problem reading VTOC")); + case VT_EIO: + warnx("%s: Unable to read VTOC", name); + return (-1); + case VT_EINVAL: + warnx("%s: Invalid VTOC", name); + return (-1); + case VT_ERROR: + warnx("%s: Unknown problem reading VTOC", name); + return (-1); } + return (retval); } +static void +memory_err(size_t l, int e, const char *fname) +{ + const char *reason; + + switch (e) { + case EAGAIN: + reason = "not enough memory was available, please try again"; + break; + case ENOMEM: + reason = "allocation size was too large"; + break; + default: + reason = strerror(e); + break; + } + + errx(EXIT_FAILURE, "%s: failed to allocate %llu bytes of memory: %s", + fname, (u_longlong_t)l, reason); +} + +static void * +safe_calloc(const char *fname, size_t nelem, size_t elsize) +{ + void *r; + + if ((r = calloc(nelem, elsize)) == NULL) { + memory_err(nelem * elsize, errno, fname); + } + + return (r); +} + static char * -safe_strdup(char *str) +safe_strdup(const char *fname, const char *str) { - char *ret; - if ((ret = strdup(str)) == NULL) { - (void) warn("memory allocation", strerror(errno)); - exit(1); + size_t l = strlen(str); + char *r; + + if ((r = strndup(str, l)) == NULL) { + memory_err(l + 1, errno, fname); } - return (ret); + + return (r); } /* @@ -663,16 +766,6 @@ static void usage() { (void) fprintf(stderr, "Usage:\t%s [ -fhs ] [ -t fstab ] [ -m mnttab ] " - "rawdisk ...\n", progname); + "rawdisk ...\n", getprogname()); exit(1); } - -/* - * warn(): Print an error message. Always returns -1. - */ -static int -warn(char *what, char *why) -{ - (void) fprintf(stderr, "%s: %s: %s\n", progname, what, why); - return (-1); -} diff --git a/usr/src/cmd/ptools/pargs/pargs.c b/usr/src/cmd/ptools/pargs/pargs.c index e67f49e28f..6d82af21ba 100644 --- a/usr/src/cmd/ptools/pargs/pargs.c +++ b/usr/src/cmd/ptools/pargs/pargs.c @@ -623,6 +623,7 @@ get_args(pargs_data_t *datap) if (read_ptr_array(datap, argvoff, datap->pd_argv, argc) <= 0) { free(datap->pd_argv); datap->pd_argv = NULL; + datap->pd_argc = 0; return; } diff --git a/usr/src/cmd/sed/main.c b/usr/src/cmd/sed/main.c index 2ada22edbb..b148f7293e 100644 --- a/usr/src/cmd/sed/main.c +++ b/usr/src/cmd/sed/main.c @@ -1,4 +1,5 @@ /* + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. * Copyright (c) 2013 Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.com> * Copyright (c) 2011 Gary Mills * Copyright 2010 Nexenta Systems, Inc. All rights reserved. @@ -498,10 +499,30 @@ lastline(void) { int ch; - if (files->next != NULL && (inplace == NULL || ispan)) - return (0); - if ((ch = getc(infile)) == EOF) + if (feof(infile) != 0 || (ch = getc(infile)) == EOF) { + struct s_flist *f; + + /* + * Reached the end of the current input file. + * If there are no more that contain data, then this is the + * last line. + */ + if (inplace != NULL && ispan == 0) + return (1); + + for (f = files->next; f != NULL; f = f->next) { + struct stat st; + + if (stat(f->fname, &st) == -1) { + /* Treat an error here as an empty file */ + continue; + } + if (st.st_size > 0) + return (0); + } return (1); + } + (void) ungetc(ch, infile); return (0); } diff --git a/usr/src/cmd/smbios/smbios.c b/usr/src/cmd/smbios/smbios.c index 9c6d058182..399a85501e 100644 --- a/usr/src/cmd/smbios/smbios.c +++ b/usr/src/cmd/smbios/smbios.c @@ -22,6 +22,7 @@ /* * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. * Copyright (c) 2018, Joyent, Inc. + * Copyright 2020 Oxide Computer Company * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -736,7 +737,7 @@ print_slot(smbios_hdl_t *shp, id_t id, FILE *fp) oprintf(fp, " Slot Peer %u:\n", i); oprintf(fp, " Segment group: %u\n", peer[i].smblp_group); - oprintf(fp, " Bus/Device/Function: %u/%u/%u", + oprintf(fp, " Bus/Device/Function: %u/%u/%u\n", peer[i].smblp_bus, peer[i].smblp_device, peer[i].smblp_function); oprintf(fp, " Electrical width: %u\n", @@ -745,6 +746,25 @@ print_slot(smbios_hdl_t *shp, id_t id, FILE *fp) smbios_info_slot_peers_free(shp, npeers, peer); } + + if (s.smbl_info != 0) { + if (s.smbl_type >= SMB_SLT_PCIE && + s.smbl_type <= SMB_SLT_PCIEG6P) { + oprintf(fp, " PCIe Generation: %d\n", s.smbl_info); + } else { + oprintf(fp, " Slot Type: 0x%x\n", s.smbl_info); + } + } + + if (s.smbl_pwidth != 0) { + desc_printf(smbios_slot_width_desc(s.smbl_pwidth), + fp, " Physical Width: 0x%x", s.smbl_pwidth); + } + + if (s.smbl_pitch != 0) { + oprintf(fp, " Slot Pitch: %u.%u mm\n", s.smbl_pitch / 100, + s.smbl_pitch % 100); + } } static void diff --git a/usr/src/cmd/smbsrv/smbd/smbd_krb5lookup.c b/usr/src/cmd/smbsrv/smbd/smbd_krb5lookup.c index af98b15b1b..83bc6b21d2 100644 --- a/usr/src/cmd/smbsrv/smbd/smbd_krb5lookup.c +++ b/usr/src/cmd/smbsrv/smbd/smbd_krb5lookup.c @@ -10,7 +10,7 @@ */ /* - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2020 Nexenta by DDN, Inc. All rights reserved. */ #include <stdio.h> @@ -26,6 +26,7 @@ #include <sys/note.h> #include <smbsrv/libsmbns.h> +#include <ads/dsgetdc.h> #include "smbd.h" #include "locate_plugin.h" @@ -107,6 +108,13 @@ _krb5_override_service_locator( dxi.d_dci.dc_addr.a_family == 0) return (KRB5_REALM_CANT_RESOLVE); + if ((dxi.d_dci.dc_flags & DS_KDC_FLAG) == 0) { + smbd_report("_krb5_override_service_locator: " + "Domain Controller is not a KDC: " + "Kerberos auth may be slow"); + return (rc); + } + switch (family) { case AF_UNSPEC: break; /* OK */ |