MFC @r254374.

This commit is contained in:
ray 2013-08-15 19:32:08 +00:00
commit 3f79da49d7
1613 changed files with 139795 additions and 100941 deletions

View File

@ -128,3 +128,6 @@ sysdoc trhodes Pre-commit review preferred.
sh(1) jilles Pre-commit review requested. This also applies
to kill(1), printf(1) and test(1) which are
compiled in as builtins.
nvme(4) jimharris Pre-commit review requested.
nvd(4) jimharris Pre-commit review requested.
nvmecontrol(8) jimharris Pre-commit review requested.

View File

@ -1331,7 +1331,8 @@ build-tools: .MAKE
usr.bin/awk \
lib/libmagic \
usr.bin/mkesdb_static \
usr.bin/mkcsmapper_static
usr.bin/mkcsmapper_static \
usr.bin/vi/catalog
${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
cd ${.CURDIR}/${_tool} && \
${MAKE} DIRPRFX=${_tool}/ obj && \

View File

@ -31,6 +31,52 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20130813:
WITH_ICONV has been split into two feature sets. WITH_ICONV now
enables just the iconv* functionality and is now on by default.
WITH_LIBICONV_COMPAT enables the libiconv api and link time
compatability. Set WITHOUT_ICONV to build the old way.
If you have been using WITH_ICONV before, you will very likely
need to turn on WITH_LIBICONV_COMPAT.
20130806:
INVARIANTS option now enables DEBUG for code with OpenSolaris and
Illumos origin, including ZFS. If you have INVARIANTS in your
kernel configuration, then there is no need to set DEBUG or ZFS_DEBUG
explicitly.
DEBUG used to enable witness(9) tracking of OpenSolaris (mostly ZFS)
locks if WITNESS option was set. Because that generated a lot of
witness(9) reports and all of them were believed to be false
positives, this is no longer done. New option OPENSOLARIS_WITNESS
can be used to achieve the previous behavior.
20130806:
Timer values in IPv6 data structures now use time_uptime instead
of time_second. Although this is not a user-visible functional
change, userland utilities which directly use them---ndp(8),
rtadvd(8), and rtsold(8) in the base system---need to be updated
to r253970 or later.
20130802:
find -delete can now delete the pathnames given as arguments,
instead of only files found below them or if the pathname did
not contain any slashes. Formerly, the following error message
would result:
find: -delete: <path>: relative path potentially not safe
Deleting the pathnames given as arguments can be prevented
without error messages using -mindepth 1 or by changing
directory and passing "." as argument to find. This works in the
old as well as the new version of find.
20130726:
Behavior of devfs rules path matching has been changed.
Pattern is now always matched against fully qualified devfs
path and slash characters must be explicitly matched by
slashes in pattern (FNM_PATHNAME). Rulesets involving devfs
subdirectories must be reviewed.
20130716:
The default ARM ABI has changed to the ARM EABI. The old ABI is
incompatible with the ARM EABI and all programs and modules will

View File

@ -29,7 +29,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd February 11, 2010
.Dd August 9, 2013
.Dt PKILL 1
.Os
.Sh NAME
@ -44,6 +44,7 @@
.Op Fl N Ar system
.Op Fl P Ar ppid
.Op Fl U Ar uid
.Op Fl c Ar class
.Op Fl d Ar delim
.Op Fl g Ar pgrp
.Op Fl j Ar jid
@ -60,6 +61,7 @@
.Op Fl N Ar system
.Op Fl P Ar ppid
.Op Fl U Ar uid
.Op Fl c Ar class
.Op Fl g Ar pgrp
.Op Fl j Ar jid
.Op Fl s Ar sid
@ -130,6 +132,9 @@ or
process and all of its ancestors are excluded (unless
.Fl v
is used).
.It Fl c Ar class
Restrict matches to processes running with specified login class
.Ar class .
.It Fl f
Match against full argument lists.
The default is to match against process names.

View File

@ -79,12 +79,14 @@ enum listtype {
LT_TTY,
LT_PGRP,
LT_JID,
LT_SID
LT_SID,
LT_CLASS
};
struct list {
SLIST_ENTRY(list) li_chain;
long li_number;
char *li_name;
};
SLIST_HEAD(listhead, list);
@ -116,6 +118,7 @@ static struct listhead ppidlist = SLIST_HEAD_INITIALIZER(ppidlist);
static struct listhead tdevlist = SLIST_HEAD_INITIALIZER(tdevlist);
static struct listhead sidlist = SLIST_HEAD_INITIALIZER(sidlist);
static struct listhead jidlist = SLIST_HEAD_INITIALIZER(jidlist);
static struct listhead classlist = SLIST_HEAD_INITIALIZER(classlist);
static void usage(void) __attribute__((__noreturn__));
static int killact(const struct kinfo_proc *);
@ -179,7 +182,7 @@ main(int argc, char **argv)
execf = NULL;
coref = _PATH_DEVNULL;
while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:SU:ad:fg:ij:lnoqs:t:u:vx")) != -1)
while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:SU:ac:d:fg:ij:lnoqs:t:u:vx")) != -1)
switch (ch) {
case 'D':
debug_opt++;
@ -222,6 +225,10 @@ main(int argc, char **argv)
case 'a':
ancestors++;
break;
case 'c':
makelist(&classlist, LT_CLASS, optarg);
criteria = 1;
break;
case 'd':
if (!pgrep)
usage();
@ -469,6 +476,20 @@ main(int argc, char **argv)
continue;
}
SLIST_FOREACH(li, &classlist, li_chain) {
/*
* We skip P_SYSTEM processes to match ps(1) output.
*/
if ((kp->ki_flag & P_SYSTEM) == 0 &&
kp->ki_loginclass != NULL &&
strcmp(kp->ki_loginclass, li->li_name) == 0)
break;
}
if (SLIST_FIRST(&classlist) != NULL && li == NULL) {
selected[i] = 0;
continue;
}
if (argc == 0)
selected[i] = 1;
}
@ -562,9 +583,9 @@ usage(void)
fprintf(stderr,
"usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n"
" [-P ppid] [-U uid] [-g pgrp] [-j jid] [-s sid]\n"
" [-t tty] [-u euid] pattern ...\n", getprogname(),
ustr);
" [-P ppid] [-U uid] [-c class] [-g pgrp] [-j jid]\n"
" [-s sid] [-t tty] [-u euid] pattern ...\n",
getprogname(), ustr);
exit(STATUS_BADUSAGE);
}
@ -664,8 +685,10 @@ makelist(struct listhead *head, enum listtype type, char *src)
SLIST_INSERT_HEAD(head, li, li_chain);
empty = 0;
li->li_number = (uid_t)strtol(sp, &ep, 0);
if (*ep == '\0') {
if (type != LT_CLASS)
li->li_number = (uid_t)strtol(sp, &ep, 0);
if (type != LT_CLASS && *ep == '\0') {
switch (type) {
case LT_PGRP:
if (li->li_number == 0)
@ -750,6 +773,12 @@ foundtty: if ((st.st_mode & S_IFCHR) == 0)
errx(STATUS_BADUSAGE,
"Invalid jail ID `%s'", sp);
break;
case LT_CLASS:
li->li_number = -1;
li->li_name = strdup(sp);
if (li->li_name == NULL)
err(STATUS_ERROR, "Cannot allocate memory");
break;
default:
usage();
}

View File

@ -8,7 +8,7 @@ SHSRCS= alias.c arith_yacc.c arith_yylex.c cd.c echo.c error.c eval.c \
histedit.c input.c jobs.c kill.c mail.c main.c memalloc.c miscbltin.c \
mystring.c options.c output.c parser.c printf.c redir.c show.c \
test.c trap.c var.c
GENSRCS= builtins.c init.c nodes.c syntax.c
GENSRCS= builtins.c nodes.c syntax.c
GENHDRS= builtins.h nodes.h syntax.h token.h
SRCS= ${SHSRCS} ${GENSRCS} ${GENHDRS}
@ -30,26 +30,21 @@ WFORMAT=0
${.CURDIR}/../test \
${.CURDIR}/../../usr.bin/printf
CLEANFILES+= mkinit mkinit.o mknodes mknodes.o \
CLEANFILES+= mknodes mknodes.o \
mksyntax mksyntax.o
CLEANFILES+= ${GENSRCS} ${GENHDRS}
build-tools: mkinit mknodes mksyntax
build-tools: mknodes mksyntax
.ORDER: builtins.c builtins.h
builtins.c builtins.h: mkbuiltins builtins.def
sh ${.CURDIR}/mkbuiltins ${.CURDIR}
init.c: mkinit alias.c eval.c exec.c input.c jobs.c options.c parser.c \
redir.c trap.c var.c
./mkinit ${.ALLSRC:S/^mkinit$//}
# XXX this is just to stop the default .c rule being used, so that the
# intermediate object has a fixed name.
# XXX we have a default .c rule, but no default .o rule.
.o:
${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
mkinit: mkinit.o
mknodes: mknodes.o
mksyntax: mksyntax.o

View File

@ -25,38 +25,11 @@ programs is:
program input files generates
------- ----------- ---------
mkbuiltins builtins builtins.h builtins.c
mkinit *.c init.c
mknodes nodetypes nodes.h nodes.c
mksyntax - syntax.h syntax.c
mktokens - token.h
There are undoubtedly too many of these. Mkinit searches all the
C source files for entries looking like:
RESET {
x = 2; /* executed when the shell does a longjmp
back to the main command loop */
}
It pulls this code out into routines which are when particular
events occur. The intent is to improve modularity by isolating
the information about which modules need to be explicitly
initialized/reset within the modules themselves.
Mkinit recognizes several constructs for placing declarations in
the init.c file.
INCLUDE "file.h"
includes a file. The storage class MKINIT makes a declaration
available in the init.c file, for example:
MKINIT int funcnest; /* depth of function calls */
MKINIT alone on a line introduces a structure or union declara-
tion:
MKINIT
struct redirtab {
short renamed[10];
};
Preprocessor #define statements are copied to init.c without any
special action to request this.
There are undoubtedly too many of these.
EXCEPTIONS: Code for dealing with exceptions appears in
exceptions.c. The C language doesn't include exception handling,

View File

@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$");
int evalskip; /* set if we are skipping commands */
int skipcount; /* number of levels to skip */
MKINIT int loopnest; /* current loop nesting level */
static int loopnest; /* current loop nesting level */
int funcnest; /* depth of function calls */
static int builtin_flags; /* evalcommand flags for builtins */
@ -104,16 +104,13 @@ static void prehash(union node *);
* Called to reset things after an exception.
*/
#ifdef mkinit
INCLUDE "eval.h"
RESET {
void
reseteval(void)
{
evalskip = 0;
loopnest = 0;
funcnest = 0;
}
#endif
/*

View File

@ -46,6 +46,8 @@ struct backcmd { /* result of evalbackcmd */
struct job *jp; /* job structure for command */
};
void reseteval(void);
/* flags in argument to evaltree/evalstring */
#define EV_EXIT 01 /* exit after evaluating tree */
#define EV_TESTED 02 /* exit status is checked; ignore -e flag */

View File

@ -70,7 +70,6 @@ __FBSDID("$FreeBSD$");
#include "syntax.h"
#include "memalloc.h"
#include "error.h"
#include "init.h"
#include "mystring.h"
#include "show.h"
#include "jobs.h"

View File

@ -92,7 +92,7 @@ struct parsefile {
int plinno = 1; /* input line number */
int parsenleft; /* copy of parsefile->nleft */
MKINIT int parselleft; /* copy of parsefile->lleft */
static int parselleft; /* copy of parsefile->lleft */
const char *parsenextc; /* copy of parsefile->nextc */
static char basebuf[BUFSIZ + 1];/* buffer for top level input file */
static struct parsefile basepf = { /* top level input file */
@ -108,15 +108,12 @@ static void pushfile(void);
static int preadfd(void);
static void popstring(void);
#ifdef mkinit
INCLUDE "input.h"
INCLUDE "error.h"
RESET {
void
resetinput(void)
{
popallfiles();
parselleft = parsenleft = 0; /* clear input buffer */
}
#endif
/*

View File

@ -47,6 +47,7 @@ extern const char *parsenextc; /* next character in input buffer */
struct alias;
struct parsefile;
void resetinput(void);
char *pfgets(char *, int);
int pgetc(void);
int preadbuffer(void);

View File

@ -77,8 +77,8 @@ __FBSDID("$FreeBSD$");
static struct job *jobtab; /* array of jobs */
static int njobs; /* size of array */
MKINIT pid_t backgndpid = -1; /* pid of last background process */
MKINIT struct job *bgjob = NULL; /* last background process */
static pid_t backgndpid = -1; /* pid of last background process */
static struct job *bgjob = NULL; /* last background process */
#if JOBS
static struct job *jobmru; /* most recently used job list */
static pid_t initialpgrp; /* pgrp of shell on invocation */
@ -116,7 +116,7 @@ static void showjob(struct job *, int);
* Turn job control on and off.
*/
MKINIT int jobctl;
static int jobctl;
#if JOBS
void

View File

@ -68,10 +68,10 @@ __FBSDID("$FreeBSD$");
#include "show.h"
#include "memalloc.h"
#include "error.h"
#include "init.h"
#include "mystring.h"
#include "exec.h"
#include "cd.h"
#include "redir.h"
#include "builtins.h"
int rootpid;
@ -79,6 +79,7 @@ int rootshell;
struct jmploc main_handler;
int localeisutf8, initial_localeisutf8;
static void reset(void);
static void cmdloop(int);
static void read_profile(const char *);
static char *find_dot_file(char *);
@ -179,6 +180,14 @@ main(int argc, char *argv[])
return 0;
}
static void
reset(void)
{
reseteval();
resetinput();
resetparser();
resetredir();
}
/*
* Read and execute commands. "Top" is nonzero for the top level command

View File

@ -1,480 +0,0 @@
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Kenneth Almquist.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lint
static char const copyright[] =
"@(#) Copyright (c) 1991, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)mkinit.c 8.2 (Berkeley) 5/4/95";
#endif
#endif /* not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* This program scans all the source files for code to handle various
* special events and combines this code into one file. This (allegedly)
* improves the structure of the program since there is no need for
* anyone outside of a module to know that that module performs special
* operations on particular events.
*
* Usage: mkinit sourcefile...
*/
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
/*
* OUTFILE is the name of the output file. Output is initially written
* to the file OUTTEMP, which is then moved to OUTFILE.
*/
#define OUTFILE "init.c"
#define OUTTEMP "init.c.new"
/*
* A text structure is basically just a string that grows as more characters
* are added onto the end of it. It is implemented as a linked list of
* blocks of characters. The routines addstr and addchar append a string
* or a single character, respectively, to a text structure. Writetext
* writes the contents of a text structure to a file.
*/
#define BLOCKSIZE 512
struct text {
char *nextc;
int nleft;
struct block *start;
struct block *last;
};
struct block {
struct block *next;
char text[BLOCKSIZE];
};
/*
* There is one event structure for each event that mkinit handles.
*/
struct event {
const char *name; /* name of event (e.g. RESET) */
const char *routine; /* name of routine called on event */
const char *comment; /* comment describing routine */
struct text code; /* code for handling event */
};
char writer[] = "\
/*\n\
* This file was generated by the mkinit program.\n\
*/\n\
\n";
char reset[] = "\
/*\n\
* This routine is called when an error or an interrupt occurs in an\n\
* interactive shell and control is returned to the main command loop.\n\
*/\n";
struct event event[] = {
{ "RESET", "reset", reset, { NULL, 0, NULL, NULL } },
{ NULL, NULL, NULL, { NULL, 0, NULL, NULL } }
};
const char *curfile; /* current file */
int linno; /* current line */
char *header_files[200]; /* list of header files */
struct text defines; /* #define statements */
struct text decls; /* declarations */
int amiddecls; /* for formatting */
void readfile(const char *);
int match(const char *, const char *);
int gooddefine(const char *);
void doevent(struct event *, FILE *, const char *);
void doinclude(char *);
void dodecl(char *, FILE *);
void output(void);
void addstr(const char *, struct text *);
void addchar(int, struct text *);
void writetext(struct text *, FILE *);
FILE *ckfopen(const char *, const char *);
void *ckmalloc(size_t);
char *savestr(const char *);
void error(const char *);
#define equal(s1, s2) (strcmp(s1, s2) == 0)
int
main(int argc __unused, char *argv[])
{
char **ap;
header_files[0] = savestr("\"shell.h\"");
header_files[1] = savestr("\"mystring.h\"");
header_files[2] = savestr("\"init.h\"");
for (ap = argv + 1 ; *ap ; ap++)
readfile(*ap);
output();
rename(OUTTEMP, OUTFILE);
exit(0);
}
/*
* Parse an input file.
*/
void
readfile(const char *fname)
{
FILE *fp;
char line[1024];
struct event *ep;
fp = ckfopen(fname, "r");
curfile = fname;
linno = 0;
amiddecls = 0;
while (fgets(line, sizeof line, fp) != NULL) {
linno++;
for (ep = event ; ep->name ; ep++) {
if (line[0] == ep->name[0] && match(ep->name, line)) {
doevent(ep, fp, fname);
break;
}
}
if (line[0] == 'I' && match("INCLUDE", line))
doinclude(line);
if (line[0] == 'M' && match("MKINIT", line))
dodecl(line, fp);
if (line[0] == '#' && gooddefine(line)) {
char *cp;
char line2[1024];
static const char undef[] = "#undef ";
strcpy(line2, line);
memcpy(line2, undef, sizeof(undef) - 1);
cp = line2 + sizeof(undef) - 1;
while(*cp && (*cp == ' ' || *cp == '\t'))
cp++;
while(*cp && *cp != ' ' && *cp != '\t' && *cp != '\n')
cp++;
*cp++ = '\n'; *cp = '\0';
addstr(line2, &defines);
addstr(line, &defines);
}
}
fclose(fp);
}
int
match(const char *name, const char *line)
{
const char *p, *q;
p = name, q = line;
while (*p) {
if (*p++ != *q++)
return 0;
}
if (*q != '{' && *q != ' ' && *q != '\t' && *q != '\n')
return 0;
return 1;
}
int
gooddefine(const char *line)
{
const char *p;
if (! match("#define", line))
return 0; /* not a define */
p = line + 7;
while (*p == ' ' || *p == '\t')
p++;
while (*p != ' ' && *p != '\t') {
if (*p == '(')
return 0; /* macro definition */
p++;
}
while (*p != '\n' && *p != '\0')
p++;
if (p[-1] == '\\')
return 0; /* multi-line definition */
return 1;
}
void
doevent(struct event *ep, FILE *fp, const char *fname)
{
char line[1024];
int indent;
const char *p;
sprintf(line, "\n /* from %s: */\n", fname);
addstr(line, &ep->code);
addstr(" {\n", &ep->code);
for (;;) {
linno++;
if (fgets(line, sizeof line, fp) == NULL)
error("Unexpected EOF");
if (equal(line, "}\n"))
break;
indent = 6;
for (p = line ; *p == '\t' ; p++)
indent += 8;
for ( ; *p == ' ' ; p++)
indent++;
if (*p == '\n' || *p == '#')
indent = 0;
while (indent >= 8) {
addchar('\t', &ep->code);
indent -= 8;
}
while (indent > 0) {
addchar(' ', &ep->code);
indent--;
}
addstr(p, &ep->code);
}
addstr(" }\n", &ep->code);
}
void
doinclude(char *line)
{
char *p;
char *name;
char **pp;
for (p = line ; *p != '"' && *p != '<' && *p != '\0' ; p++);
if (*p == '\0')
error("Expecting '\"' or '<'");
name = p;
while (*p != ' ' && *p != '\t' && *p != '\n')
p++;
if (p[-1] != '"' && p[-1] != '>')
error("Missing terminator");
*p = '\0';
/* name now contains the name of the include file */
for (pp = header_files ; *pp && ! equal(*pp, name) ; pp++);
if (*pp == NULL)
*pp = savestr(name);
}
void
dodecl(char *line1, FILE *fp)
{
char line[1024];
char *p, *q;
if (strcmp(line1, "MKINIT\n") == 0) { /* start of struct/union decl */
addchar('\n', &decls);
do {
linno++;
if (fgets(line, sizeof line, fp) == NULL)
error("Unterminated structure declaration");
addstr(line, &decls);
} while (line[0] != '}');
amiddecls = 0;
} else {
if (! amiddecls)
addchar('\n', &decls);
q = NULL;
for (p = line1 + 6 ; *p && strchr("=/\n", *p) == NULL; p++)
continue;
if (*p == '=') { /* eliminate initialization */
for (q = p ; *q && *q != ';' ; q++);
if (*q == '\0')
q = NULL;
else {
while (p[-1] == ' ')
p--;
*p = '\0';
}
}
addstr("extern", &decls);
addstr(line1 + 6, &decls);
if (q != NULL)
addstr(q, &decls);
amiddecls = 1;
}
}
/*
* Write the output to the file OUTTEMP.
*/
void
output(void)
{
FILE *fp;
char **pp;
struct event *ep;
fp = ckfopen(OUTTEMP, "w");
fputs(writer, fp);
for (pp = header_files ; *pp ; pp++)
fprintf(fp, "#include %s\n", *pp);
fputs("\n\n\n", fp);
writetext(&defines, fp);
fputs("\n\n", fp);
writetext(&decls, fp);
for (ep = event ; ep->name ; ep++) {
fputs("\n\n\n", fp);
fputs(ep->comment, fp);
fprintf(fp, "\nvoid\n%s(void)\n{\n", ep->routine);
writetext(&ep->code, fp);
fprintf(fp, "}\n");
}
fclose(fp);
}
/*
* A text structure is simply a block of text that is kept in memory.
* Addstr appends a string to the text struct, and addchar appends a single
* character.
*/
void
addstr(const char *s, struct text *text)
{
while (*s) {
if (--text->nleft < 0)
addchar(*s++, text);
else
*text->nextc++ = *s++;
}
}
void
addchar(int c, struct text *text)
{
struct block *bp;
if (--text->nleft < 0) {
bp = ckmalloc(sizeof *bp);
if (text->start == NULL)
text->start = bp;
else
text->last->next = bp;
text->last = bp;
text->nextc = bp->text;
text->nleft = BLOCKSIZE - 1;
}
*text->nextc++ = c;
}
/*
* Write the contents of a text structure to a file.
*/
void
writetext(struct text *text, FILE *fp)
{
struct block *bp;
if (text->start != NULL) {
for (bp = text->start ; bp != text->last ; bp = bp->next)
fwrite(bp->text, sizeof (char), BLOCKSIZE, fp);
fwrite(bp->text, sizeof (char), BLOCKSIZE - text->nleft, fp);
}
}
FILE *
ckfopen(const char *file, const char *mode)
{
FILE *fp;
if ((fp = fopen(file, mode)) == NULL) {
fprintf(stderr, "Can't open %s: %s\n", file, strerror(errno));
exit(2);
}
return fp;
}
void *
ckmalloc(size_t nbytes)
{
char *p;
if ((p = malloc(nbytes)) == NULL)
error("Out of space");
return p;
}
char *
savestr(const char *s)
{
char *p;
p = ckmalloc(strlen(s) + 1);
strcpy(p, s);
return p;
}
void
error(const char *msg)
{
if (curfile != NULL)
fprintf(stderr, "%s:%d: ", curfile, linno);
fprintf(stderr, "%s\n", msg);
exit(2);
}

View File

@ -75,25 +75,6 @@ struct output memout = {NULL, 0, NULL, 0, MEM_OUT, 0};
struct output *out1 = &output;
struct output *out2 = &errout;
#ifdef mkinit
INCLUDE "output.h"
INCLUDE "memalloc.h"
RESET {
out1 = &output;
out2 = &errout;
if (memout.buf != NULL) {
ckfree(memout.buf);
memout.buf = NULL;
}
}
#endif
void
outcslow(int c, struct output *file)
{

View File

@ -96,9 +96,9 @@ static struct heredoc *heredoclist; /* list of here documents to read */
static int doprompt; /* if set, prompt the user */
static int needprompt; /* true if interactive and at start of line */
static int lasttoken; /* last token read */
MKINIT int tokpushback; /* last token pushed back */
int tokpushback; /* last token pushed back */
static char *wordtext; /* text of last word returned by readtoken */
MKINIT int checkkwd; /* 1 == check for kwds, 2 == also eat newlines */
static int checkkwd;
static struct nodelist *backquotelist;
static union node *redirnode;
static struct heredoc *heredoc;
@ -577,6 +577,9 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
case TSEMI:
case TAND:
case TOR:
case TPIPE:
case TENDCASE:
case TFALLTHRU:
/*
* An empty command before a ; doesn't make much sense, and
* should certainly be disallowed in the case of `if ;'.
@ -1819,13 +1822,13 @@ parsearith: {
} /* end of readtoken */
#ifdef mkinit
RESET {
void
resetparser(void)
{
tokpushback = 0;
checkkwd = 0;
}
#endif
/*
* Returns true if the text contains nothing to expand (no dollar signs

View File

@ -79,6 +79,7 @@ extern const char *const parsekwd[];
union node *parsecmd(int);
void fixredir(union node *, const char *, int);
void resetparser(void);
int goodname(const char *);
int isassignment(const char *);
char *getprompt(void *);

View File

@ -66,14 +66,13 @@ __FBSDID("$FreeBSD$");
#define CLOSED -1 /* fd was not open before redir */
MKINIT
struct redirtab {
struct redirtab *next;
int renamed[10];
};
MKINIT struct redirtab *redirlist;
static struct redirtab *redirlist;
/*
* We keep track of whether or not fd0 has been redirected. This is for
@ -324,16 +323,13 @@ popredir(void)
* Undo all redirections. Called on error or interrupt.
*/
#ifdef mkinit
INCLUDE "redir.h"
RESET {
void
resetredir(void)
{
while (redirlist)
popredir();
}
#endif
/* Return true if fd 0 has already been redirected at least once. */
int

View File

@ -40,6 +40,7 @@
union node;
void redirect(union node *, int);
void popredir(void);
void resetredir(void);
int fd0_redirected_p(void);
void clearredir(void);

View File

@ -63,7 +63,6 @@ typedef intmax_t arith_t;
#define ARITH_MAX INTMAX_MAX
typedef void *pointer;
#define MKINIT /* empty */
#include <sys/cdefs.h>

View File

@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
#define S_RESET 5 /* temporary - to reset a hard ignored sig */
MKINIT char sigmode[NSIG]; /* current value of signal */
static char sigmode[NSIG]; /* current value of signal */
volatile sig_atomic_t pendingsig; /* indicates some signal received */
int in_dotrap; /* do we execute in a trap handler? */
static char *volatile trap[NSIG]; /* trap handler commands */

View File

@ -710,6 +710,7 @@ localcmd(int argc __unused, char **argv __unused)
{
char *name;
nextopt("");
if (! in_function())
error("Not in a function");
while ((name = *argptr++) != NULL) {

View File

@ -583,6 +583,8 @@ if ($opt_x) {
die "$PNAME: failed to open $PNAME.$$.log: $!\n"
unless (!$opt_l || open(LOG, ">$PNAME.$$.log"));
$ENV{'DTRACE_DEBUG_REGSET'} = 'true';
if ($opt_g) {
$ENV{'UMEM_DEBUG'} = 'default,verbose';
$ENV{'UMEM_LOGGING'} = 'fail,contents';

View File

@ -0,0 +1,35 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
#pragma D option quiet
/*
* Make sure the sizes of compatible keys doesn't affect the sort order.
*/
BEGIN
{
@[(int)1, 0] = sum(10);
@[(uint64_t)2, 0] = sum(20);
@[(int)3, 0] = sum(30);
@[(uint64_t)4, 0] = sum(40);
printa(@);
exit(0);
}

View File

@ -0,0 +1,6 @@
1 0 10
2 0 20
3 0 30
4 0 40

View File

@ -0,0 +1,8 @@
The value of i is 6
The value of i is 18
The value of i is 72
The value of i is 25920
The value of i is 935761216
The value of i is -91738734
The value of i is -91738729

View File

@ -0,0 +1,50 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* Test compile-time casting between integer types of different size.
*/
#pragma D option quiet
int64_t x;
BEGIN
{
x = (int32_t)(int16_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
x = (int32_t)(uint16_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
x = (uint32_t)(int16_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
x = (uint32_t)(uint16_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
printf("\n");
x = (int16_t)(int32_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
x = (int16_t)(uint32_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
x = (uint16_t)(int32_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
x = (uint16_t)(uint32_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
exit(0);
}

View File

@ -0,0 +1,10 @@
fffffffffffffff0 -16 18446744073709551600
fff0 65520 65520
fffffff0 4294967280 4294967280
fff0 65520 65520
fffffffffffffff0 -16 18446744073709551600
fffffffffffffff0 -16 18446744073709551600
fff0 65520 65520
fff0 65520 65520

View File

@ -1,57 +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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* Complex expressions.
* Call complex expressions and make sure test succeeds.
* Match expected output in tst.complex.d.out
*
* SECTION: Types, Operators, and Expressions/Arithmetic Operators
*
*/
#pragma D option quiet
BEGIN
{
i = 0;
i = i++ + ++i;
printf("The value of i is %d\n", i);
i = i-- - --i;
printf("The value of i is %d\n", i);
i = i-- + ++i;
printf("The value of i is %d\n", i);
i += i++ + -- i + ++i - ++i * i ;
printf("The value of i is %d\n", i);
i -= i++ * 3;
printf("The value of i is %d\n", i);
i = i++/i--+i++-++i-++i;
printf("The value of i is %d\n", i);
exit (0);
}

View File

@ -0,0 +1,36 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* Test narrowing at assignment.
*/
#pragma D option quiet
uint16_t x;
uint32_t y;
BEGIN
{
x = 0xbeefcafe;
y = x;
printf("%x", y); /* where's the beef? */
exit(0);
}

View File

@ -0,0 +1,52 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* Test execution-time casting between integer types of different size.
*/
#pragma D option quiet
int64_t x;
BEGIN
{
z = 0xfff0;
x = (int32_t)(int16_t)z;
printf("%16x %20d %20u\n", x, x, x);
x = (int32_t)(uint16_t)z;
printf("%16x %20d %20u\n", x, x, x);
x = (uint32_t)(int16_t)z;
printf("%16x %20d %20u\n", x, x, x);
x = (uint32_t)(uint16_t)z;
printf("%16x %20d %20u\n", x, x, x);
printf("\n");
x = (int16_t)(int32_t)z;
printf("%16x %20d %20u\n", x, x, x);
x = (int16_t)(uint32_t)z;
printf("%16x %20d %20u\n", x, x, x);
x = (uint16_t)(int32_t)z;
printf("%16x %20d %20u\n", x, x, x);
x = (uint16_t)(uint32_t)z;
printf("%16x %20d %20u\n", x, x, x);
exit(0);
}

View File

@ -0,0 +1,10 @@
fffffffffffffff0 -16 18446744073709551600
fff0 65520 65520
fffffff0 4294967280 4294967280
fff0 65520 65520
fffffffffffffff0 -16 18446744073709551600
fffffffffffffff0 -16 18446744073709551600
fff0 65520 65520
fff0 65520 65520

View File

@ -36,12 +36,12 @@
#pragma D option quiet
#pragma D option statusrate=10ms
fbt::ioctl:entry
fbt::kern_ioctl:entry
{
printf("Entering the ioctl function\n");
}
fbt::ioctl:return
fbt::kern_ioctl:return
{
printf("Returning from ioctl function\n");
exit(0);

View File

@ -36,7 +36,7 @@
#pragma D option quiet
#pragma D option statusrate=10ms
fbt::ioctl:return
fbt::kern_ioctl:return
{
printf("The function return value is stored in %u\n", arg1);
exit(0);

View File

@ -36,13 +36,13 @@
#pragma D option quiet
#pragma D option statusrate=10ms
fbt::ioctl:entry
fbt::kern_ioctl:entry
{
printf("Entering the ioctl function\n");
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
}
fbt::ioctl:return
fbt::kern_ioctl:return
{
printf("Returning from ioctl function\n");
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);

View File

@ -41,12 +41,12 @@ BEGIN
self->traceme = 1;
}
fbt::ioctl:entry
fbt::kern_ioctl:entry
{
printf("Entering the function\n");
}
fbt::ioctl:return
fbt::kern_ioctl:return
{
printf("The offset = %u\n", arg0);
exit(0);

View File

@ -36,14 +36,14 @@
#pragma D option quiet
#pragma D option statusrate=10ms
fbt::ioctl:entry
fbt::kern_ioctl:entry
{
printf("Entering the ioctl function\n");
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
exit(0);
}
fbt::ioctl:return
fbt::kern_ioctl:return
{
printf("Returning from ioctl function\n");
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);

View File

@ -36,7 +36,7 @@
#pragma D option quiet
#pragma D option statusrate=10ms
fbt::ioctl:return
fbt::kern_ioctl:return
/arg1 == 0/
{
printf("%s %x returned 0", probefunc, arg0);

View File

@ -36,7 +36,7 @@
#pragma D option quiet
#pragma D option statusrate=10ms
fbt::ioctl:entry
fbt::kern_ioctl:entry
{
self->traceme = 1;
}
@ -47,7 +47,7 @@ fbt:::entry
printf("called %s\n", probefunc);
}
fbt::ioctl:return
fbt::kern_ioctl:return
/self->traceme/
{
self->traceme = 0;

View File

@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
#pragma D option quiet
@ -36,3 +38,8 @@ BEGIN
printf("%s\n", strjoin("", ""));
exit(0);
}
BEGIN
{
exit(1);
}

View File

@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* ASSERTION: This test reproduces the alignment error.
@ -39,9 +41,10 @@
BEGIN
{
x = (int *) 64;
x = (int *)64;
y = *x;
trace(y);
exit(0);
}
ERROR

View File

@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* ASSERTION: D pointers do not allow invalid pointer accesses.
@ -44,6 +46,7 @@ BEGIN
y = (int *) (x - 3300778156056);
*y = 3;
trace(*y);
exit(0);
}
ERROR

View File

@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* ASSERTION: D pointers do not allow invalid pointer accesses.
@ -39,9 +41,10 @@
BEGIN
{
y = (int *) (-33007);
y = (int *)-33007;
*y = 3;
trace(*y);
exit(0);
}
ERROR

View File

@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* ASSERTION: Demonstrating valid memory access.
@ -40,10 +42,11 @@
BEGIN
{
x = (int *)alloca(sizeof (int));
printf("Address x: %x\n", (int) x);
y = (int *) (x - 2);
printf("Address x: %x\n", (int)x);
y = (int *)(x - 2);
*y = 3;
printf("Address y: %x\tValue: %d\n", (int) y, *y);
printf("Address y: %x\tValue: %d\n", (int)y, *y);
exit(0);
}
ERROR

View File

@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
BEGIN
{
@ = count();
print(@);
}
BEGIN
{
exit(0);
}

View File

@ -1,29 +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 (c) 2011 by Delphix. All rights reserved.
*/
BEGIN
{
print(*curpsinfo);
}

View File

@ -20,10 +20,15 @@
*/
/*
* Copyright (c) 2011 by Delphix. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
BEGIN
{
print((void)`p0);
}
BEGIN
{
exit(0);
}

View File

@ -20,10 +20,15 @@
*/
/*
* Copyright (c) 2011 by Delphix. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
BEGIN
{
print();
}
BEGIN
{
exit(0);
}

View File

@ -0,0 +1,28 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
BEGIN
{
print(*curpsinfo);
}
BEGIN
{
exit(0);
}

View File

@ -0,0 +1,42 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
#pragma D option quiet
typedef struct pancakes {
int i;
string s;
timespec_t t;
} pancakes_t;
translator pancakes_t < void *V > {
i = 2 * 10;
s = strjoin("I like ", "pancakes");
t = *(timespec_t *)`dtrace_zero;
};
BEGIN
{
print(*(xlate < pancakes_t * > ((void *)NULL)));
}
BEGIN
{
exit(0);
}

View File

@ -0,0 +1,8 @@
pancakes_t {
int i = 0x14
string s = [ "I like pancakes" ]
timespec_t t = {
time_t tv_sec = 0
long tv_nsec = 0
}
}

View File

@ -1,6 +1,6 @@
239
52719
-17
-12817
-1867788817
1311768467294899695

View File

@ -0,0 +1,38 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* Check %d v. %i v. %u.
*/
#pragma D option quiet
uint16_t x;
int16_t y;
BEGIN
{
x = 0xffffffff;
y = 0xffffffff;
printf("%d %i %u\n", x, x, x);
printf("%d %i %u\n", y, y, y);
exit(0);
}

View File

@ -0,0 +1,3 @@
65535 -1 65535
-1 -1 65535

View File

@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* ASSERTION:
@ -39,7 +41,7 @@
*/
#pragma D option bufsize=16
#pragma D option bufsize=32
#pragma D option bufpolicy=ring
#pragma D option statusrate=1nsec

View File

@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* ASSERTION:

View File

@ -24,8 +24,9 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* ASSERTION:
@ -39,3 +40,8 @@ BEGIN
trace();
}
BEGIN
{
exit(0);
}

View File

@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
BEGIN
{
@ = count();
trace(@);
}
BEGIN
{
exit(0);
}

View File

@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* ASSERTION:
@ -37,3 +39,8 @@ BEGIN
{
trace((void)`kmem_flags);
}
BEGIN
{
exit(0);
}

View File

@ -0,0 +1,28 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
BEGIN
{
trace(*curpsinfo);
}
BEGIN
{
exit(0);
}

View File

@ -1,61 +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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION:
* The D inline translation mechanism can be used to facilitate stable
* translations.
*
* SECTION: Translators/ Translator Declarations
* SECTION: Translators/ Translate Operator
* SECTION: Translators/Stable Translations
*
* NOTES: Uncomment the pragma that explicitly resets the attributes of
* myinfo identifier to Stable/Stable/Common from Private/Private/Unknown.
* Run the program with and without the comments as:
* /usr/sbin/dtrace -vs man.TestTransStability.d
*/
#pragma D option quiet
inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread);
/*
#pragma D attributes Stable/Stable/Common myinfo
*/
BEGIN
{
trace(myinfo->pr_flag);
exit(0);
}
ERROR
{
exit(1);
}

View File

@ -0,0 +1,62 @@
#
# 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.
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
#
#
# Test the output for stable translations.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
$dtrace -v -s /dev/stdin <<EOF
#pragma D option quiet
inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread);
#pragma D attributes Stable/Stable/Common myinfo
BEGIN
{
this->a = myinfo->pr_flag;
exit(0);
}
BEGIN
{
exit(1);
}
EOF
exit $?

View File

@ -0,0 +1,14 @@
Stability attributes for script /dev/stdin:
Minimum Probe Description Attributes
Identifier Names: Unstable
Data Semantics: Unstable
Dependency Class: Common
Minimum Statement Attributes
Identifier Names: Stable
Data Semantics: Stable
Dependency Class: Common

View File

@ -0,0 +1,60 @@
#
# 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.
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
#
#
# Test the output of unstable translations.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
$dtrace -v -s /dev/stdin <<EOF
#pragma D option quiet
inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread);
BEGIN
{
this->a = myinfo->pr_flag;
exit(0);
}
BEGIN
{
exit(1);
}
EOF
exit $?

View File

@ -0,0 +1,14 @@
Stability attributes for script /dev/stdin:
Minimum Probe Description Attributes
Identifier Names: Unstable
Data Semantics: Unstable
Dependency Class: Common
Minimum Statement Attributes
Identifier Names: Private
Data Semantics: Private
Dependency Class: Unknown

View File

@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
* Make sure we can scope types with modifiers.
*/
BEGIN
{
trace((D`int *)0);
trace((const D`int *)0);
exit(0);
}

View File

@ -57,6 +57,7 @@
#include <sys/fs/zfs.h>
#include <sys/types.h>
#include <time.h>
#include <err.h>
#include <libzfs.h>
#include <libzfs_core.h>
@ -3530,6 +3531,12 @@ zfs_snapshot_cb(zfs_handle_t *zhp, void *arg)
int rv = 0;
int error;
if (sd->sd_recursive &&
zfs_prop_get_int(zhp, ZFS_PROP_INCONSISTENT) != 0) {
zfs_close(zhp);
return (0);
}
error = asprintf(&name, "%s@%s", zfs_get_name(zhp), sd->sd_snapname);
if (error == -1)
nomem();

View File

@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
@ -186,6 +186,7 @@ static const ztest_shared_opts_t ztest_opts_defaults = {
extern uint64_t metaslab_gang_bang;
extern uint64_t metaslab_df_alloc_threshold;
extern uint64_t zfs_deadman_synctime;
static ztest_shared_opts_t *ztest_shared_opts;
static ztest_shared_opts_t ztest_opts;
@ -365,7 +366,7 @@ ztest_info_t ztest_info[] = {
{ ztest_fault_inject, 1, &zopt_sometimes },
{ ztest_ddt_repair, 1, &zopt_sometimes },
{ ztest_dmu_snapshot_hold, 1, &zopt_sometimes },
{ ztest_reguid, 1, &zopt_sometimes },
{ ztest_reguid, 1, &zopt_rarely },
{ ztest_spa_rename, 1, &zopt_rarely },
{ ztest_scrub, 1, &zopt_rarely },
{ ztest_spa_upgrade, 1, &zopt_rarely },
@ -768,6 +769,16 @@ ztest_kill(ztest_shared_t *zs)
{
zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(ztest_spa));
zs->zs_space = metaslab_class_get_space(spa_normal_class(ztest_spa));
/*
* Before we kill off ztest, make sure that the config is updated.
* See comment above spa_config_sync().
*/
mutex_enter(&spa_namespace_lock);
spa_config_sync(ztest_spa, B_FALSE, B_FALSE);
mutex_exit(&spa_namespace_lock);
zfs_dbgmsg_print(FTAG);
(void) kill(getpid(), SIGKILL);
}
@ -2732,7 +2743,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
uint64_t leaf, top;
uint64_t ashift = ztest_get_ashift();
uint64_t oldguid, pguid;
size_t oldsize, newsize;
uint64_t oldsize, newsize;
char oldpath[MAXPATHLEN], newpath[MAXPATHLEN];
int replacing;
int oldvd_has_siblings = B_FALSE;
@ -2891,8 +2902,8 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
if (error != expected_error && expected_error != EBUSY) {
fatal(0, "attach (%s %llu, %s %llu, %d) "
"returned %d, expected %d",
oldpath, (longlong_t)oldsize, newpath,
(longlong_t)newsize, replacing, error, expected_error);
oldpath, oldsize, newpath,
newsize, replacing, error, expected_error);
}
VERIFY(mutex_unlock(&ztest_vdev_lock) == 0);
@ -3606,6 +3617,9 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
else
dmu_tx_hold_write(tx, bigobj, bigoff, bigsize);
/* This accounts for setting the checksum/compression. */
dmu_tx_hold_bonus(tx, bigobj);
txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG);
if (txg == 0) {
umem_free(packbuf, packsize);
@ -4755,6 +4769,14 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
ASSERT(leaves >= 1);
/*
* Grab the name lock as reader. There are some operations
* which don't like to have their vdevs changed while
* they are in progress (i.e. spa_change_guid). Those
* operations will have grabbed the name lock as writer.
*/
(void) rw_rdlock(&ztest_name_lock);
/*
* We need SCL_STATE here because we're going to look at vd0->vdev_tsd.
*/
@ -4784,7 +4806,14 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
if (vd0 != NULL && vd0->vdev_top->vdev_islog)
islog = B_TRUE;
if (vd0 != NULL && maxfaults != 1) {
/*
* If the top-level vdev needs to be resilvered
* then we only allow faults on the device that is
* resilvering.
*/
if (vd0 != NULL && maxfaults != 1 &&
(!vdev_resilver_needed(vd0->vdev_top, NULL, NULL) ||
vd0->vdev_resilver_txg != 0)) {
/*
* Make vd0 explicitly claim to be unreadable,
* or unwriteable, or reach behind its back
@ -4815,6 +4844,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
if (sav->sav_count == 0) {
spa_config_exit(spa, SCL_STATE, FTAG);
(void) rw_unlock(&ztest_name_lock);
return;
}
vd0 = sav->sav_vdevs[ztest_random(sav->sav_count)];
@ -4828,6 +4858,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
}
spa_config_exit(spa, SCL_STATE, FTAG);
(void) rw_unlock(&ztest_name_lock);
/*
* If we can tolerate two or more faults, or we're dealing
@ -5293,16 +5324,33 @@ static void *
ztest_deadman_thread(void *arg)
{
ztest_shared_t *zs = arg;
int grace = 300;
hrtime_t delta;
spa_t *spa = ztest_spa;
hrtime_t delta, total = 0;
delta = (zs->zs_thread_stop - zs->zs_thread_start) / NANOSEC + grace;
for (;;) {
delta = (zs->zs_thread_stop - zs->zs_thread_start) /
NANOSEC + zfs_deadman_synctime;
(void) poll(NULL, 0, (int)(1000 * delta));
(void) poll(NULL, 0, (int)(1000 * delta));
fatal(0, "failed to complete within %d seconds of deadline", grace);
/*
* If the pool is suspended then fail immediately. Otherwise,
* check to see if the pool is making any progress. If
* vdev_deadman() discovers that there hasn't been any recent
* I/Os then it will end up aborting the tests.
*/
if (spa_suspended(spa)) {
fatal(0, "aborting test after %llu seconds because "
"pool has transitioned to a suspended state.",
zfs_deadman_synctime);
return (NULL);
}
vdev_deadman(spa->spa_root_vdev);
return (NULL);
total += zfs_deadman_synctime;
(void) printf("ztest has been running for %lld seconds\n",
total);
}
}
static void
@ -5616,6 +5664,7 @@ ztest_run(ztest_shared_t *zs)
zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(spa));
zs->zs_space = metaslab_class_get_space(spa_normal_class(spa));
zfs_dbgmsg_print(FTAG);
umem_free(tid, ztest_opts.zo_threads * sizeof (thread_t));
@ -6031,6 +6080,7 @@ main(int argc, char **argv)
(void) setvbuf(stdout, NULL, _IOLBF, 0);
dprintf_setup(&argc, argv);
zfs_deadman_synctime = 300;
ztest_fd_rand = open("/dev/urandom", O_RDONLY);
ASSERT3S(ztest_fd_rand, >=, 0);

View File

@ -26,6 +26,7 @@
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
#include <stdlib.h>
@ -894,33 +895,14 @@ dt_aggregate_valcmp(const void *lhs, const void *rhs)
caddr_t rdata = rh->dtahe_data.dtada_data;
dtrace_recdesc_t *lrec, *rrec;
int64_t *laddr, *raddr;
int rval, i;
int rval;
if ((rval = dt_aggregate_hashcmp(lhs, rhs)) != 0)
return (rval);
assert(lagg->dtagd_nrecs == ragg->dtagd_nrecs);
if (lagg->dtagd_nrecs > ragg->dtagd_nrecs)
return (DT_GREATERTHAN);
lrec = &lagg->dtagd_rec[lagg->dtagd_nrecs - 1];
rrec = &ragg->dtagd_rec[ragg->dtagd_nrecs - 1];
if (lagg->dtagd_nrecs < ragg->dtagd_nrecs)
return (DT_LESSTHAN);
for (i = 0; i < lagg->dtagd_nrecs; i++) {
lrec = &lagg->dtagd_rec[i];
rrec = &ragg->dtagd_rec[i];
if (lrec->dtrd_offset < rrec->dtrd_offset)
return (DT_LESSTHAN);
if (lrec->dtrd_offset > rrec->dtrd_offset)
return (DT_GREATERTHAN);
if (lrec->dtrd_action < rrec->dtrd_action)
return (DT_LESSTHAN);
if (lrec->dtrd_action > rrec->dtrd_action)
return (DT_GREATERTHAN);
}
assert(lrec->dtrd_action == rrec->dtrd_action);
laddr = (int64_t *)(uintptr_t)(ldata + lrec->dtrd_offset);
raddr = (int64_t *)(uintptr_t)(rdata + rrec->dtrd_offset);

View File

@ -22,7 +22,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, Joyent Inc. All rights reserved.
* Copyright (c) 2011 by Delphix. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
@ -664,62 +664,53 @@ static void
dt_action_trace(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
{
dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
boolean_t istrace = (dnp->dn_ident->di_id == DT_ACT_TRACE);
const char *act = istrace ? "trace" : "print";
if (dt_node_is_void(dnp->dn_args)) {
dnerror(dnp->dn_args, D_TRACE_VOID,
"trace( ) may not be applied to a void expression\n");
dnerror(dnp->dn_args, istrace ? D_TRACE_VOID : D_PRINT_VOID,
"%s( ) may not be applied to a void expression\n", act);
}
if (dt_node_is_dynamic(dnp->dn_args)) {
dnerror(dnp->dn_args, D_TRACE_DYN,
"trace( ) may not be applied to a dynamic expression\n");
if (dt_node_resolve(dnp->dn_args, DT_IDENT_XLPTR) != NULL) {
dnerror(dnp->dn_args, istrace ? D_TRACE_DYN : D_PRINT_DYN,
"%s( ) may not be applied to a translated pointer\n", act);
}
dt_cg(yypcb, dnp->dn_args);
ap->dtad_difo = dt_as(yypcb);
ap->dtad_kind = DTRACEACT_DIFEXPR;
}
/*
* The print() action behaves identically to trace(), except that it stores the
* CTF type of the argument (if present) within the DOF for the DIFEXPR action.
* To do this, we set the 'dtsd_strdata' to point to the fully-qualified CTF
* type ID for the result of the DIF action. We use the ID instead of the name
* to handles complex types like arrays and function pointers that can't be
* resolved by ctf_type_lookup(). This is later processed by
* dtrace_dof_create() and turned into a reference into the string table so
* that we can get the type information when we process the data after the
* fact.
*/
static void
dt_action_print(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
{
dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
dt_node_t *dret;
size_t len;
dt_module_t *dmp;
if (dt_node_is_void(dnp->dn_args)) {
dnerror(dnp->dn_args, D_PRINT_VOID,
"print( ) may not be applied to a void expression\n");
}
if (dt_node_is_dynamic(dnp->dn_args)) {
dnerror(dnp->dn_args, D_PRINT_DYN,
"print( ) may not be applied to a dynamic expression\n");
if (dnp->dn_args->dn_kind == DT_NODE_AGG) {
dnerror(dnp->dn_args, istrace ? D_TRACE_AGG : D_PRINT_AGG,
"%s( ) may not be applied to an aggregation%s\n", act,
istrace ? "" : " -- did you mean printa()?");
}
dt_cg(yypcb, dnp->dn_args);
dret = yypcb->pcb_dret;
dmp = dt_module_lookup_by_ctf(dtp, dret->dn_ctfp);
/*
* The print() action behaves identically to trace(), except that it
* stores the CTF type of the argument (if present) within the DOF for
* the DIFEXPR action. To do this, we set the 'dtsd_strdata' to point
* to the fully-qualified CTF type ID for the result of the DIF
* action. We use the ID instead of the name to handles complex types
* like arrays and function pointers that can't be resolved by
* ctf_type_lookup(). This is later processed by dtrace_dof_create()
* and turned into a reference into the string table so that we can
* get the type information when we process the data after the fact.
*/
if (dnp->dn_ident->di_id == DT_ACT_PRINT) {
dt_node_t *dret;
size_t n;
dt_module_t *dmp;
len = snprintf(NULL, 0, "%s`%ld", dmp->dm_name, dret->dn_type) + 1;
sdp->dtsd_strdata = dt_alloc(dtp, len);
if (sdp->dtsd_strdata == NULL)
longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
(void) snprintf(sdp->dtsd_strdata, len, "%s`%ld", dmp->dm_name,
dret->dn_type);
dret = yypcb->pcb_dret;
dmp = dt_module_lookup_by_ctf(dtp, dret->dn_ctfp);
n = snprintf(NULL, 0, "%s`%ld", dmp->dm_name, dret->dn_type) + 1;
sdp->dtsd_strdata = dt_alloc(dtp, n);
if (sdp->dtsd_strdata == NULL)
longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
(void) snprintf(sdp->dtsd_strdata, n, "%s`%ld", dmp->dm_name,
dret->dn_type);
}
ap->dtad_difo = dt_as(yypcb);
ap->dtad_kind = DTRACEACT_DIFEXPR;
@ -1145,6 +1136,9 @@ dt_compile_fun(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
case DT_ACT_PANIC:
dt_action_panic(dtp, dnp->dn_expr, sdp);
break;
case DT_ACT_PRINT:
dt_action_trace(dtp, dnp->dn_expr, sdp);
break;
case DT_ACT_PRINTA:
dt_action_printa(dtp, dnp->dn_expr, sdp);
break;
@ -1181,9 +1175,6 @@ dt_compile_fun(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
case DT_ACT_TRACE:
dt_action_trace(dtp, dnp->dn_expr, sdp);
break;
case DT_ACT_PRINT:
dt_action_print(dtp, dnp->dn_expr, sdp);
break;
case DT_ACT_TRACEMEM:
dt_action_tracemem(dtp, dnp->dn_expr, sdp);
break;
@ -2559,7 +2550,8 @@ dt_compile(dtrace_hdl_t *dtp, int context, dtrace_probespec_t pspec, void *arg,
}
out:
if (context != DT_CTX_DTYPE && DT_TREEDUMP_PASS(dtp, 3))
if (context != DT_CTX_DTYPE && yypcb->pcb_root != NULL &&
DT_TREEDUMP_PASS(dtp, 3))
dt_node_printr(yypcb->pcb_root, stderr, 0);
if (dtp->dt_cdefs_fd != -1 && (ftruncate64(dtp->dt_cdefs_fd, 0) == -1 ||

View File

@ -1387,6 +1387,162 @@ dt_cg_func_typeref(dtrace_hdl_t *dtp, dt_node_t *dnp)
typs->dn_value = ctf_type_size(dtt.dtt_ctfp, dtt.dtt_type);
}
typedef struct dt_xlmemb {
dt_ident_t *dtxl_idp; /* translated ident */
dt_irlist_t *dtxl_dlp; /* instruction list */
dt_regset_t *dtxl_drp; /* register set */
int dtxl_sreg; /* location of the translation input */
int dtxl_dreg; /* location of our allocated buffer */
} dt_xlmemb_t;
/*ARGSUSED*/
static int
dt_cg_xlate_member(const char *name, ctf_id_t type, ulong_t off, void *arg)
{
dt_xlmemb_t *dx = arg;
dt_ident_t *idp = dx->dtxl_idp;
dt_irlist_t *dlp = dx->dtxl_dlp;
dt_regset_t *drp = dx->dtxl_drp;
dt_node_t *mnp;
dt_xlator_t *dxp;
int reg, treg;
uint32_t instr;
size_t size;
/* Generate code for the translation. */
dxp = idp->di_data;
mnp = dt_xlator_member(dxp, name);
/* If there's no translator for the given member, skip it. */
if (mnp == NULL)
return (0);
dxp->dx_ident->di_flags |= DT_IDFLG_CGREG;
dxp->dx_ident->di_id = dx->dtxl_sreg;
dt_cg_node(mnp->dn_membexpr, dlp, drp);
dxp->dx_ident->di_flags &= ~DT_IDFLG_CGREG;
dxp->dx_ident->di_id = 0;
treg = mnp->dn_membexpr->dn_reg;
/* Compute the offset into our buffer and store the result there. */
reg = dt_regset_alloc(drp);
dt_cg_setx(dlp, reg, off / NBBY);
instr = DIF_INSTR_FMT(DIF_OP_ADD, dx->dtxl_dreg, reg, reg);
dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
size = ctf_type_size(mnp->dn_membexpr->dn_ctfp,
mnp->dn_membexpr->dn_type);
if (dt_node_is_scalar(mnp->dn_membexpr)) {
/*
* Copying scalars is simple.
*/
switch (size) {
case 1:
instr = DIF_INSTR_STORE(DIF_OP_STB, treg, reg);
break;
case 2:
instr = DIF_INSTR_STORE(DIF_OP_STH, treg, reg);
break;
case 4:
instr = DIF_INSTR_STORE(DIF_OP_STW, treg, reg);
break;
case 8:
instr = DIF_INSTR_STORE(DIF_OP_STX, treg, reg);
break;
default:
xyerror(D_UNKNOWN, "internal error -- unexpected "
"size: %lu\n", (ulong_t)size);
}
dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
} else if (dt_node_is_string(mnp->dn_membexpr)) {
int szreg;
/*
* Use the copys instruction for strings.
*/
szreg = dt_regset_alloc(drp);
dt_cg_setx(dlp, szreg, size);
instr = DIF_INSTR_COPYS(treg, szreg, reg);
dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
dt_regset_free(drp, szreg);
} else {
int szreg;
/*
* If it's anything else then we'll just bcopy it.
*/
szreg = dt_regset_alloc(drp);
dt_cg_setx(dlp, szreg, size);
dt_irlist_append(dlp,
dt_cg_node_alloc(DT_LBL_NONE, DIF_INSTR_FLUSHTS));
instr = DIF_INSTR_PUSHTS(DIF_OP_PUSHTV, DIF_TYPE_CTF,
DIF_REG_R0, treg);
dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
instr = DIF_INSTR_PUSHTS(DIF_OP_PUSHTV, DIF_TYPE_CTF,
DIF_REG_R0, reg);
dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
instr = DIF_INSTR_PUSHTS(DIF_OP_PUSHTV, DIF_TYPE_CTF,
DIF_REG_R0, szreg);
dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
instr = DIF_INSTR_CALL(DIF_SUBR_BCOPY, szreg);
dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
dt_regset_free(drp, szreg);
}
dt_regset_free(drp, reg);
dt_regset_free(drp, treg);
return (0);
}
/*
* If we're expanding a translated type, we create an appropriately sized
* buffer with alloca() and then translate each member into it.
*/
static int
dt_cg_xlate_expand(dt_node_t *dnp, dt_ident_t *idp, dt_irlist_t *dlp,
dt_regset_t *drp)
{
dt_xlmemb_t dlm;
uint32_t instr;
int dreg;
size_t size;
dreg = dt_regset_alloc(drp);
size = ctf_type_size(dnp->dn_ident->di_ctfp, dnp->dn_ident->di_type);
/* Call alloca() to create the buffer. */
dt_cg_setx(dlp, dreg, size);
dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, DIF_INSTR_FLUSHTS));
instr = DIF_INSTR_PUSHTS(DIF_OP_PUSHTV, DIF_TYPE_CTF, DIF_REG_R0, dreg);
dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
instr = DIF_INSTR_CALL(DIF_SUBR_ALLOCA, dreg);
dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
/* Generate the translation for each member. */
dlm.dtxl_idp = idp;
dlm.dtxl_dlp = dlp;
dlm.dtxl_drp = drp;
dlm.dtxl_sreg = dnp->dn_reg;
dlm.dtxl_dreg = dreg;
(void) ctf_member_iter(dnp->dn_ident->di_ctfp,
dnp->dn_ident->di_type, dt_cg_xlate_member,
&dlm);
return (dreg);
}
static void
dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
{
@ -1600,7 +1756,16 @@ dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
dt_cg_node(dnp->dn_child, dlp, drp);
dnp->dn_reg = dnp->dn_child->dn_reg;
if (!(dnp->dn_flags & DT_NF_REF)) {
if (dt_node_is_dynamic(dnp->dn_child)) {
int reg;
idp = dt_node_resolve(dnp->dn_child, DT_IDENT_XLPTR);
assert(idp != NULL);
reg = dt_cg_xlate_expand(dnp, idp, dlp, drp);
dt_regset_free(drp, dnp->dn_child->dn_reg);
dnp->dn_reg = reg;
} else if (!(dnp->dn_flags & DT_NF_REF)) {
uint_t ubit = dnp->dn_flags & DT_NF_USERLAND;
/*
@ -1998,6 +2163,13 @@ dt_cg(dt_pcb_t *pcb, dt_node_t *dnp)
dt_cg_node(dnp, &pcb->pcb_ir, pcb->pcb_regs);
if ((idp = dt_node_resolve(dnp, DT_IDENT_XLSOU)) != NULL) {
int reg = dt_cg_xlate_expand(dnp, idp,
&pcb->pcb_ir, pcb->pcb_regs);
dt_regset_free(pcb->pcb_regs, dnp->dn_reg);
dnp->dn_reg = reg;
}
instr = DIF_INSTR_RET(dnp->dn_reg);
dt_regset_free(pcb->pcb_regs, dnp->dn_reg);
dt_irlist_append(&pcb->pcb_ir, dt_cg_node_alloc(DT_LBL_NONE, instr));

View File

@ -2018,13 +2018,13 @@ dt_consume_cpu(dtrace_hdl_t *dtp, FILE *fp, int cpu,
uint64_t tracememsize = 0;
dtrace_probedata_t data;
uint64_t drops;
data.dtpda_flow = dtp->dt_flow;
data.dtpda_indent = dtp->dt_indent;
data.dtpda_prefix = dtp->dt_prefix;
bzero(&data, sizeof (data));
data.dtpda_handle = dtp;
data.dtpda_cpu = cpu;
data.dtpda_flow = dtp->dt_flow;
data.dtpda_indent = dtp->dt_indent;
data.dtpda_prefix = dtp->dt_prefix;
for (offs = buf->dtbd_oldest; offs < buf->dtbd_size; ) {
dtrace_eprobedesc_t *epd;
@ -2611,7 +2611,7 @@ typedef struct dt_begin {
static int
dt_consume_begin_probe(const dtrace_probedata_t *data, void *arg)
{
dt_begin_t *begin = (dt_begin_t *)arg;
dt_begin_t *begin = arg;
dtrace_probedesc_t *pd = data->dtpda_pdesc;
int r1 = (strcmp(pd->dtpd_provider, "dtrace") == 0);
@ -2636,7 +2636,7 @@ static int
dt_consume_begin_record(const dtrace_probedata_t *data,
const dtrace_recdesc_t *rec, void *arg)
{
dt_begin_t *begin = (dt_begin_t *)arg;
dt_begin_t *begin = arg;
return (begin->dtbgn_recfunc(data, rec, begin->dtbgn_arg));
}

View File

@ -21,6 +21,7 @@
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Use is subject to license terms.
*/
@ -254,11 +255,6 @@ dt_decl_spec(ushort_t kind, char *name)
ddp->dd_kind = kind;
ddp->dd_name = name;
if (name != NULL && strchr(name, '`') != NULL) {
xyerror(D_DECL_SCOPE, "D scoping operator may not be used "
"in a type name\n");
}
return (dt_decl_check(ddp));
}

View File

@ -18,6 +18,7 @@
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.

View File

@ -190,8 +190,10 @@ typedef enum {
D_PRINTA_AGGPROTO, /* printa() aggregation mismatch */
D_TRACE_VOID, /* trace() argument has void type */
D_TRACE_DYN, /* trace() argument has dynamic type */
D_TRACE_AGG, /* trace() argument is an aggregation */
D_PRINT_VOID, /* print() argument has void type */
D_PRINT_DYN, /* print() argument has dynamic type */
D_PRINT_AGG, /* print() argument is an aggregation */
D_TRACEMEM_ADDR, /* tracemem() address bad type */
D_TRACEMEM_SIZE, /* tracemem() size bad type */
D_TRACEMEM_ARGS, /* tracemem() illegal number of args */

View File

@ -468,7 +468,6 @@ enum {
EDT_VERSREDUCED, /* requested API version has been reduced */
EDT_CTF, /* libctf called failed (dt_ctferr has more) */
EDT_COMPILER, /* error in D program compilation */
EDT_NOREG, /* register allocation failure */
EDT_NOTUPREG, /* tuple register allocation failure */
EDT_NOMEM, /* memory allocation failure */
EDT_INT2BIG, /* integer limit exceeded */

View File

@ -1086,7 +1086,17 @@ dt_vopen(int version, int flags, int *errp,
dtfd = open("/dev/dtrace/dtrace", O_RDWR);
err = errno; /* save errno from opening dtfd */
#if defined(__FreeBSD__)
/*
* Automatically load the 'dtraceall' module if we couldn't open the
* char device.
*/
if (err == ENOENT && modfind("dtraceall") < 0) {
kldload("dtraceall"); /* ignore the error */
dtfd = open("/dev/dtrace/dtrace", O_RDWR);
err = errno;
}
#endif
#if defined(sun)
ftfd = open("/dev/dtrace/provider/fasttrap", O_RDWR);
#else

View File

@ -23,6 +23,7 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2011, Joyent Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@ -96,6 +97,7 @@
*/
#include <sys/param.h>
#include <sys/sysmacros.h>
#include <limits.h>
#include <setjmp.h>
#include <strings.h>
@ -1862,6 +1864,38 @@ dt_node_op1(int op, dt_node_t *cp)
return (dnp);
}
/*
* If an integer constant is being cast to another integer type, we can
* perform the cast as part of integer constant folding in this pass. We must
* take action when the integer is being cast to a smaller type or if it is
* changing signed-ness. If so, we first shift rp's bits bits high (losing
* excess bits if narrowing) and then shift them down with either a logical
* shift (unsigned) or arithmetic shift (signed).
*/
static void
dt_cast(dt_node_t *lp, dt_node_t *rp)
{
size_t srcsize = dt_node_type_size(rp);
size_t dstsize = dt_node_type_size(lp);
if (dstsize < srcsize) {
int n = (sizeof (uint64_t) - dstsize) * NBBY;
rp->dn_value <<= n;
rp->dn_value >>= n;
} else if (dstsize > srcsize) {
int n = (sizeof (uint64_t) - srcsize) * NBBY;
int s = (dstsize - srcsize) * NBBY;
rp->dn_value <<= n;
if (rp->dn_flags & DT_NF_SIGNED) {
rp->dn_value = (intmax_t)rp->dn_value >> s;
rp->dn_value >>= n - s;
} else {
rp->dn_value >>= n;
}
}
}
dt_node_t *
dt_node_op2(int op, dt_node_t *lp, dt_node_t *rp)
{
@ -2011,32 +2045,9 @@ dt_node_op2(int op, dt_node_t *lp, dt_node_t *rp)
}
}
/*
* If an integer constant is being cast to another integer type, we can
* perform the cast as part of integer constant folding in this pass.
* We must take action when the integer is being cast to a smaller type
* or if it is changing signed-ness. If so, we first shift rp's bits
* bits high (losing excess bits if narrowing) and then shift them down
* with either a logical shift (unsigned) or arithmetic shift (signed).
*/
if (op == DT_TOK_LPAR && rp->dn_kind == DT_NODE_INT &&
dt_node_is_integer(lp)) {
size_t srcsize = dt_node_type_size(rp);
size_t dstsize = dt_node_type_size(lp);
if ((dstsize < srcsize) || ((lp->dn_flags & DT_NF_SIGNED) ^
(rp->dn_flags & DT_NF_SIGNED))) {
int n = dstsize < srcsize ?
(sizeof (uint64_t) * NBBY - dstsize * NBBY) :
(sizeof (uint64_t) * NBBY - srcsize * NBBY);
rp->dn_value <<= n;
if (lp->dn_flags & DT_NF_SIGNED)
rp->dn_value = (intmax_t)rp->dn_value >> n;
else
rp->dn_value = rp->dn_value >> n;
}
dt_cast(lp, rp);
dt_node_type_propagate(lp, rp);
dt_node_attr_assign(rp, dt_attr_min(lp->dn_attr, rp->dn_attr));
dt_node_free(lp);
@ -2895,14 +2906,14 @@ dt_cook_op1(dt_node_t *dnp, uint_t idflags)
case DT_TOK_DEREF:
/*
* If the deref operator is applied to a translated pointer,
* we can just set our output type to the base translation.
* we set our output type to the output of the translation.
*/
if ((idp = dt_node_resolve(cp, DT_IDENT_XLPTR)) != NULL) {
dt_xlator_t *dxp = idp->di_data;
dnp->dn_ident = &dxp->dx_souid;
dt_node_type_assign(dnp,
DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp));
dnp->dn_ident->di_ctfp, dnp->dn_ident->di_type);
break;
}
@ -3078,6 +3089,31 @@ dt_cook_op1(dt_node_t *dnp, uint_t idflags)
return (dnp);
}
static void
dt_assign_common(dt_node_t *dnp)
{
dt_node_t *lp = dnp->dn_left;
dt_node_t *rp = dnp->dn_right;
int op = dnp->dn_op;
if (rp->dn_kind == DT_NODE_INT)
dt_cast(lp, rp);
if (!(lp->dn_flags & DT_NF_LVALUE)) {
xyerror(D_OP_LVAL, "operator %s requires modifiable "
"lvalue as an operand\n", opstr(op));
/* see K&R[A7.17] */
}
if (!(lp->dn_flags & DT_NF_WRITABLE)) {
xyerror(D_OP_WRITE, "operator %s can only be applied "
"to a writable variable\n", opstr(op));
}
dt_node_type_propagate(lp, dnp); /* see K&R[A7.17] */
dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr));
}
static dt_node_t *
dt_cook_op2(dt_node_t *dnp, uint_t idflags)
{
@ -3556,19 +3592,7 @@ dt_cook_op2(dt_node_t *dnp, uint_t idflags)
}
}
asgn_common:
if (!(lp->dn_flags & DT_NF_LVALUE)) {
xyerror(D_OP_LVAL, "operator %s requires modifiable "
"lvalue as an operand\n", opstr(op));
/* see K&R[A7.17] */
}
if (!(lp->dn_flags & DT_NF_WRITABLE)) {
xyerror(D_OP_WRITE, "operator %s can only be applied "
"to a writable variable\n", opstr(op));
}
dt_node_type_propagate(lp, dnp); /* see K&R[A7.17] */
dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr));
dt_assign_common(dnp);
break;
case DT_TOK_PTR:
@ -3873,6 +3897,14 @@ dt_cook_op2(dt_node_t *dnp, uint_t idflags)
dt_node_type_propagate(lp, dnp); /* see K&R[A7.5] */
dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr));
/*
* If it's a pointer then should be able to (attempt to)
* assign to it.
*/
if (lkind == CTF_K_POINTER)
dnp->dn_flags |= DT_NF_WRITABLE;
break;
}

View File

@ -22,6 +22,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
#if defined(sun)
@ -161,7 +162,7 @@ static int
pfcheck_dint(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
{
if (dnp->dn_flags & DT_NF_SIGNED)
pfd->pfd_flags |= DT_PFCONV_SIGNED;
pfd->pfd_fmt[strlen(pfd->pfd_fmt) - 1] = 'i';
else
pfd->pfd_fmt[strlen(pfd->pfd_fmt) - 1] = 'u';
@ -664,7 +665,7 @@ static const dt_pfconv_t _dtrace_conversions[] = {
{ "hu", "u", "unsigned short", pfcheck_type, pfprint_uint },
{ "hx", "x", "short", pfcheck_xshort, pfprint_uint },
{ "hX", "X", "short", pfcheck_xshort, pfprint_uint },
{ "i", "i", pfproto_xint, pfcheck_dint, pfprint_dint },
{ "i", "i", pfproto_xint, pfcheck_xint, pfprint_sint },
{ "I", "s", pfproto_cstr, pfcheck_str, pfprint_inetaddr },
{ "k", "s", "stack", pfcheck_stack, pfprint_stack },
{ "lc", "lc", "int", pfcheck_type, pfprint_sint }, /* a.k.a. wint_t */

View File

@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
* Use is subject to license terms.
*/
@ -617,8 +618,8 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, const char *format, ...)
size_t avail;
/*
* It's not legal to use buffered ouput if there is not a
* handler for buffered output.
* Using buffered output is not allowed if a handler has
* not been installed.
*/
if (dtp->dt_bufhdlr == NULL) {
va_end(ap);

View File

@ -24,6 +24,10 @@
* Use is subject to license terms.
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
@ -525,7 +529,8 @@ dt_instr_size(uchar_t *instr, dtrace_hdl_t *dtp, pid_t pid, uintptr_t addr,
* another debugger attached to this process. The original instruction
* can't be recovered so this must fail.
*/
if (x86dis.d86_len == 1 && instr[0] == FASTTRAP_INSTR)
if (x86dis.d86_len == 1 &&
(uchar_t)x86dis.d86_bytes[0] == FASTTRAP_INSTR)
return (-1);
return (x86dis.d86_len);

View File

@ -1885,6 +1885,10 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
zcmd_free_nvlists(&zc);
break;
case ZFS_PROP_INCONSISTENT:
*val = zhp->zfs_dmustats.dds_inconsistent;
break;
default:
switch (zfs_prop_get_type(prop)) {
case PROP_TYPE_NUMBER:
@ -3379,13 +3383,16 @@ zfs_snapshot_cb(zfs_handle_t *zhp, void *arg)
char name[ZFS_MAXNAMELEN];
int rv = 0;
(void) snprintf(name, sizeof (name),
"%s@%s", zfs_get_name(zhp), sd->sd_snapname);
if (zfs_prop_get_int(zhp, ZFS_PROP_INCONSISTENT) == 0) {
(void) snprintf(name, sizeof (name),
"%s@%s", zfs_get_name(zhp), sd->sd_snapname);
fnvlist_add_boolean(sd->sd_nvl, name);
fnvlist_add_boolean(sd->sd_nvl, name);
rv = zfs_iter_filesystems(zhp, zfs_snapshot_cb, sd);
rv = zfs_iter_filesystems(zhp, zfs_snapshot_cb, sd);
}
zfs_close(zhp);
return (rv);
}

View File

@ -1576,8 +1576,8 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
if (tid != 0) {
if (err != 0)
(void) pthread_cancel(tid);
(void) pthread_join(tid, NULL);
(void) close(pipefd[0]);
(void) pthread_join(tid, NULL);
}
if (sdd.cleanup_fd != -1) {
@ -1613,8 +1613,8 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
VERIFY(0 == close(sdd.cleanup_fd));
if (tid != 0) {
(void) pthread_cancel(tid);
(void) pthread_join(tid, NULL);
(void) close(pipefd[0]);
(void) pthread_join(tid, NULL);
}
return (err);
}

View File

@ -52,6 +52,8 @@ static char *curfile;
#define CTF_BUF_CHUNK_SIZE (64 * 1024)
#define RES_BUF_CHUNK_SIZE (64 * 1024)
static int ntypes = 0; /* The number of types. */
struct ctf_buf {
strtab_t ctb_strtab; /* string table */
caddr_t ctb_base; /* pointer to base of buffer */
@ -1143,6 +1145,10 @@ resurrect_types(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
(*mpp)->ml_type = tdarr[ctm->ctm_type];
(*mpp)->ml_offset = ctm->ctm_offset;
(*mpp)->ml_size = 0;
if (ctm->ctm_type > ntypes) {
parseterminate("Invalid member type ctm_type=%d",
ctm->ctm_type);
}
}
} else {
for (i = 0, mpp = &tdp->t_members; i < vlen;
@ -1159,6 +1165,10 @@ resurrect_types(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
(*mpp)->ml_offset =
(int)CTF_LMEM_OFFSET(ctlm);
(*mpp)->ml_size = 0;
if (ctlm->ctlm_type > ntypes) {
parseterminate("Invalid lmember type ctlm_type=%d",
ctlm->ctlm_type);
}
}
}
@ -1272,9 +1282,10 @@ ctf_parse(ctf_header_t *h, caddr_t buf, symit_data_t *si, char *label)
{
tdata_t *td = tdata_new();
tdesc_t **tdarr;
int ntypes = count_types(h, buf);
int idx, i;
ntypes = count_types(h, buf);
/* shudder */
tdarr = xcalloc(sizeof (tdesc_t *) * (ntypes + 1));
tdarr[0] = NULL;

View File

@ -159,7 +159,7 @@ typedef struct ardef {
/* Auxiliary structure for structure/union tdesc_t */
typedef struct mlist {
int ml_offset; /* Offset from start of structure (in bits) */
int ml_size; /* Member size (in bits) */
uint_t ml_size; /* Member size (in bits) */
char *ml_name; /* Member name */
struct tdesc *ml_type; /* Member type */
struct mlist *ml_next; /* Next member */

View File

@ -674,6 +674,13 @@ die_array_create(dwarf_t *dw, Dwarf_Die arr, Dwarf_Off off, tdesc_t *tdp)
tdesc_t *dimtdp;
int flags;
/* Check for bogus gcc DW_AT_byte_size attribute */
if (uval == (unsigned)-1) {
printf("dwarf.c:%s() working around bogus -1 DW_AT_byte_size\n",
__func__);
uval = 0;
}
tdp->t_size = uval;
/*
@ -760,6 +767,12 @@ die_enum_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
tdp->t_type = ENUM;
(void) die_unsigned(dw, die, DW_AT_byte_size, &uval, DW_ATTR_REQ);
/* Check for bogus gcc DW_AT_byte_size attribute */
if (uval == (unsigned)-1) {
printf("dwarf.c:%s() working around bogus -1 DW_AT_byte_size\n",
__func__);
uval = 0;
}
tdp->t_size = uval;
if ((mem = die_child(dw, die)) != NULL) {
@ -873,7 +886,7 @@ static void
die_sou_create(dwarf_t *dw, Dwarf_Die str, Dwarf_Off off, tdesc_t *tdp,
int type, const char *typename)
{
Dwarf_Unsigned sz, bitsz, bitoff;
Dwarf_Unsigned sz, bitsz, bitoff, maxsz=0;
Dwarf_Die mem;
mlist_t *ml, **mlastp;
iidesc_t *ii;
@ -929,6 +942,8 @@ die_sou_create(dwarf_t *dw, Dwarf_Die str, Dwarf_Off off, tdesc_t *tdp,
ml->ml_name = NULL;
ml->ml_type = die_lookup_pass1(dw, mem, DW_AT_type);
debug(3, "die_sou_create(): ml_type = %p t_id = %d\n",
ml->ml_type, ml->ml_type->t_id);
if (die_mem_offset(dw, mem, DW_AT_data_member_location,
&mloff, 0)) {
@ -956,8 +971,24 @@ die_sou_create(dwarf_t *dw, Dwarf_Die str, Dwarf_Off off, tdesc_t *tdp,
*mlastp = ml;
mlastp = &ml->ml_next;
/* Find the size of the largest member to work around a gcc
* bug. See GCC Bugzilla 35998.
*/
if (maxsz < ml->ml_size)
maxsz = ml->ml_size;
} while ((mem = die_sibling(dw, mem)) != NULL);
/* See if we got a bogus DW_AT_byte_size. GCC will sometimes
* emit this.
*/
if (sz == (unsigned)-1) {
printf("dwarf.c:%s() working around bogus -1 DW_AT_byte_size\n",
__func__);
tdp->t_size = maxsz / 8; /* maxsz is in bits, t_size is bytes */
}
/*
* GCC will attempt to eliminate unused types, thus decreasing the
* size of the emitted dwarf. That is, if you declare a foo_t in your
@ -1054,7 +1085,7 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private)
}
if (ml->ml_size != 0 && mt->t_type == INTRINSIC &&
mt->t_intr->intr_nbits != ml->ml_size) {
mt->t_intr->intr_nbits != (int)ml->ml_size) {
/*
* This member is a bitfield, and needs to reference
* an intrinsic type with the same width. If the
@ -1370,6 +1401,13 @@ die_base_create(dwarf_t *dw, Dwarf_Die base, Dwarf_Off off, tdesc_t *tdp)
*/
(void) die_unsigned(dw, base, DW_AT_byte_size, &sz, DW_ATTR_REQ);
/* Check for bogus gcc DW_AT_byte_size attribute */
if (sz == (unsigned)-1) {
printf("dwarf.c:%s() working around bogus -1 DW_AT_byte_size\n",
__func__);
sz = 0;
}
if (tdp->t_name == NULL)
terminate("die %llu: base type without name\n", off);

View File

@ -952,7 +952,7 @@ soudef(char *cp, stabtype_t type, tdesc_t **rtdp)
itdp = find_intrinsic(tdp);
if (itdp->t_type == INTRINSIC) {
if (mlp->ml_size != itdp->t_intr->intr_nbits) {
if ((int)mlp->ml_size != itdp->t_intr->intr_nbits) {
parse_debug(4, cp, "making %d bit intrinsic "
"from %s", mlp->ml_size, tdesc_name(itdp));
mlp->ml_type = bitintrinsic(itdp, mlp->ml_size);
@ -1173,7 +1173,7 @@ resolve_typed_bitfields_cb(void *arg, void *private __unused)
while (tdp) {
switch (tdp->t_type) {
case INTRINSIC:
if (ml->ml_size != tdp->t_intr->intr_nbits) {
if ((int)ml->ml_size != tdp->t_intr->intr_nbits) {
debug(3, "making %d bit intrinsic from %s",
ml->ml_size, tdesc_name(tdp));
ml->ml_type = bitintrinsic(tdp, ml->ml_size);

View File

@ -1,45 +1,100 @@
-*- coding: utf-8 -*-
Changes with APR-Util 1.4.1
Changes with APR-util 1.5.2
*) Apply Windows build fixes for the apr_crypto API. [Mladen Turk]
*) Windows: Add command line makefiles. [Gregg Smith]
Changes with APR-util 1.4.0
*) apr_uri_parse(): Do not accept invalid characters in the scheme.
Per RFC 3986 3.3, enforce that the first segment of a relative path does
not contain a colon. PR 52479. [Stefan Fritsch]
*) apr_ldap_init: Pass secure=1 to ldapssl_init() with Solaris LDAP SDK.
PR: 42682 [Stefan Fritsch]
*) Fix memory leak in hook sorting function. PR 51256.
[<horowity checkpoint com>]
*) apr_memcache_server_create: Fix possible segfault. PR 51064.
[Michajlo Matijkiw <michajlo_matijkiw comcast com>]
*) Speedup md5 calculation by avoiding some copying on little endian
architectures. PR 49011. [Stefan Fritsch, Stefan Fuhrmann
<stefanfuhrmann alice-dsl de>]
*) apr_thread_pool: Fix thread unsafe pool usage. [Stefan Fritsch]
*) Use heap memory for crypt in apr_password_validate(), to reduce stack
usage. PR 54572. [Stefan Fritsch]
*) Do not include apr.h and apr_errno.h from system search path in
apu_errno.h. PR 46487 [Rainer Jung]
*) Fix password validation failure for all crypt and crypt_r based
algorithms. PR 54603. [Harvey Eneman <harvey.eneman oracle.com>]
*) Add optional dbm, openssl and nss subpackages to the RPM spec file.
[Graham Leggett]
*) Fix syntax error in crypto/apr_passwd.c on non-glibc systems. PR 54275.
[Stefan Fritsch]
*) apr_dbd_freetds: The sybdb.h header file might be freetds/sybdb.h
or sybdb.h. [Graham Leggett]
*) Fix potential data corruption in apr_brigade_write() and friends if
the last bucket of the brigade is a heap bucket that has been split,
and there are still references to the next part of the original bucket
in use. [Stefan Fritsch]
*) Add apr_crypto implementations for OpenSSL and Mozilla NSS. Add a unit
test to verify the interoperability of the two modules. Builds default
to disabled unless explicitly enabled.
[Graham Leggett]
*) Remove duplicated logic in apr_brigade_puts(). PR 53740. [Christophe
Jaillet <christophe jaillet wanadoo fr>]
*) Add the apr_crypto interface, a rewrite of the earlier apr_ssl code,
based on the modular dso interface used for dbd and ldap. Initially,
the interface supports symmetrical encryption and decryption. The
purpose of the interface is to offer portable and interoperable
access to basic crypto using the native crypto libraries present on
each platform. [Graham Leggett]
*) apr_crypto: If --with-crypto is passed to configure but no crypto
libraries are enabled, autodetect available libraries. [Jeff Trawick]
*) Add trace probes to hooks, making it easier to inspect APR Hook based
applications with DTrace or other such mechanisms.
[Theo Schlossnagle <jesus omniti.com>, generalized by Jeff Trawick]
*) memcache: Fix dead server retry logic. [Gavin Shelley <columbusmonkey me.com>]
*) Implement resource list when threads are unavailable. PR 24325
[Bojan Smojver]
Changes with APR-util 1.5.1
*) testmemcache: Fix crash. PR 52705. [Peter Poeml <peter poeml de>]
*) MinGW: Support shared builds of apr-util when apr is shared.
PR 46175. [Carlo Bramini <carlo.bramix libero.it>, Jeff Trawick]
*) Add support for Berkeley DB 5.2 and 5.3. Simplify detection script.
PR 53684. [Rainer Jung]
*) configure: Allow to specify library specific custom linker flags
via the LDADD_XXX variables. [Rainer Jung]
*) apr_password_validate(): Fix intermittent errors on systems
such as FreeBSD where the crypt() function is used.
(Broken only in 1.5.0) [Jeff Trawick]
*) Improve platform detection for bundled expat by updating
config.guess and config.sub. [Rainer Jung]
Changes with APR-util 1.5.0
*) dbd_pgsql_escape: Use PQescapeStringConn. [Nick Kew]
*) apr_password_validate, apr_bcrypt_encode: Add support for bcrypt encoded
passwords. The bcrypt implementation uses code from crypt_blowfish
written by Solar Designer <solar openwall com>. apr_bcrypt_encode creates
hashes with "$2y$" prefix, but apr_password_validate also accepts the old
prefix "$2a$". PR 49288. [Stefan Fritsch]
*) APR dbd: Allow to use apr_dbd_get_row() with a different pool than
apr_dbd_select(). PR 53533. [<arthur echo gmail com>]
*) APR dbd FreeTDS support: Fix spurious API errors caused by uninitialized
fields. [TROY.LIU 劉春偉 <TROY.LIU deltaww.com.cn>]
*) apr_password_validate: Increase maximum hash string length to allow
more than 9999 rounds with sha512-crypt. PR 53410. [Stefan Fritsch]
*) Fix segfaults in crypt() and crypt_r() failure modes.
PR 47272. [Arkadiusz Miskiewicz <arekm pld-linux.org>]
*) apr_crypto: Ensure that the if/else that governs the static
initialisation of each crypto driver works when the first driver
isn't in use. [Graham Leggett]
*) apr_crypto: Ensure the *driver variable is initialised when a statically
compiled library is initialised for the first time. [Graham Leggett]
*) apr_crypto: Ensure the *driver variable is initialised when the library
has already been loaded. Fix ported from apr_dbd. [Graham Leggett]
*) apr_crypto: Move the static initialisation of DRIVER_LOAD from
apr_crypto_init() to apr_crypto_get_driver(), so that we don't lose
the parameters. [Graham Leggett]
Changes with APR-util 1.4.x and later:
*) http://svn.apache.org/viewvc/apr/apr-util/branches/1.4.x/CHANGES?view=markup
Changes for APR-util 1.3.x and later:

View File

@ -7,7 +7,7 @@
# install - compile everything
# clean - mop up everything
#
# You can override the build mechansim, choose only one;
# You can override the build mechanism, choose only one;
#
# USEMAK=1 - compile from exported make files
# USEDSW=1 - compile from .dsw / .dsp VC6 projects

View File

@ -259,6 +259,7 @@ FILES_lib_objs = \
$(OBJDIR)/apr_md4.o \
$(OBJDIR)/apr_md5.o \
$(OBJDIR)/apr_memcache.o \
$(OBJDIR)/apr_passwd.o \
$(OBJDIR)/apr_queue.o \
$(OBJDIR)/apr_reslist.o \
$(OBJDIR)/apr_rmm.o \
@ -269,6 +270,7 @@ FILES_lib_objs = \
$(OBJDIR)/apr_strmatch.o \
$(OBJDIR)/apr_thread_pool.o \
$(OBJDIR)/apr_uri.o \
$(OBJDIR)/crypt_blowfish.o \
$(OBJDIR)/sdbm.o \
$(OBJDIR)/sdbm_hash.o \
$(OBJDIR)/sdbm_lock.o \

View File

@ -3,7 +3,7 @@
Summary: Apache Portable Runtime Utility library
Name: apr-util
Version: 1.4.1
Version: 1.5.2
Release: 1
License: Apache Software License
Group: System Environment/Libraries

View File

@ -1,794 +0,0 @@
# Microsoft Developer Studio Project File - Name="aprutil" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=aprutil - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "aprutil.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "aprutil.mak" CFG="aprutil - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "aprutil - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "aprutil - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "aprutil - x64 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "aprutil - x64 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "aprutil - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "LibR"
# PROP BASE Intermediate_Dir "LibR"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "LibR"
# PROP Intermediate_Dir "LibR"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /Oy- /Zi /I "./include" /I "../apr/include" /I "./include/private" /I "../apr-iconv/include" /I "./dbm/sdbm" /I "./xml/expat/lib" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "API_DECLARE_STATIC" /D "APU_USE_SDBM" /D "HAVE_SQL_H" /D "XML_STATIC" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\aprutil-1" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"LibR\aprutil-1.lib"
!ELSEIF "$(CFG)" == "aprutil - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "LibD"
# PROP BASE Intermediate_Dir "LibD"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "LibD"
# PROP Intermediate_Dir "LibD"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "./include" /I "../apr/include" /I "./include/private" /I "../apr-iconv/include" /I "./dbm/sdbm" /I "./xml/expat/lib" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "API_DECLARE_STATIC" /D "APU_USE_SDBM" /D "HAVE_SQL_H" /D "XML_STATIC" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\aprutil-1" /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"LibD\aprutil-1.lib"
!ELSEIF "$(CFG)" == "aprutil - x64 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "x64\LibR"
# PROP BASE Intermediate_Dir "x64\LibR"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x64\LibR"
# PROP Intermediate_Dir "x64\LibR"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "../apr/include" /I "./include/private" /I "../apr-iconv/include" /I "./dbm/sdbm" /I "./xml/expat/lib" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "API_DECLARE_STATIC" /D "APU_USE_SDBM" /D "HAVE_SQL_H" /D "XML_STATIC" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\aprutil-1" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x64\LibR\aprutil-1.lib"
!ELSEIF "$(CFG)" == "aprutil - x64 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "x64\LibD"
# PROP BASE Intermediate_Dir "x64\LibD"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x64\LibD"
# PROP Intermediate_Dir "x64\LibD"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /EHsc /c
# ADD CPP /nologo /MDd /W3 /Zi /Od /I "./include" /I "../apr/include" /I "./include/private" /I "../apr-iconv/include" /I "./dbm/sdbm" /I "./xml/expat/lib" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "API_DECLARE_STATIC" /D "APU_USE_SDBM" /D "HAVE_SQL_H" /D "XML_STATIC" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\aprutil-1" /FD /EHsc /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x64\LibD\aprutil-1.lib"
!ENDIF
# Begin Target
# Name "aprutil - Win32 Release"
# Name "aprutil - Win32 Debug"
# Name "aprutil - x64 Release"
# Name "aprutil - x64 Debug"
# Begin Group "Source Files"
# PROP Default_Filter ""
# Begin Group "buckets"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\buckets\apr_brigade.c
# End Source File
# Begin Source File
SOURCE=.\buckets\apr_buckets.c
# End Source File
# Begin Source File
SOURCE=.\buckets\apr_buckets_alloc.c
# End Source File
# Begin Source File
SOURCE=.\buckets\apr_buckets_eos.c
# End Source File
# Begin Source File
SOURCE=.\buckets\apr_buckets_file.c
# End Source File
# Begin Source File
SOURCE=.\buckets\apr_buckets_flush.c
# End Source File
# Begin Source File
SOURCE=.\buckets\apr_buckets_heap.c
# End Source File
# Begin Source File
SOURCE=.\buckets\apr_buckets_mmap.c
# End Source File
# Begin Source File
SOURCE=.\buckets\apr_buckets_pipe.c
# End Source File
# Begin Source File
SOURCE=.\buckets\apr_buckets_pool.c
# End Source File
# Begin Source File
SOURCE=.\buckets\apr_buckets_refcount.c
# End Source File
# Begin Source File
SOURCE=.\buckets\apr_buckets_simple.c
# End Source File
# Begin Source File
SOURCE=.\buckets\apr_buckets_socket.c
# End Source File
# End Group
# Begin Group "crypto"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\crypto\apr_crypto.c
# End Source File
# Begin Source File
SOURCE=.\crypto\apr_md4.c
# End Source File
# Begin Source File
SOURCE=.\crypto\apr_md5.c
# End Source File
# Begin Source File
SOURCE=.\crypto\apr_sha1.c
# End Source File
# Begin Source File
SOURCE=.\crypto\getuuid.c
# End Source File
# Begin Source File
SOURCE=.\crypto\uuid.c
# End Source File
# End Group
# Begin Group "dbd"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\dbd\apr_dbd.c
# End Source File
# Begin Source File
SOURCE=.\dbd\apr_dbd_freetds.c
# End Source File
# Begin Source File
SOURCE=.\dbd\apr_dbd_mysql.c
# End Source File
# Begin Source File
SOURCE=.\dbd\apr_dbd_odbc.c
# End Source File
# Begin Source File
SOURCE=.\dbd\apr_dbd_oracle.c
# End Source File
# Begin Source File
SOURCE=.\dbd\apr_dbd_pgsql.c
# End Source File
# Begin Source File
SOURCE=.\dbd\apr_dbd_sqlite2.c
# End Source File
# Begin Source File
SOURCE=.\dbd\apr_dbd_sqlite3.c
# End Source File
# End Group
# Begin Group "dbm"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\dbm\apr_dbm.c
# End Source File
# Begin Source File
SOURCE=.\dbm\apr_dbm_berkeleydb.c
# End Source File
# Begin Source File
SOURCE=.\dbm\apr_dbm_gdbm.c
# End Source File
# Begin Source File
SOURCE=.\dbm\apr_dbm_sdbm.c
# End Source File
# End Group
# Begin Group "encoding"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\encoding\apr_base64.c
# End Source File
# End Group
# Begin Group "hooks"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\hooks\apr_hooks.c
# End Source File
# End Group
# Begin Group "ldap"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\ldap\apr_ldap_init.c
# End Source File
# Begin Source File
SOURCE=.\ldap\apr_ldap_option.c
# End Source File
# Begin Source File
SOURCE=.\ldap\apr_ldap_rebind.c
# End Source File
# Begin Source File
SOURCE=.\ldap\apr_ldap_stub.c
# End Source File
# Begin Source File
SOURCE=.\ldap\apr_ldap_url.c
# End Source File
# End Group
# Begin Group "memcache"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\memcache\apr_memcache.c
# End Source File
# End Group
# Begin Group "misc"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\misc\apr_date.c
# End Source File
# Begin Source File
SOURCE=.\misc\apu_dso.c
# End Source File
# Begin Source File
SOURCE=.\misc\apr_queue.c
# End Source File
# Begin Source File
SOURCE=.\misc\apr_reslist.c
# End Source File
# Begin Source File
SOURCE=.\misc\apr_rmm.c
# End Source File
# Begin Source File
SOURCE=.\misc\apr_thread_pool.c
# End Source File
# Begin Source File
SOURCE=.\misc\apu_version.c
# End Source File
# End Group
# Begin Group "sdbm"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\dbm\sdbm\sdbm.c
# End Source File
# Begin Source File
SOURCE=.\dbm\sdbm\sdbm_hash.c
# End Source File
# Begin Source File
SOURCE=.\dbm\sdbm\sdbm_lock.c
# End Source File
# Begin Source File
SOURCE=.\dbm\sdbm\sdbm_pair.c
# End Source File
# Begin Source File
SOURCE=.\dbm\sdbm\sdbm_pair.h
# End Source File
# Begin Source File
SOURCE=.\dbm\sdbm\sdbm_private.h
# End Source File
# Begin Source File
SOURCE=.\dbm\sdbm\sdbm_tune.h
# End Source File
# End Group
# Begin Group "strmatch"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\strmatch\apr_strmatch.c
# End Source File
# End Group
# Begin Group "uri"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\uri\apr_uri.c
# End Source File
# End Group
# Begin Group "xlate"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\xlate\xlate.c
# End Source File
# End Group
# Begin Group "xml"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\xml\apr_xml.c
# End Source File
# End Group
# End Group
# Begin Group "Generated Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\include\apr_ldap.h.in
# End Source File
# Begin Source File
SOURCE=.\include\apr_ldap.hnw
# End Source File
# Begin Source File
SOURCE=.\include\apr_ldap.hw
!IF "$(CFG)" == "aprutil - Win32 Release"
# Begin Custom Build - Creating apr_ldap.h from apr_ldap.hw
InputPath=.\include\apr_ldap.hw
".\include\apr_ldap.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apr_ldap.hw > .\include\apr_ldap.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - Win32 Debug"
# Begin Custom Build - Creating apr_ldap.h from apr_ldap.hw
InputPath=.\include\apr_ldap.hw
".\include\apr_ldap.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apr_ldap.hw > .\include\apr_ldap.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - x64 Release"
# Begin Custom Build - Creating apr_ldap.h from apr_ldap.hw
InputPath=.\include\apr_ldap.hw
".\include\apr_ldap.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apr_ldap.hw > .\include\apr_ldap.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - x64 Debug"
# Begin Custom Build - Creating apr_ldap.h from apr_ldap.hw
InputPath=.\include\apr_ldap.hw
".\include\apr_ldap.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apr_ldap.hw > .\include\apr_ldap.h
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\include\apu.h.in
# End Source File
# Begin Source File
SOURCE=.\include\apu.hnw
# End Source File
# Begin Source File
SOURCE=.\include\apu.hw
!IF "$(CFG)" == "aprutil - Win32 Release"
# Begin Custom Build - Creating apu.h from apu.hw
InputPath=.\include\apu.hw
".\include\apu.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apu.hw > .\include\apu.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - Win32 Debug"
# Begin Custom Build - Creating apu.h from apu.hw
InputPath=.\include\apu.hw
".\include\apu.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apu.hw > .\include\apu.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - x64 Release"
# Begin Custom Build - Creating apu.h from apu.hw
InputPath=.\include\apu.hw
".\include\apu.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apu.hw > .\include\apu.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - x64 Debug"
# Begin Custom Build - Creating apu.h from apu.hw
InputPath=.\include\apu.hw
".\include\apu.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apu.hw > .\include\apu.h
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\include\private\apu_config.h.in
# End Source File
# Begin Source File
SOURCE=.\include\private\apu_config.hw
!IF "$(CFG)" == "aprutil - Win32 Release"
# Begin Custom Build - Creating apu_config.h from apu_config.hw
InputPath=.\include\private\apu_config.hw
".\include\private\apu_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\private\apu_config.hw > .\include\private\apu_config.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - Win32 Debug"
# Begin Custom Build - Creating apu_config.h from apu_config.hw
InputPath=.\include\private\apu_config.hw
".\include\private\apu_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\private\apu_config.hw > .\include\private\apu_config.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - x64 Release"
# Begin Custom Build - Creating apu_config.h from apu_config.hw
InputPath=.\include\private\apu_config.hw
".\include\private\apu_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\private\apu_config.hw > .\include\private\apu_config.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - x64 Debug"
# Begin Custom Build - Creating apu_config.h from apu_config.hw
InputPath=.\include\private\apu_config.hw
".\include\private\apu_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\private\apu_config.hw > .\include\private\apu_config.h
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\include\private\apu_select_dbm.h.in
# End Source File
# Begin Source File
SOURCE=.\include\private\apu_select_dbm.hw
!IF "$(CFG)" == "aprutil - Win32 Release"
# Begin Custom Build - Creating apu_select_dbm.h from apu_select_dbm.hw
InputPath=.\include\private\apu_select_dbm.hw
".\include\private\apu_select_dbm.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\private\apu_select_dbm.hw > .\include\private\apu_select_dbm.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - Win32 Debug"
# Begin Custom Build - Creating apu_select_dbm.h from apu_select_dbm.hw
InputPath=.\include\private\apu_select_dbm.hw
".\include\private\apu_select_dbm.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\private\apu_select_dbm.hw > .\include\private\apu_select_dbm.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - x64 Release"
# Begin Custom Build - Creating apu_select_dbm.h from apu_select_dbm.hw
InputPath=.\include\private\apu_select_dbm.hw
".\include\private\apu_select_dbm.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\private\apu_select_dbm.hw > .\include\private\apu_select_dbm.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - x64 Debug"
# Begin Custom Build - Creating apu_select_dbm.h from apu_select_dbm.hw
InputPath=.\include\private\apu_select_dbm.hw
".\include\private\apu_select_dbm.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\private\apu_select_dbm.hw > .\include\private\apu_select_dbm.h
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\include\apu_want.h.in
# End Source File
# Begin Source File
SOURCE=.\include\apu_want.hnw
# End Source File
# Begin Source File
SOURCE=.\include\apu_want.hw
!IF "$(CFG)" == "aprutil - Win32 Release"
# Begin Custom Build - Creating apu_want.h from apu_want.hw
InputPath=.\include\apu_want.hw
".\include\apu_want.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apu_want.hw > .\include\apu_want.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - Win32 Debug"
# Begin Custom Build - Creating apu_want.h from apu_want.hw
InputPath=.\include\apu_want.hw
".\include\apu_want.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apu_want.hw > .\include\apu_want.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - x64 Release"
# Begin Custom Build - Creating apu_want.h from apu_want.hw
InputPath=.\include\apu_want.hw
".\include\apu_want.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apu_want.hw > .\include\apu_want.h
# End Custom Build
!ELSEIF "$(CFG)" == "aprutil - x64 Debug"
# Begin Custom Build - Creating apu_want.h from apu_want.hw
InputPath=.\include\apu_want.hw
".\include\apu_want.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
type .\include\apu_want.hw > .\include\apu_want.h
# End Custom Build
!ENDIF
# End Source File
# End Group
# Begin Group "Public Header Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\include\apr_anylock.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_base64.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_buckets.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_date.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_dbm.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_hooks.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_ldap_url.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_md4.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_md5.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_memcache.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_optional.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_optional_hooks.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_queue.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_reslist.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_rmm.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_sdbm.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_sha1.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_strmatch.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_thread_pool.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_uri.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_uuid.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_xlate.h
# End Source File
# Begin Source File
SOURCE=.\include\apr_xml.h
# End Source File
# Begin Source File
SOURCE=.\include\apu_version.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -391,17 +391,30 @@ APU_DECLARE(apr_status_t) apr_brigade_vputstrs(apr_bucket_brigade *b,
void *ctx,
va_list va)
{
#define MAX_VECS 8
struct iovec vec[MAX_VECS];
apr_size_t i = 0;
for (;;) {
const char *str = va_arg(va, const char *);
char *str = va_arg(va, char *);
apr_status_t rv;
if (str == NULL)
break;
rv = apr_brigade_write(b, flush, ctx, str, strlen(str));
if (rv != APR_SUCCESS)
return rv;
vec[i].iov_base = str;
vec[i].iov_len = strlen(str);
i++;
if (i == MAX_VECS) {
rv = apr_brigade_writev(b, flush, ctx, vec, i);
if (rv != APR_SUCCESS)
return rv;
i = 0;
}
}
if (i != 0)
return apr_brigade_writev(b, flush, ctx, vec, i);
return APR_SUCCESS;
}
@ -422,7 +435,12 @@ APU_DECLARE(apr_status_t) apr_brigade_write(apr_bucket_brigade *b,
apr_size_t remaining = APR_BUCKET_BUFF_SIZE;
char *buf = NULL;
if (!APR_BRIGADE_EMPTY(b) && APR_BUCKET_IS_HEAP(e)) {
/*
* If the last bucket is a heap bucket and its buffer is not shared with
* another bucket, we may write into that bucket.
*/
if (!APR_BRIGADE_EMPTY(b) && APR_BUCKET_IS_HEAP(e)
&& ((apr_bucket_heap *)(e->data))->refcount.refcount == 1) {
apr_bucket_heap *h = e->data;
/* HEAP bucket start offsets are always in-memory, safe to cast */
@ -512,10 +530,11 @@ APU_DECLARE(apr_status_t) apr_brigade_writev(apr_bucket_brigade *b,
i = 0;
/* If there is a heap bucket at the end of the brigade
* already, copy into the existing bucket.
* already, and its refcount is 1, copy into the existing bucket.
*/
e = APR_BRIGADE_LAST(b);
if (!APR_BRIGADE_EMPTY(b) && APR_BUCKET_IS_HEAP(e)) {
if (!APR_BRIGADE_EMPTY(b) && APR_BUCKET_IS_HEAP(e)
&& ((apr_bucket_heap *)(e->data))->refcount.refcount == 1) {
apr_bucket_heap *h = e->data;
apr_size_t remaining = h->alloc_len -
(e->length + (apr_size_t)e->start);
@ -591,29 +610,7 @@ APU_DECLARE(apr_status_t) apr_brigade_puts(apr_bucket_brigade *bb,
apr_brigade_flush flush, void *ctx,
const char *str)
{
apr_size_t len = strlen(str);
apr_bucket *bkt = APR_BRIGADE_LAST(bb);
if (!APR_BRIGADE_EMPTY(bb) && APR_BUCKET_IS_HEAP(bkt)) {
/* If there is enough space available in a heap bucket
* at the end of the brigade, copy the string directly
* into the heap bucket
*/
apr_bucket_heap *h = bkt->data;
apr_size_t bytes_avail = h->alloc_len - bkt->length;
if (bytes_avail >= len) {
char *buf = h->base + bkt->start + bkt->length;
memcpy(buf, str, len);
bkt->length += len;
return APR_SUCCESS;
}
}
/* If the string could not be copied into an existing heap
* bucket, delegate the work to apr_brigade_write(), which
* knows how to grow the brigade
*/
return apr_brigade_write(bb, flush, ctx, str, len);
return apr_brigade_write(bb, flush, ctx, str, strlen(str));
}
APU_DECLARE_NONSTD(apr_status_t) apr_brigade_putstrs(apr_bucket_brigade *b,

View File

@ -65,12 +65,20 @@ APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create(apr_pool_t *p)
/* may be NULL for debug mode. */
if (allocator == NULL) {
if (apr_allocator_create(&allocator) != APR_SUCCESS) {
apr_abortfunc_t fn = apr_pool_abort_get(p);
if (fn)
(fn)(APR_ENOMEM);
abort();
}
}
#endif
list = apr_bucket_alloc_create_ex(allocator);
if (list == NULL) {
apr_abortfunc_t fn = apr_pool_abort_get(p);
if (fn)
(fn)(APR_ENOMEM);
abort();
}
list->pool = p;
apr_pool_cleanup_register(list->pool, list, alloc_cleanup,
apr_pool_cleanup_null);
@ -131,6 +139,7 @@ APU_DECLARE_NONSTD(void *) apr_bucket_alloc(apr_size_t size,
if (endp >= active->endp) {
list->blocks = apr_allocator_alloc(list->allocator, ALLOC_AMT);
if (!list->blocks) {
list->blocks = active;
return NULL;
}
list->blocks->next = active;

View File

@ -15,8 +15,10 @@ buckets/apr_buckets_simple.lo: buckets/apr_buckets_simple.c .make.dirs include/a
buckets/apr_buckets_socket.lo: buckets/apr_buckets_socket.c .make.dirs include/apr_buckets.h
crypto/apr_crypto.lo: crypto/apr_crypto.c .make.dirs include/apr_crypto.h include/apu_errno.h include/apu_version.h include/private/apr_crypto_internal.h include/private/apu_internal.h
crypto/apr_md4.lo: crypto/apr_md4.c .make.dirs include/apr_md4.h include/apr_xlate.h
crypto/apr_md5.lo: crypto/apr_md5.c .make.dirs include/apr_md5.h include/apr_sha1.h include/apr_xlate.h
crypto/apr_md5.lo: crypto/apr_md5.c .make.dirs include/apr_md5.h include/apr_xlate.h
crypto/apr_passwd.lo: crypto/apr_passwd.c .make.dirs include/apr_md5.h include/apr_sha1.h include/apr_xlate.h
crypto/apr_sha1.lo: crypto/apr_sha1.c .make.dirs include/apr_base64.h include/apr_sha1.h include/apr_xlate.h
crypto/crypt_blowfish.lo: crypto/crypt_blowfish.c .make.dirs
crypto/getuuid.lo: crypto/getuuid.c .make.dirs include/apr_md5.h include/apr_uuid.h include/apr_xlate.h
crypto/uuid.lo: crypto/uuid.c .make.dirs include/apr_uuid.h
dbd/apr_dbd.lo: dbd/apr_dbd.c .make.dirs include/apr_dbd.h include/apu_version.h include/private/apr_dbd_internal.h include/private/apu_internal.h
@ -43,7 +45,7 @@ uri/apr_uri.lo: uri/apr_uri.c .make.dirs include/apr_uri.h
xlate/xlate.lo: xlate/xlate.c .make.dirs include/apr_xlate.h
xml/apr_xml.lo: xml/apr_xml.c .make.dirs include/apr_xlate.h include/apr_xml.h
OBJECTS_all = buckets/apr_brigade.lo buckets/apr_buckets.lo buckets/apr_buckets_alloc.lo buckets/apr_buckets_eos.lo buckets/apr_buckets_file.lo buckets/apr_buckets_flush.lo buckets/apr_buckets_heap.lo buckets/apr_buckets_mmap.lo buckets/apr_buckets_pipe.lo buckets/apr_buckets_pool.lo buckets/apr_buckets_refcount.lo buckets/apr_buckets_simple.lo buckets/apr_buckets_socket.lo crypto/apr_crypto.lo crypto/apr_md4.lo crypto/apr_md5.lo crypto/apr_sha1.lo crypto/getuuid.lo crypto/uuid.lo dbd/apr_dbd.lo dbm/apr_dbm.lo dbm/apr_dbm_sdbm.lo dbm/sdbm/sdbm.lo dbm/sdbm/sdbm_hash.lo dbm/sdbm/sdbm_lock.lo dbm/sdbm/sdbm_pair.lo encoding/apr_base64.lo hooks/apr_hooks.lo ldap/apr_ldap_stub.lo ldap/apr_ldap_url.lo memcache/apr_memcache.lo misc/apr_date.lo misc/apr_queue.lo misc/apr_reslist.lo misc/apr_rmm.lo misc/apr_thread_pool.lo misc/apu_dso.lo misc/apu_version.lo strmatch/apr_strmatch.lo uri/apr_uri.lo xlate/xlate.lo xml/apr_xml.lo
OBJECTS_all = buckets/apr_brigade.lo buckets/apr_buckets.lo buckets/apr_buckets_alloc.lo buckets/apr_buckets_eos.lo buckets/apr_buckets_file.lo buckets/apr_buckets_flush.lo buckets/apr_buckets_heap.lo buckets/apr_buckets_mmap.lo buckets/apr_buckets_pipe.lo buckets/apr_buckets_pool.lo buckets/apr_buckets_refcount.lo buckets/apr_buckets_simple.lo buckets/apr_buckets_socket.lo crypto/apr_crypto.lo crypto/apr_md4.lo crypto/apr_md5.lo crypto/apr_passwd.lo crypto/apr_sha1.lo crypto/crypt_blowfish.lo crypto/getuuid.lo crypto/uuid.lo dbd/apr_dbd.lo dbm/apr_dbm.lo dbm/apr_dbm_sdbm.lo dbm/sdbm/sdbm.lo dbm/sdbm/sdbm_hash.lo dbm/sdbm/sdbm_lock.lo dbm/sdbm/sdbm_pair.lo encoding/apr_base64.lo hooks/apr_hooks.lo ldap/apr_ldap_stub.lo ldap/apr_ldap_url.lo memcache/apr_memcache.lo misc/apr_date.lo misc/apr_queue.lo misc/apr_reslist.lo misc/apr_rmm.lo misc/apr_thread_pool.lo misc/apu_dso.lo misc/apu_version.lo strmatch/apr_strmatch.lo uri/apr_uri.lo xlate/xlate.lo xml/apr_xml.lo
OBJECTS_unix = $(OBJECTS_all)

View File

@ -10,9 +10,11 @@ paths =
crypto/apr_crypto.c
crypto/apr_md4.c
crypto/apr_md5.c
crypto/apr_passwd.c
crypto/apr_sha1.c
crypto/getuuid.c
crypto/uuid.c
crypto/crypt_blowfish.c
dbm/apr_dbm_sdbm.c
dbm/apr_dbm.c
dbm/sdbm/*.c

File diff suppressed because it is too large Load Diff

View File

@ -42,13 +42,20 @@ AC_CANONICAL_SYSTEM
AC_PROG_INSTALL
# Use -no-install to link the test programs on all platforms
# but Darwin, where it would cause the programs to be linked
# against installed versions of libapr instead of those just
# built.
# Use -no-install or -no-fast-install to link the test
# programs on all platforms but Darwin, where it would cause
# the programs to be linked against installed versions of
# libapr instead of those just built.
case $host in
*-apple-darwin*) LT_NO_INSTALL="" ;;
*) LT_NO_INSTALL="-no-install" ;;
*-apple-darwin*)
LT_NO_INSTALL=""
;;
*-mingw*)
LT_NO_INSTALL="-no-fast-install"
;;
*)
LT_NO_INSTALL="-no-install"
;;
esac
AC_SUBST(LT_NO_INSTALL)
@ -151,8 +158,6 @@ dnl Determine what DBM backend type to use.
dnl Find Expat
dnl Find an iconv library
APU_CHECK_CRYPTO
APU_CHECK_CRYPTO_OPENSSL
APU_CHECK_CRYPTO_NSS
APU_FIND_LDAP
APU_CHECK_DBM
APU_CHECK_DBD
@ -224,7 +229,22 @@ dnl copy apr's rules.mk into our build directory.
if test ! -d ./build; then
$mkdir_p build
fi
cp $APR_BUILD_DIR/apr_rules.mk $abs_builddir/build/rules.mk
dnl
dnl MinGW: If APR is shared, APR_DECLARE_EXPORT will be defined in the
dnl internal CPPFLAGS, but APR-Util needs APU_DECLARE_EXPORT instead.
dnl If APR is static, APR_DECLARE_STATIC will be defined in the
dnl internal CPPFLAGS, but APR-Util needs APU_DECLARE_STATIC too.
dnl
case $host in
*-mingw*)
sed -e 's/-DAPR_DECLARE_EXPORT/-DAPU_DECLARE_EXPORT/' \
-e 's/-DAPR_DECLARE_STATIC/-DAPU_DECLARE_STATIC -DAPR_DECLARE_STATIC/' \
< $APR_BUILD_DIR/apr_rules.mk > $abs_builddir/build/rules.mk
;;
*)
cp $APR_BUILD_DIR/apr_rules.mk $abs_builddir/build/rules.mk
;;
esac
dnl
dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles

Some files were not shown because too many files have changed in this diff Show More