MFC
This commit is contained in:
commit
abdebe75b2
@ -15,6 +15,8 @@
|
||||
# -DNO_WWWUPDATE do not update www in ${MAKE} update
|
||||
# -DNO_CTF do not run the DTrace CTF conversion tools on built objects
|
||||
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
|
||||
# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
|
||||
# list
|
||||
# TARGET="machine" to crossbuild world for a different machine type
|
||||
# TARGET_ARCH= may be required when a TARGET supports multiple endians
|
||||
|
||||
@ -104,6 +106,8 @@ CLEANDIR= clean cleandepend
|
||||
CLEANDIR= cleandir
|
||||
.endif
|
||||
|
||||
LOCAL_TOOL_DIRS?= ''
|
||||
|
||||
CVS?= cvs
|
||||
CVSFLAGS?= -A -P -d -I!
|
||||
SVN?= svn
|
||||
@ -1101,6 +1105,7 @@ build-tools:
|
||||
bin/csh \
|
||||
bin/sh \
|
||||
${_rescue} \
|
||||
${LOCAL_TOOL_DIRS} \
|
||||
lib/ncurses/ncurses \
|
||||
lib/ncurses/ncursesw \
|
||||
${_share} \
|
||||
|
@ -100,6 +100,7 @@ static void tryexec(char *, char **, char **);
|
||||
static void printentry(struct tblentry *, int);
|
||||
static struct tblentry *cmdlookup(const char *, int);
|
||||
static void delete_cmd_entry(void);
|
||||
static void addcmdentry(const char *, struct cmdentry *);
|
||||
|
||||
|
||||
|
||||
@ -593,7 +594,7 @@ delete_cmd_entry(void)
|
||||
* the same name.
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
addcmdentry(const char *name, struct cmdentry *entry)
|
||||
{
|
||||
struct tblentry *cmdp;
|
||||
|
@ -70,7 +70,6 @@ void find_command(const char *, struct cmdentry *, int, const char *);
|
||||
int find_builtin(const char *, int *);
|
||||
void hashcd(void);
|
||||
void changepath(const char *);
|
||||
void addcmdentry(const char *, struct cmdentry *);
|
||||
void defun(const char *, union node *);
|
||||
int unsetfunc(const char *);
|
||||
int typecmd_impl(int, char **, int, const char *);
|
||||
|
102
bin/sh/expand.c
102
bin/sh/expand.c
@ -113,6 +113,7 @@ static void expmeta(char *, char *);
|
||||
static void addfname(char *);
|
||||
static struct strlist *expsort(struct strlist *);
|
||||
static struct strlist *msort(struct strlist *, int);
|
||||
static int patmatch(const char *, const char *, int);
|
||||
static char *cvtnum(int, char *);
|
||||
static int collate_range_cmp(wchar_t, wchar_t);
|
||||
|
||||
@ -1441,61 +1442,67 @@ match_charclass(const char *p, wchar_t chr, const char **end)
|
||||
* Returns true if the pattern matches the string.
|
||||
*/
|
||||
|
||||
int
|
||||
static int
|
||||
patmatch(const char *pattern, const char *string, int squoted)
|
||||
{
|
||||
const char *p, *q, *end;
|
||||
const char *bt_p, *bt_q;
|
||||
char c;
|
||||
wchar_t wc, wc2;
|
||||
|
||||
p = pattern;
|
||||
q = string;
|
||||
bt_p = NULL;
|
||||
bt_q = NULL;
|
||||
for (;;) {
|
||||
switch (c = *p++) {
|
||||
case '\0':
|
||||
goto breakloop;
|
||||
if (*q != '\0')
|
||||
goto backtrack;
|
||||
return 1;
|
||||
case CTLESC:
|
||||
if (squoted && *q == CTLESC)
|
||||
q++;
|
||||
if (*q++ != *p++)
|
||||
return 0;
|
||||
goto backtrack;
|
||||
break;
|
||||
case CTLQUOTEMARK:
|
||||
continue;
|
||||
case '?':
|
||||
if (squoted && *q == CTLESC)
|
||||
q++;
|
||||
if (localeisutf8)
|
||||
wc = get_wc(&q);
|
||||
else
|
||||
wc = (unsigned char)*q++;
|
||||
if (wc == '\0')
|
||||
if (*q == '\0')
|
||||
return 0;
|
||||
if (localeisutf8) {
|
||||
wc = get_wc(&q);
|
||||
/*
|
||||
* A '?' does not match invalid UTF-8 but a
|
||||
* '*' does, so backtrack.
|
||||
*/
|
||||
if (wc == 0)
|
||||
goto backtrack;
|
||||
} else
|
||||
wc = (unsigned char)*q++;
|
||||
break;
|
||||
case '*':
|
||||
c = *p;
|
||||
while (c == CTLQUOTEMARK || c == '*')
|
||||
c = *++p;
|
||||
if (c != CTLESC && c != CTLQUOTEMARK &&
|
||||
c != '?' && c != '*' && c != '[') {
|
||||
while (*q != c) {
|
||||
if (squoted && *q == CTLESC &&
|
||||
q[1] == c)
|
||||
break;
|
||||
if (*q == '\0')
|
||||
return 0;
|
||||
if (squoted && *q == CTLESC)
|
||||
q++;
|
||||
q++;
|
||||
}
|
||||
}
|
||||
do {
|
||||
if (patmatch(p, q, squoted))
|
||||
return 1;
|
||||
if (squoted && *q == CTLESC)
|
||||
q++;
|
||||
} while (*q++ != '\0');
|
||||
return 0;
|
||||
/*
|
||||
* If the pattern ends here, we know the string
|
||||
* matches without needing to look at the rest of it.
|
||||
*/
|
||||
if (c == '\0')
|
||||
return 1;
|
||||
/*
|
||||
* First try the shortest match for the '*' that
|
||||
* could work. We can forget any earlier '*' since
|
||||
* there is no way having it match more characters
|
||||
* can help us, given that we are already here.
|
||||
*/
|
||||
bt_p = p;
|
||||
bt_q = q;
|
||||
break;
|
||||
case '[': {
|
||||
const char *endp;
|
||||
int invert, found;
|
||||
@ -1507,7 +1514,7 @@ patmatch(const char *pattern, const char *string, int squoted)
|
||||
for (;;) {
|
||||
while (*endp == CTLQUOTEMARK)
|
||||
endp++;
|
||||
if (*endp == '\0')
|
||||
if (*endp == 0)
|
||||
goto dft; /* no matching ] */
|
||||
if (*endp == CTLESC)
|
||||
endp++;
|
||||
@ -1522,12 +1529,14 @@ patmatch(const char *pattern, const char *string, int squoted)
|
||||
found = 0;
|
||||
if (squoted && *q == CTLESC)
|
||||
q++;
|
||||
if (localeisutf8)
|
||||
chr = get_wc(&q);
|
||||
else
|
||||
chr = (unsigned char)*q++;
|
||||
if (chr == '\0')
|
||||
if (*q == '\0')
|
||||
return 0;
|
||||
if (localeisutf8) {
|
||||
chr = get_wc(&q);
|
||||
if (chr == 0)
|
||||
goto backtrack;
|
||||
} else
|
||||
chr = (unsigned char)*q++;
|
||||
c = *p++;
|
||||
do {
|
||||
if (c == CTLQUOTEMARK)
|
||||
@ -1568,21 +1577,34 @@ patmatch(const char *pattern, const char *string, int squoted)
|
||||
}
|
||||
} while ((c = *p++) != ']');
|
||||
if (found == invert)
|
||||
return 0;
|
||||
goto backtrack;
|
||||
break;
|
||||
}
|
||||
dft: default:
|
||||
if (squoted && *q == CTLESC)
|
||||
q++;
|
||||
if (*q++ != c)
|
||||
if (*q == '\0')
|
||||
return 0;
|
||||
if (*q++ == c)
|
||||
break;
|
||||
backtrack:
|
||||
/*
|
||||
* If we have a mismatch (other than hitting the end
|
||||
* of the string), go back to the last '*' seen and
|
||||
* have it match one additional character.
|
||||
*/
|
||||
if (bt_p == NULL)
|
||||
return 0;
|
||||
if (squoted && *bt_q == CTLESC)
|
||||
bt_q++;
|
||||
if (*bt_q == '\0')
|
||||
return 0;
|
||||
bt_q++;
|
||||
p = bt_p;
|
||||
q = bt_q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
breakloop:
|
||||
if (*q != '\0')
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,6 +60,5 @@ union node;
|
||||
void expandhere(union node *, int);
|
||||
void expandarg(union node *, struct arglist *, int);
|
||||
void expari(int);
|
||||
int patmatch(const char *, const char *, int);
|
||||
void rmescapes(char *);
|
||||
int casematch(union node *, const char *);
|
||||
|
@ -70,6 +70,8 @@ int displayhist;
|
||||
static FILE *el_in, *el_out, *el_err;
|
||||
|
||||
static char *fc_replace(const char *, char *, char *);
|
||||
static int not_fcnumber(const char *);
|
||||
static int str_to_event(const char *, int);
|
||||
|
||||
/*
|
||||
* Set history and editing status. Called whenever the status may
|
||||
@ -425,7 +427,7 @@ fc_replace(const char *s, char *p, char *r)
|
||||
return (dest);
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
not_fcnumber(const char *s)
|
||||
{
|
||||
if (s == NULL)
|
||||
@ -435,7 +437,7 @@ not_fcnumber(const char *s)
|
||||
return (!is_number(s));
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
str_to_event(const char *str, int last)
|
||||
{
|
||||
HistEvent he;
|
||||
|
@ -106,6 +106,7 @@ EditLine *el; /* cookie for editline package */
|
||||
|
||||
static void pushfile(void);
|
||||
static int preadfd(void);
|
||||
static void popstring(void);
|
||||
|
||||
#ifdef mkinit
|
||||
INCLUDE "input.h"
|
||||
@ -372,7 +373,7 @@ pushstring(char *s, int len, void *ap)
|
||||
INTON;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
popstring(void)
|
||||
{
|
||||
struct strpush *sp = parsefile->strpush;
|
||||
|
@ -53,7 +53,6 @@ int preadbuffer(void);
|
||||
int preadateof(void);
|
||||
void pungetc(void);
|
||||
void pushstring(char *, int, void *);
|
||||
void popstring(void);
|
||||
void setinputfile(const char *, int);
|
||||
void setinputfd(int, int);
|
||||
void setinputstring(char *, int);
|
||||
|
@ -79,6 +79,7 @@ int rootshell;
|
||||
struct jmploc main_handler;
|
||||
int localeisutf8, initial_localeisutf8;
|
||||
|
||||
static void cmdloop(int);
|
||||
static void read_profile(char *);
|
||||
static char *find_dot_file(char *);
|
||||
|
||||
@ -184,7 +185,7 @@ state4: /* XXX ??? - why isn't this before the "if" statement */
|
||||
* loop; it turns on prompting if the shell is interactive.
|
||||
*/
|
||||
|
||||
void
|
||||
static void
|
||||
cmdloop(int top)
|
||||
{
|
||||
union node *n;
|
||||
|
@ -38,4 +38,3 @@ extern int rootshell; /* true if we aren't a child of the main shell */
|
||||
extern struct jmploc main_handler; /* top level exception handler */
|
||||
|
||||
void readcmdfile(const char *);
|
||||
void cmdloop(int);
|
||||
|
@ -39,6 +39,4 @@ extern int displayhist;
|
||||
void histedit(void);
|
||||
void sethistsize(const char *);
|
||||
void setterm(const char *);
|
||||
int not_fcnumber(const char *);
|
||||
int str_to_event(const char *, int);
|
||||
|
||||
|
@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
|
||||
*
|
||||
* equal(s1, s2) Return true if strings are equal.
|
||||
* scopy(from, to) Copy a string.
|
||||
* scopyn(from, to, n) Like scopy, but checks for overflow.
|
||||
* number(s) Convert a string of digits to an integer.
|
||||
* is_number(s) Return true if s is a string of digits.
|
||||
*/
|
||||
@ -66,24 +65,6 @@ char nullstr[1]; /* zero length string */
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* scopyn - copy a string from "from" to "to", truncating the string
|
||||
* if necessary. "To" is always nul terminated, even if
|
||||
* truncation is performed. "Size" is the size of "to".
|
||||
*/
|
||||
|
||||
void
|
||||
scopyn(const char *from, char *to, int size)
|
||||
{
|
||||
|
||||
while (--size > 0) {
|
||||
if ((*to++ = *from++) == '\0')
|
||||
return;
|
||||
}
|
||||
*to = '\0';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* prefix -- see if pfx is a prefix of string.
|
||||
*/
|
||||
|
@ -35,7 +35,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
void scopyn(const char *, char *, int);
|
||||
int prefix(const char *, const char *);
|
||||
int number(const char *);
|
||||
int is_number(const char *);
|
||||
|
@ -82,7 +82,7 @@ main(int argc, char *argv[])
|
||||
|
||||
fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT | O_DSYNC |
|
||||
O_LARGEFILE | O_NOCTTY | O_NONBLOCK | O_NDELAY | O_RSYNC |
|
||||
O_SYNC | O_TRUNC | O_XATTR);
|
||||
O_SYNC | O_TRUNC | O_XATTR, 0666);
|
||||
|
||||
fds[n++] = open(file, O_RDWR);
|
||||
(void) lseek(fds[n - 1], 123, SEEK_SET);
|
||||
|
@ -14,7 +14,7 @@ Full text of the relevant licenses is included below.
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||
Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@ -55,7 +55,7 @@ SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||
Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -44,4 +44,4 @@ void __trampoline_setup(uint32_t* trampOnStack, int trampSizeAllocated,
|
||||
/* clear instruction cache */
|
||||
__clear_cache(trampOnStack, &trampOnStack[10]);
|
||||
}
|
||||
#endif /* __ppc__ */
|
||||
#endif /* __ppc__ && !defined(__powerpc64__) */
|
||||
|
@ -605,6 +605,8 @@
|
||||
.ds doc-str-St--isoC \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9899:1990
|
||||
.as doc-str-St--isoC " (\*[Lq]\*[doc-Tn-font-size]ISO\~C\^90\*[doc-str-St]\*[Rq])
|
||||
.als doc-str-St--isoC-90 doc-str-St--isoC
|
||||
.ds doc-str-St--isoC-2011 \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9899:2011
|
||||
.as doc-str-St--isoC-2011 " (\*[Lq]\*[doc-Tn-font-size]ISO\~C\^11\*[doc-str-St]\*[Rq])
|
||||
.ds doc-str-St--isoC-99 \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9899:1999
|
||||
.as doc-str-St--isoC-99 " (\*[Lq]\*[doc-Tn-font-size]ISO\~C\^99\*[doc-str-St]\*[Rq])
|
||||
.ds doc-str-St--isoC-amd1 \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9899/AMD1:1995
|
||||
@ -613,8 +615,6 @@
|
||||
.as doc-str-St--isoC-tcor1 " (\*[Lq]\*[doc-Tn-font-size]ISO\~C\^90\*[doc-str-St], Technical Corrigendum 1\*[Rq])
|
||||
.ds doc-str-St--isoC-tcor2 \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9899/TCOR2:1995
|
||||
.as doc-str-St--isoC-tcor2 " (\*[Lq]\*[doc-Tn-font-size]ISO\~C\^90\*[doc-str-St], Technical Corrigendum 2\*[Rq])
|
||||
.ds doc-str-St--isoC-11 \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9899:2011
|
||||
.as doc-str-St--isoC-11 " (\*[Lq]\*[doc-Tn-font-size]ISO\~C\^11\*[doc-str-St]\*[Rq])
|
||||
.
|
||||
.\" POSIX Part 1: System API
|
||||
.ds doc-str-St--p1003.1 \*[doc-Tn-font-size]\%IEEE\*[doc-str-St] Std 1003.1
|
||||
|
@ -2038,8 +2038,8 @@ are:
|
||||
.St -isoC-90
|
||||
.It Li \-isoC\-99
|
||||
.St -isoC-99
|
||||
.It Li \-isoC\-11
|
||||
.St -isoC-11
|
||||
.It Li \-isoC\-2011
|
||||
.St -isoC-2011
|
||||
.El
|
||||
.Pp
|
||||
.
|
||||
|
@ -105,7 +105,7 @@ cmd_exec()
|
||||
start_mca(action, prompt, mlist, cmdflags)
|
||||
int action;
|
||||
char *prompt;
|
||||
void *mlist;
|
||||
void constant *mlist;
|
||||
int cmdflags;
|
||||
{
|
||||
mca = action;
|
||||
@ -686,7 +686,7 @@ make_display()
|
||||
static void
|
||||
prompt()
|
||||
{
|
||||
register char *p;
|
||||
register char constant *p;
|
||||
|
||||
if (ungot != NULL)
|
||||
{
|
||||
@ -1461,7 +1461,7 @@ commands()
|
||||
error("Command not available", NULL_PARG);
|
||||
break;
|
||||
}
|
||||
start_mca(A_EXAMINE, "Examine: ", (void*)ml_examine, 0);
|
||||
start_mca(A_EXAMINE, "Examine: ", ml_examine, 0);
|
||||
c = getcc();
|
||||
goto again;
|
||||
#else
|
||||
@ -1491,7 +1491,7 @@ commands()
|
||||
error("WARNING: This file was viewed via LESSOPEN",
|
||||
NULL_PARG);
|
||||
}
|
||||
start_mca(A_SHELL, "!", (void*)ml_shell, 0);
|
||||
start_mca(A_SHELL, "!", ml_shell, 0);
|
||||
/*
|
||||
* Expand the editor prototype string
|
||||
* and pass it to the system to execute.
|
||||
@ -1655,7 +1655,7 @@ commands()
|
||||
error("Command not available", NULL_PARG);
|
||||
break;
|
||||
}
|
||||
start_mca(A_SHELL, "!", (void*)ml_shell, 0);
|
||||
start_mca(A_SHELL, "!", ml_shell, 0);
|
||||
c = getcc();
|
||||
goto again;
|
||||
#else
|
||||
@ -1706,7 +1706,7 @@ commands()
|
||||
if (badmark(c))
|
||||
break;
|
||||
pipec = c;
|
||||
start_mca(A_PIPE, "!", (void*)ml_shell, 0);
|
||||
start_mca(A_PIPE, "!", ml_shell, 0);
|
||||
c = getcc();
|
||||
goto again;
|
||||
#else
|
||||
|
@ -394,9 +394,9 @@ protochar(c, where, iseditproto)
|
||||
* where to resume parsing the string.
|
||||
* We must keep track of nested IFs and skip them properly.
|
||||
*/
|
||||
static char *
|
||||
static char constant *
|
||||
skipcond(p)
|
||||
register char *p;
|
||||
register char constant *p;
|
||||
{
|
||||
register int iflevel;
|
||||
|
||||
@ -452,9 +452,9 @@ skipcond(p)
|
||||
/*
|
||||
* Decode a char that represents a position on the screen.
|
||||
*/
|
||||
static char *
|
||||
static char constant *
|
||||
wherechar(p, wp)
|
||||
char *p;
|
||||
char constant *p;
|
||||
int *wp;
|
||||
{
|
||||
switch (*p)
|
||||
@ -478,10 +478,10 @@ wherechar(p, wp)
|
||||
*/
|
||||
public char *
|
||||
pr_expand(proto, maxwidth)
|
||||
char *proto;
|
||||
char constant *proto;
|
||||
int maxwidth;
|
||||
{
|
||||
register char *p;
|
||||
register char constant *p;
|
||||
register int c;
|
||||
int where;
|
||||
|
||||
@ -555,7 +555,7 @@ pr_expand(proto, maxwidth)
|
||||
public char *
|
||||
eq_message()
|
||||
{
|
||||
return (pr_expand((char*)eqproto, 0));
|
||||
return (pr_expand(eqproto, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -572,7 +572,7 @@ pr_string()
|
||||
|
||||
type = (!less_is_more) ? pr_type : pr_type ? 0 : 1;
|
||||
prompt = pr_expand((ch_getflags() & CH_HELPFILE) ?
|
||||
(char*)hproto : prproto[type],
|
||||
hproto : prproto[type],
|
||||
sc_width-so_s_width-so_e_width-2);
|
||||
new_file = 0;
|
||||
return (prompt);
|
||||
@ -584,5 +584,5 @@ pr_string()
|
||||
public char *
|
||||
wait_message()
|
||||
{
|
||||
return (pr_expand((char*)wproto, sc_width-so_s_width-so_e_width-2));
|
||||
return (pr_expand(wproto, sc_width-so_s_width-so_e_width-2));
|
||||
}
|
||||
|
@ -683,7 +683,7 @@ all_forts(FILEDESC *fp, char *offensive)
|
||||
obscene->fd = fd;
|
||||
obscene->inf = NULL;
|
||||
obscene->path = offensive;
|
||||
if ((sp = rindex(offensive, '/')) == NULL)
|
||||
if ((sp = strrchr(offensive, '/')) == NULL)
|
||||
obscene->name = offensive;
|
||||
else
|
||||
obscene->name = ++sp;
|
||||
@ -785,7 +785,7 @@ is_fortfile(const char *file, char **datp, char **posp, int check_for_offend)
|
||||
}
|
||||
}
|
||||
|
||||
if ((sp = rindex(file, '/')) == NULL)
|
||||
if ((sp = strrchr(file, '/')) == NULL)
|
||||
sp = file;
|
||||
else
|
||||
sp++;
|
||||
@ -797,7 +797,7 @@ is_fortfile(const char *file, char **datp, char **posp, int check_for_offend)
|
||||
DPRINTF(2, (stderr, "FALSE (check fortunes only)\n"));
|
||||
return (FALSE);
|
||||
}
|
||||
if ((sp = rindex(sp, '.')) != NULL) {
|
||||
if ((sp = strrchr(sp, '.')) != NULL) {
|
||||
sp++;
|
||||
for (i = 0; suflist[i] != NULL; i++)
|
||||
if (strcmp(sp, suflist[i]) == 0) {
|
||||
|
@ -83,7 +83,7 @@ usage(void)
|
||||
{
|
||||
|
||||
fprintf(stderr,
|
||||
"usage: %s [-afqv] [-d crashdir] [-c core | -n dumpnr | -r device]\n"
|
||||
"usage: %s [-afqvw] [-d crashdir] [-c core | -n dumpnr | -r device]\n"
|
||||
"\t[kernel [core]]\n", getprogname());
|
||||
exit(1);
|
||||
}
|
||||
|
@ -29,18 +29,20 @@
|
||||
#ifndef _COMPLEX_H
|
||||
#define _COMPLEX_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if __STDC_VERSION__ < 199901
|
||||
#define _Complex __complex__
|
||||
#endif
|
||||
#define _Complex_I 1.0fi
|
||||
#define _Complex_I ((float _Complex)1.0i)
|
||||
_Static_assert(__generic(_Complex_I, float _Complex, 1, 0),
|
||||
"_Complex_I must be of type float _Complex");
|
||||
#endif
|
||||
|
||||
#define complex _Complex
|
||||
#define I _Complex_I
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
double cabs(double complex);
|
||||
|
@ -106,13 +106,13 @@ enum memory_order {
|
||||
|
||||
#if defined(__CLANG_ATOMICS)
|
||||
#define atomic_thread_fence(order) __atomic_thread_fence(order)
|
||||
#define atomic_signal_fence(order) __asm volatile ("" : : : "memory");
|
||||
#define atomic_signal_fence(order) __asm volatile ("" : : : "memory")
|
||||
#elif defined(__GNUC_ATOMICS)
|
||||
#define atomic_thread_fence(order) __atomic_thread_fence(order)
|
||||
#define atomic_signal_fence(order) __atomic_signal_fence(order)
|
||||
#else
|
||||
#define atomic_thread_fence(order) __sync_synchronize()
|
||||
#define atomic_signal_fence(order) __asm volatile ("" : : : "memory");
|
||||
#define atomic_signal_fence(order) __asm volatile ("" : : : "memory")
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -26,11 +26,13 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef noreturn
|
||||
|
||||
#if !defined(__cplusplus) || __cplusplus < 201103L
|
||||
#include <sys/cdefs.h>
|
||||
#define noreturn _Noreturn
|
||||
#ifdef __cplusplus
|
||||
#error "<stdnoreturn.h> cannot be used in combination with C++11."
|
||||
#endif
|
||||
|
||||
#ifndef noreturn
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#define noreturn _Noreturn
|
||||
|
||||
#endif /* !noreturn */
|
||||
|
106
include/tgmath.h
106
include/tgmath.h
@ -2,6 +2,9 @@
|
||||
* Copyright (c) 2004 Stefan Farfeleder.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2012 Ed Schouten <ed@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@ -33,17 +36,17 @@
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* This implementation of <tgmath.h> requires two implementation-dependent
|
||||
* macros to be defined:
|
||||
* __tg_impl_simple(x, y, z, fn, fnf, fnl, ...)
|
||||
* This implementation of <tgmath.h> uses the two following macros,
|
||||
* which are based on the macros described in C11 proposal N1404:
|
||||
* __tg_impl_simple(x, y, z, fnl, fn, fnf, ...)
|
||||
* Invokes fnl() if the corresponding real type of x, y or z is long
|
||||
* double, fn() if it is double or any has an integer type, and fnf()
|
||||
* otherwise.
|
||||
* __tg_impl_full(x, y, z, fn, fnf, fnl, cfn, cfnf, cfnl, ...)
|
||||
* Invokes [c]fnl() if the corresponding real type of x, y or z is long
|
||||
* __tg_impl_full(x, y, cfnl, cfn, cfnf, fnl, fn, fnf, ...)
|
||||
* Invokes [c]fnl() if the corresponding real type of x or y is long
|
||||
* double, [c]fn() if it is double or any has an integer type, and
|
||||
* [c]fnf() otherwise. The function with the 'c' prefix is called if
|
||||
* any of x, y or z is a complex number.
|
||||
* any of x or y is a complex number.
|
||||
* Both macros call the chosen function with all additional arguments passed
|
||||
* to them, as given by __VA_ARGS__.
|
||||
*
|
||||
@ -52,45 +55,59 @@
|
||||
* double complex regardless of the argument types.
|
||||
*/
|
||||
|
||||
#if __GNUC_PREREQ__(3, 1)
|
||||
#define __tg_type(e, t) __builtin_types_compatible_p(__typeof__(e), t)
|
||||
#define __tg_type3(e1, e2, e3, t) \
|
||||
(__tg_type(e1, t) || __tg_type(e2, t) || __tg_type(e3, t))
|
||||
#define __tg_type_corr(e1, e2, e3, t) \
|
||||
(__tg_type3(e1, e2, e3, t) || __tg_type3(e1, e2, e3, t _Complex))
|
||||
#define __tg_integer(e1, e2, e3) \
|
||||
(((__typeof__(e1))1.5 == 1) || ((__typeof__(e2))1.5 == 1) || \
|
||||
((__typeof__(e3))1.5 == 1))
|
||||
#define __tg_is_complex(e1, e2, e3) \
|
||||
(__tg_type3(e1, e2, e3, float _Complex) || \
|
||||
__tg_type3(e1, e2, e3, double _Complex) || \
|
||||
__tg_type3(e1, e2, e3, long double _Complex) || \
|
||||
__tg_type3(e1, e2, e3, __typeof__(_Complex_I)))
|
||||
|
||||
#define __tg_impl_simple(x, y, z, fn, fnf, fnl, ...) \
|
||||
__builtin_choose_expr(__tg_type_corr(x, y, z, long double), \
|
||||
fnl(__VA_ARGS__), __builtin_choose_expr( \
|
||||
__tg_type_corr(x, y, z, double) || __tg_integer(x, y, z),\
|
||||
fn(__VA_ARGS__), fnf(__VA_ARGS__)))
|
||||
|
||||
#define __tg_impl_full(x, y, z, fn, fnf, fnl, cfn, cfnf, cfnl, ...) \
|
||||
__builtin_choose_expr(__tg_is_complex(x, y, z), \
|
||||
__tg_impl_simple(x, y, z, cfn, cfnf, cfnl, __VA_ARGS__), \
|
||||
__tg_impl_simple(x, y, z, fn, fnf, fnl, __VA_ARGS__))
|
||||
|
||||
#else /* __GNUC__ */
|
||||
#ifndef __generic
|
||||
#error "<tgmath.h> not implemented for this compiler"
|
||||
#endif /* !__GNUC__ */
|
||||
#endif
|
||||
|
||||
#define __tg_generic_simple(x, fnl, fn, fnf) \
|
||||
__generic(x, long double _Complex, fnl, \
|
||||
__generic(x, double _Complex, fn, \
|
||||
__generic(x, float _Complex, fnf, \
|
||||
__generic(x, long double, fnl, \
|
||||
__generic(x, float, fnf, fn)))))
|
||||
#define __tg_impl_simple(x, y, z, fnl, fn, fnf, ...) \
|
||||
__tg_generic_simple(x, \
|
||||
__tg_generic_simple(y, \
|
||||
__tg_generic_simple(z, fnl, fnl, fnl), \
|
||||
__tg_generic_simple(z, fnl, fnl, fnl), \
|
||||
__tg_generic_simple(z, fnl, fnl, fnl)), \
|
||||
__tg_generic_simple(y, \
|
||||
__tg_generic_simple(z, fnl, fnl, fnl), \
|
||||
__tg_generic_simple(z, fnl, fn , fn ), \
|
||||
__tg_generic_simple(z, fnl, fn , fn )), \
|
||||
__tg_generic_simple(y, \
|
||||
__tg_generic_simple(z, fnl, fnl, fnl), \
|
||||
__tg_generic_simple(z, fnl, fn , fn ), \
|
||||
__tg_generic_simple(z, fnl, fn , fnf)))(__VA_ARGS__)
|
||||
#define __tg_generic_full(x, cfnl, cfn, cfnf, fnl, fn, fnf) \
|
||||
__generic(x, long double _Complex, cfnl, \
|
||||
__generic(x, double _Complex, cfn, \
|
||||
__generic(x, float _Complex, cfnf, \
|
||||
__generic(x, long double, fnl, \
|
||||
__generic(x, float, fnf, fn)))))
|
||||
#define __tg_impl_full(x, y, cfnl, cfn, cfnf, fnl, fn, fnf, ...) \
|
||||
__tg_generic_full(x, \
|
||||
__tg_generic_full(y, cfnl, cfnl, cfnl, cfnl, cfnl, cfnl), \
|
||||
__tg_generic_full(y, cfnl, cfn , cfn , cfnl, cfn , cfn ), \
|
||||
__tg_generic_full(y, cfnl, cfn , cfnf, cfnl, cfn , cfnf), \
|
||||
__tg_generic_full(y, cfnl, cfnl, cfnl, fnl , fnl , fnl ), \
|
||||
__tg_generic_full(y, cfnl, cfn , cfn , fnl , fn , fn ), \
|
||||
__tg_generic_full(y, cfnl, cfn , cfnf, fnl , fn , fnf )) \
|
||||
(__VA_ARGS__)
|
||||
|
||||
/* Macros to save lots of repetition below */
|
||||
#define __tg_simple(x, fn) \
|
||||
__tg_impl_simple(x, x, x, fn, fn##f, fn##l, x)
|
||||
__tg_impl_simple(x, x, x, fn##l, fn, fn##f, x)
|
||||
#define __tg_simple2(x, y, fn) \
|
||||
__tg_impl_simple(x, x, y, fn, fn##f, fn##l, x, y)
|
||||
__tg_impl_simple(x, x, y, fn##l, fn, fn##f, x, y)
|
||||
#define __tg_simple3(x, y, z, fn) \
|
||||
__tg_impl_simple(x, y, z, fn##l, fn, fn##f, x, y, z)
|
||||
#define __tg_simplev(x, fn, ...) \
|
||||
__tg_impl_simple(x, x, x, fn, fn##f, fn##l, __VA_ARGS__)
|
||||
__tg_impl_simple(x, x, x, fn##l, fn, fn##f, __VA_ARGS__)
|
||||
#define __tg_full(x, fn) \
|
||||
__tg_impl_full(x, x, x, fn, fn##f, fn##l, c##fn, c##fn##f, c##fn##l, x)
|
||||
__tg_impl_full(x, x, c##fn##l, c##fn, c##fn##f, fn##l, fn, fn##f, x)
|
||||
#define __tg_full2(x, y, fn) \
|
||||
__tg_impl_full(x, y, c##fn##l, c##fn, c##fn##f, fn##l, fn, fn##f, x, y)
|
||||
|
||||
/* 7.22#4 -- These macros expand to real or complex functions, depending on
|
||||
* the type of their arguments. */
|
||||
@ -108,13 +125,12 @@
|
||||
#define tanh(x) __tg_full(x, tanh)
|
||||
#define exp(x) __tg_full(x, exp)
|
||||
#define log(x) __tg_full(x, log)
|
||||
#define pow(x, y) __tg_impl_full(x, x, y, pow, powf, powl, \
|
||||
cpow, cpowf, cpowl, x, y)
|
||||
#define pow(x, y) __tg_full2(x, y, pow)
|
||||
#define sqrt(x) __tg_full(x, sqrt)
|
||||
|
||||
/* "The corresponding type-generic macro for fabs and cabs is fabs." */
|
||||
#define fabs(x) __tg_impl_full(x, x, x, fabs, fabsf, fabsl, \
|
||||
cabs, cabsf, cabsl, x)
|
||||
#define fabs(x) __tg_impl_full(x, x, cabsl, cabs, cabsf, \
|
||||
fabsl, fabs, fabsf, x)
|
||||
|
||||
/* 7.22#5 -- These macros are only defined for arguments with real type. */
|
||||
#define atan2(x, y) __tg_simple2(x, y, atan2)
|
||||
@ -127,7 +143,7 @@
|
||||
#define expm1(x) __tg_simple(x, expm1)
|
||||
#define fdim(x, y) __tg_simple2(x, y, fdim)
|
||||
#define floor(x) __tg_simple(x, floor)
|
||||
#define fma(x, y, z) __tg_impl_simple(x, y, z, fma, fmaf, fmal, x, y, z)
|
||||
#define fma(x, y, z) __tg_simple3(x, y, z, fma)
|
||||
#define fmax(x, y) __tg_simple2(x, y, fmax)
|
||||
#define fmin(x, y) __tg_simple2(x, y, fmin)
|
||||
#define fmod(x, y) __tg_simple2(x, y, fmod)
|
||||
@ -148,8 +164,8 @@
|
||||
#define nextafter(x, y) __tg_simple2(x, y, nextafter)
|
||||
#define nexttoward(x, y) __tg_simplev(x, nexttoward, x, y)
|
||||
#define remainder(x, y) __tg_simple2(x, y, remainder)
|
||||
#define remquo(x, y, z) __tg_impl_simple(x, x, y, remquo, remquof, \
|
||||
remquol, x, y, z)
|
||||
#define remquo(x, y, z) __tg_impl_simple(x, x, y, remquol, remquo, \
|
||||
remquof, x, y, z)
|
||||
#define rint(x) __tg_simple(x, rint)
|
||||
#define round(x) __tg_simple(x, round)
|
||||
#define scalbn(x, y) __tg_simplev(x, scalbn, x, y)
|
||||
|
@ -127,8 +127,8 @@ SRCS+= ${_src}
|
||||
KQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
|
||||
lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
|
||||
subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
|
||||
KSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c index.c mcount.c rindex.c \
|
||||
strcat.c strcmp.c strcpy.c strlen.c strncpy.c
|
||||
KSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c mcount.c strcat.c strchr.c \
|
||||
strcmp.c strcpy.c strlen.c strncpy.c strrchr.c
|
||||
|
||||
libkern: libkern.gen libkern.${LIBC_ARCH}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
|
||||
# $FreeBSD$
|
||||
|
||||
MDSRCS+=bcmp.c bcopy.S bzero.S ffs.S index.c memchr.c memcmp.S memcpy.S \
|
||||
memmove.S memset.S rindex.c strcat.c strchr.c strcmp.S strcpy.c \
|
||||
strlen.S strncmp.S strrchr.c swab.c wcschr.c wcscmp.c wcslen.c \
|
||||
wmemchr.c
|
||||
MDSRCS+=bcmp.c bcopy.S bzero.S ffs.S memchr.c memcmp.S memcpy.S \
|
||||
memmove.S memset.S strcat.c strchr.c strcmp.S strcpy.c strlen.S \
|
||||
strncmp.S strrchr.c swab.c wcschr.c wcscmp.c wcslen.c wmemchr.c
|
||||
|
@ -159,7 +159,7 @@ execvPe(const char *name, const char *path, char * const *argv,
|
||||
eacces = 0;
|
||||
|
||||
/* If it's an absolute or relative path name, it's easy. */
|
||||
if (index(name, '/')) {
|
||||
if (strchr(name, '/')) {
|
||||
bp = name;
|
||||
cur = NULL;
|
||||
goto retry;
|
||||
|
@ -78,7 +78,7 @@ getttyent(void)
|
||||
if (!fgets(p = line, lbsize, tf))
|
||||
return (NULL);
|
||||
/* extend buffer if line was too big, and retry */
|
||||
while (!index(p, '\n') && !feof(tf)) {
|
||||
while (!strchr(p, '\n') && !feof(tf)) {
|
||||
i = strlen(p);
|
||||
lbsize += MALLOCCHUNK;
|
||||
if ((p = realloc(line, lbsize)) == NULL) {
|
||||
@ -148,7 +148,7 @@ getttyent(void)
|
||||
tty.ty_comment = p;
|
||||
if (*p == 0)
|
||||
tty.ty_comment = 0;
|
||||
if ( (p = index(p, '\n')) )
|
||||
if ((p = strchr(p, '\n')))
|
||||
*p = '\0';
|
||||
return (&tty);
|
||||
}
|
||||
@ -196,7 +196,7 @@ static char *
|
||||
value(char *p)
|
||||
{
|
||||
|
||||
return ((p = index(p, '=')) ? ++p : NULL);
|
||||
return ((p = strchr(p, '=')) ? ++p : NULL);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -59,7 +59,7 @@ timezone(int zone, int dst)
|
||||
*end;
|
||||
|
||||
if ( (beg = getenv("TZNAME")) ) { /* set in environment */
|
||||
if ( (end = index(beg, ',')) ) {/* "PST,PDT" */
|
||||
if ((end = strchr(beg, ','))) { /* "PST,PDT" */
|
||||
if (dst)
|
||||
return(++end);
|
||||
*end = '\0';
|
||||
|
@ -1,7 +1,6 @@
|
||||
# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
|
||||
# $FreeBSD$
|
||||
|
||||
MDSRCS+=bcmp.S bcopy.S bzero.S ffs.S index.S memchr.S memcmp.S memcpy.S \
|
||||
memmove.S memset.S rindex.S strcat.S strchr.S strcmp.S strcpy.S \
|
||||
strncmp.S strrchr.S swab.S wcschr.S wcscmp.S wcslen.S \
|
||||
wmemchr.S
|
||||
MDSRCS+=bcmp.S bcopy.S bzero.S ffs.S memchr.S memcmp.S memcpy.S memmove.S \
|
||||
memset.S strcat.S strchr.S strcmp.S strcpy.S strncmp.S strrchr.S \
|
||||
swab.S wcschr.S wcscmp.S wcslen.S wmemchr.S
|
||||
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1993 Winning Strategies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Winning Strategies, Inc.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* index(s, c)
|
||||
* return a pointer to the first occurance of the character c in
|
||||
* string s, or NULL if c does not occur in the string.
|
||||
*
|
||||
* %edx - pointer iterating through string
|
||||
* %eax - pointer to first occurance of 'c'
|
||||
* %cl - character we're comparing against
|
||||
* %bl - character at %edx
|
||||
*
|
||||
* Written by:
|
||||
* J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
|
||||
*/
|
||||
|
||||
ENTRY(index)
|
||||
pushl %ebx
|
||||
movl 8(%esp),%eax
|
||||
movb 12(%esp),%cl
|
||||
.align 2,0x90
|
||||
L1:
|
||||
movb (%eax),%bl
|
||||
cmpb %bl,%cl /* found char??? */
|
||||
je L2
|
||||
incl %eax
|
||||
testb %bl,%bl /* null terminator??? */
|
||||
jne L1
|
||||
xorl %eax,%eax
|
||||
L2:
|
||||
popl %ebx
|
||||
ret
|
||||
END(index)
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1993 Winning Strategies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Winning Strategies, Inc.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* rindex(s, c)
|
||||
* return a pointer to the last occurance of the character c in
|
||||
* string s, or NULL if c does not occur in the string.
|
||||
*
|
||||
* %edx - pointer iterating through string
|
||||
* %eax - pointer to last occurance of 'c'
|
||||
* %cl - character we're comparing against
|
||||
* %bl - character at %edx
|
||||
*
|
||||
* Written by:
|
||||
* J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
|
||||
*/
|
||||
|
||||
ENTRY(rindex)
|
||||
pushl %ebx
|
||||
movl 8(%esp),%edx
|
||||
movb 12(%esp),%cl
|
||||
xorl %eax,%eax /* init pointer to null */
|
||||
.align 2,0x90
|
||||
L1:
|
||||
movb (%edx),%bl
|
||||
cmpb %bl,%cl
|
||||
jne L2
|
||||
movl %edx,%eax
|
||||
L2:
|
||||
incl %edx
|
||||
testb %bl,%bl /* null terminator??? */
|
||||
jne L1
|
||||
popl %ebx
|
||||
ret
|
||||
END(rindex)
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
@ -63,4 +63,6 @@ L2:
|
||||
ret
|
||||
END(strchr)
|
||||
|
||||
WEAK_ALIAS(index, strchr)
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
|
@ -64,4 +64,6 @@ L2:
|
||||
ret
|
||||
END(strrchr)
|
||||
|
||||
WEAK_ALIAS(rindex, strrchr)
|
||||
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
|
@ -1,8 +1,8 @@
|
||||
# $NetBSD: Makefile.inc,v 1.2 2000/10/10 21:51:54 jeffs Exp $
|
||||
# $FreeBSD$
|
||||
|
||||
SRCS+= bcmp.S bcopy.S bzero.S ffs.S index.S memchr.c memcmp.c memset.c \
|
||||
SRCS+= bcmp.S bcopy.S bzero.S ffs.S memchr.c memcmp.c memset.c \
|
||||
memcpy.S memmove.S \
|
||||
rindex.S strcat.c strcmp.S strcpy.c strcspn.c strlen.S \
|
||||
strncat.c strncmp.c strncpy.c strpbrk.c strsep.c \
|
||||
strcat.c strchr.S strcmp.S strcpy.c strcspn.c strlen.S \
|
||||
strncat.c strncmp.c strncpy.c strrchr.S strpbrk.c strsep.c \
|
||||
strspn.c strstr.c swab.c
|
||||
|
@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
|
||||
.abicalls
|
||||
#endif
|
||||
|
||||
LEAF(index)
|
||||
LEAF(strchr)
|
||||
1:
|
||||
lbu a2, 0(a0) # get a byte
|
||||
PTR_ADDU a0, a0, 1
|
||||
@ -56,4 +56,6 @@ notfnd:
|
||||
fnd:
|
||||
PTR_SUBU v0, a0, 1
|
||||
j ra
|
||||
END(index)
|
||||
END(strchr)
|
||||
|
||||
WEAK_ALIAS(index, strchr)
|
@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
|
||||
.abicalls
|
||||
#endif
|
||||
|
||||
LEAF(rindex)
|
||||
LEAF(strrchr)
|
||||
move v0, zero # default if not found
|
||||
1:
|
||||
lbu a3, 0(a0) # get a byte
|
||||
@ -54,4 +54,6 @@ LEAF(rindex)
|
||||
2:
|
||||
bne a3, zero, 1b # continue if not end
|
||||
j ra
|
||||
END(rindex)
|
||||
END(strrchr)
|
||||
|
||||
WEAK_ALIAS(rindex, strrchr)
|
@ -91,7 +91,7 @@ _gethostbynis(const char *name, char *map, int af, struct hostent *he,
|
||||
free(result);
|
||||
result = (char *)&ypbuf;
|
||||
|
||||
if ((cp = index(result, '\n')))
|
||||
if ((cp = strchr(result, '\n')))
|
||||
*cp = '\0';
|
||||
|
||||
cp = strpbrk(result, " \t");
|
||||
|
@ -80,7 +80,7 @@ _getnetbynis(const char *name, char *map, int af, struct netent *ne,
|
||||
free(result);
|
||||
result = (char *)&ypbuf;
|
||||
|
||||
if ((cp = index(result, '\n')))
|
||||
if ((cp = strchr(result, '\n')))
|
||||
*cp = '\0';
|
||||
|
||||
cp = strpbrk(result, " \t");
|
||||
|
@ -7,8 +7,8 @@ CFLAGS+= -I${.CURDIR}/locale
|
||||
|
||||
# machine-independent string sources
|
||||
MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \
|
||||
index.c memccpy.c memchr.c memrchr.c memcmp.c \
|
||||
memcpy.c memmem.c memmove.c memset.c rindex.c \
|
||||
memccpy.c memchr.c memrchr.c memcmp.c \
|
||||
memcpy.c memmem.c memmove.c memset.c \
|
||||
stpcpy.c stpncpy.c strcasecmp.c \
|
||||
strcat.c strcasestr.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c \
|
||||
strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c \
|
||||
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)rindex.c 8.1 (Berkeley) 6/4/93";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef STRRCHR
|
||||
#include <string.h>
|
||||
|
||||
char *
|
||||
strrchr
|
||||
#else
|
||||
#include <strings.h>
|
||||
|
||||
char *
|
||||
rindex
|
||||
#endif
|
||||
(const char *p, int ch)
|
||||
{
|
||||
char *save;
|
||||
char c;
|
||||
|
||||
c = ch;
|
||||
for (save = NULL;; ++p) {
|
||||
if (*p == c)
|
||||
save = (char *)p;
|
||||
if (*p == '\0')
|
||||
return (save);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
@ -1,5 +1,54 @@
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)index.c 8.1 (Berkeley) 6/4/93";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#define STRCHR
|
||||
#include "index.c"
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
char *
|
||||
strchr(const char *p, int ch)
|
||||
{
|
||||
char c;
|
||||
|
||||
c = ch;
|
||||
for (;; ++p) {
|
||||
if (*p == c)
|
||||
return ((char *)p);
|
||||
if (*p == '\0')
|
||||
return (NULL);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
__weak_reference(strchr, index);
|
||||
|
@ -1,5 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)rindex.c 8.1 (Berkeley) 6/4/93";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#define STRRCHR
|
||||
#include "rindex.c"
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
char *
|
||||
strrchr(const char *p, int ch)
|
||||
{
|
||||
char *save;
|
||||
char c;
|
||||
|
||||
c = ch;
|
||||
for (save = NULL;; ++p) {
|
||||
if (*p == c)
|
||||
save = (char *)p;
|
||||
if (*p == '\0')
|
||||
return (save);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
__weak_reference(strrchr, rindex);
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" @(#)chroot.2 8.1 (Berkeley) 6/4/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd June 4, 1993
|
||||
.Dd January 3, 2012
|
||||
.Dt CHROOT 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -134,9 +134,27 @@ The
|
||||
.Fn chroot
|
||||
system call appeared in
|
||||
.Bx 4.2 .
|
||||
It was marked as
|
||||
.Dq legacy
|
||||
in
|
||||
.St -susv2 ,
|
||||
and was removed in subsequent standards.
|
||||
.Sh BUGS
|
||||
If the process is able to change its working directory to the target
|
||||
directory, but another access control check fails (such as a check for
|
||||
open directories, or a MAC check), it is possible that this system
|
||||
call may return an error, with the working directory of the process
|
||||
left changed.
|
||||
.Sh SECURITY CONSIDERATIONS
|
||||
The system have many hardcoded paths to files where it may load after
|
||||
the process starts.
|
||||
It is generally recommended to drop privileges immediately after a
|
||||
successful
|
||||
.Nm
|
||||
call,
|
||||
and restrict write access to a limited subtree of the
|
||||
.Nm
|
||||
root,
|
||||
for instance,
|
||||
setup the sandbox so that the sandboxed user will have no write
|
||||
access to any well-known system directories.
|
||||
|
@ -137,7 +137,7 @@ cam_get_device(const char *path, char *dev_name, int devnamelen, int *unit)
|
||||
*/
|
||||
if (*tmpstr == '/') {
|
||||
tmpstr2 = tmpstr;
|
||||
tmpstr = (char *)rindex(tmpstr2, '/');
|
||||
tmpstr = strrchr(tmpstr2, '/');
|
||||
if ((tmpstr != NULL) && (*tmpstr != '\0'))
|
||||
tmpstr++;
|
||||
}
|
||||
|
@ -200,10 +200,6 @@ Number of cache load STLB hits
|
||||
.Pq Event 08H , Umask 20H
|
||||
Number of DTLB cache load misses where the low part of the linear to
|
||||
physical address translation was missed.
|
||||
.It Li DTLB_LOAD_MISSES.PDP_MISS
|
||||
.Pq Event 08H , Umask 40H
|
||||
Number of DTLB cache load misses where the high part of the linear to
|
||||
physical address translation was missed.
|
||||
.It Li DTLB_LOAD_MISSES.LARGE_WALK_COMPLETED
|
||||
.Pq Event 08H , Umask 80H
|
||||
Counts number of completed large page walks due to load miss in the STLB.
|
||||
@ -646,10 +642,6 @@ Counter 0, 1 only
|
||||
Counts all data reads and writes (speculated and retired) from cacheable
|
||||
memory, including locked operations.
|
||||
Counter 0, 1 only
|
||||
.It Li L1D_PEND_MISS.LOAD_BUFFERS_FULL
|
||||
.Pq Event 48H , Umask 02H
|
||||
Counts cycles of L1 data cache load fill buffers full.
|
||||
Counter 0, 1 only
|
||||
.It Li DTLB_MISSES.ANY
|
||||
.Pq Event 49H , Umask 01H
|
||||
Counts the number of misses in the STLB which causes a page walk.
|
||||
@ -660,6 +652,12 @@ Counts number of misses in the STLB which resulted in a completed page walk.
|
||||
.Pq Event 49H , Umask 10H
|
||||
Counts the number of DTLB first level misses that hit in the second level
|
||||
TLB. This event is only relevant if the core contains multiple DTLB levels.
|
||||
.It Li DTLB_MISSES.PDE_MISS
|
||||
.Pq Event 49H , Umask 20H
|
||||
Number of DTLB misses caused by low part of address, includes references to 2M pages because 2M pages do not use the PDE.
|
||||
.It Li DTLB_MISSES.LARGE_WALK_COMPLETED
|
||||
.Pq Event 49H , Umask 80H
|
||||
Counts number of misses in the STLB which resulted in a completed page walk for large pages.
|
||||
.It Li LOAD_HIT_PRE
|
||||
.Pq Event 4CH , Umask 01H
|
||||
Counts load operations sent to the L1 data cache while a previous SSE
|
||||
@ -1205,9 +1203,6 @@ The BPU clear leads to 2 cycle bubble in the Front End.
|
||||
.Pq Event E8H , Umask 02H
|
||||
Counts late Branch Prediction Unit clears due to Most Recently Used
|
||||
conflicts. The PBU clear leads to a 3 cycle bubble in the Front End.
|
||||
.It Li BPU_CLEARS.ANY
|
||||
.Pq Event E8H , Umask 03H
|
||||
Counts all BPU clears.
|
||||
.It Li L2_TRANSACTIONS.LOAD
|
||||
.Pq Event F0H , Umask 01H
|
||||
Counts L2 load operations due to HW prefetch or demand loads.
|
||||
|
@ -54,10 +54,10 @@ SRCS+= ntoh.c
|
||||
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \
|
||||
${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \
|
||||
${MACHINE_CPUARCH} == "arm"
|
||||
SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
|
||||
memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
|
||||
strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
|
||||
strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
|
||||
SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \
|
||||
memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
|
||||
strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \
|
||||
strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
|
||||
.endif
|
||||
.if ${MACHINE_CPUARCH} == "arm"
|
||||
.PATH: ${.CURDIR}/../libc/arm/gen
|
||||
@ -65,10 +65,9 @@ SRCS+= divsi3.S
|
||||
.endif
|
||||
.if ${MACHINE_CPUARCH} == "ia64"
|
||||
.PATH: ${.CURDIR}/../libc/ia64/string
|
||||
SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \
|
||||
memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \
|
||||
strcmp.c strcpy.c strcspn.c strlen.c \
|
||||
strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
|
||||
SRCS+= bcmp.c bcopy.S bzero.S ffs.S memccpy.c memchr.c memcmp.c memcpy.S \
|
||||
memmove.S memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \
|
||||
strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
|
||||
strspn.c strstr.c strtok.c swab.c
|
||||
|
||||
.PATH: ${.CURDIR}/../libc/ia64/gen
|
||||
|
@ -703,13 +703,13 @@ setenv_(u_char *cp, u_char *ep, struct dhcp_opt *opts)
|
||||
u_char *s = NULL; /* semicolon ? */
|
||||
|
||||
/* skip leading whitespace */
|
||||
while (*endv && index(" \t\n\r", *endv))
|
||||
while (*endv && strchr(" \t\n\r", *endv))
|
||||
endv++;
|
||||
vp = index(endv, '='); /* find name=value separator */
|
||||
vp = strchr(endv, '='); /* find name=value separator */
|
||||
if (!vp)
|
||||
break;
|
||||
*vp++ = 0;
|
||||
if (op->fmt == __ILIST && (s = index(vp, ';')))
|
||||
if (op->fmt == __ILIST && (s = strchr(vp, ';')))
|
||||
*s++ = '\0';
|
||||
setenv(endv, vp, 1);
|
||||
vp = s; /* prepare for next round */
|
||||
|
@ -110,7 +110,7 @@
|
||||
.Fn tss_set "tss_t key" "void *val"
|
||||
.Sh DESCRIPTION
|
||||
As of
|
||||
.St -isoC-11 ,
|
||||
.St -isoC-2011 ,
|
||||
the C standard includes an API for writing multithreaded applications.
|
||||
Since POSIX.1 already includes a threading API that is used by virtually
|
||||
any multithreaded application, the interface provided by the C standard
|
||||
@ -252,7 +252,7 @@ code
|
||||
.Xr pthread 3
|
||||
.Sh STANDARDS
|
||||
These functions are expected to conform to
|
||||
.St -isoC-11 .
|
||||
.St -isoC-2011 .
|
||||
.Sh HISTORY
|
||||
These functions appeared in
|
||||
.Fx 10.0 .
|
||||
|
@ -144,6 +144,7 @@ int pw_equal(const struct passwd *_pw1, const struct passwd *_pw2);
|
||||
void pw_fini(void);
|
||||
int pw_init(const char *_dir, const char *_master);
|
||||
char *pw_make(const struct passwd *_pw);
|
||||
char *pw_make_v7(const struct passwd *_pw);
|
||||
int pw_mkdb(const char *_user);
|
||||
int pw_lock(void);
|
||||
struct passwd *pw_scan(const char *_line, int _flags);
|
||||
|
@ -406,7 +406,21 @@ pw_make(const struct passwd *pw)
|
||||
pw->pw_passwd, (uintmax_t)pw->pw_uid, (uintmax_t)pw->pw_gid,
|
||||
pw->pw_class, (uintmax_t)pw->pw_change, (uintmax_t)pw->pw_expire,
|
||||
pw->pw_gecos, pw->pw_dir, pw->pw_shell);
|
||||
return line;
|
||||
return (line);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a passwd line (in v7 format) out of a struct passwd
|
||||
*/
|
||||
char *
|
||||
pw_make_v7(const struct passwd *pw)
|
||||
{
|
||||
char *line;
|
||||
|
||||
asprintf(&line, "%s:*:%ju:%ju:%s:%s:%s", pw->pw_name,
|
||||
(uintmax_t)pw->pw_uid, (uintmax_t)pw->pw_gid,
|
||||
pw->pw_gecos, pw->pw_dir, pw->pw_shell);
|
||||
return (line);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -84,7 +84,7 @@ hasquota(struct fstab *fs, int type, char *qfnamep, int qfbufsize)
|
||||
}
|
||||
strcpy(buf, fs->fs_mntops);
|
||||
for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) {
|
||||
if ((cp = index(opt, '=')))
|
||||
if ((cp = strchr(opt, '=')))
|
||||
*cp++ = '\0';
|
||||
if (type == USRQUOTA && strcmp(opt, usrname) == 0)
|
||||
break;
|
||||
|
@ -198,36 +198,205 @@ get_planar:
|
||||
return 0; /* XXX black? */
|
||||
}
|
||||
|
||||
/*
|
||||
* Symmetric Double Step Line Algorithm by Brian Wyvill from
|
||||
* "Graphics Gems", Academic Press, 1990.
|
||||
*/
|
||||
|
||||
#define SL_SWAP(a,b) {a^=b; b^=a; a^=b;}
|
||||
#define SL_ABSOLUTE(i,j,k) ( (i-j)*(k = ( (i-j)<0 ? -1 : 1)))
|
||||
|
||||
void
|
||||
plot(VGLBitmap * object, int x, int y, int flag, byte color)
|
||||
{
|
||||
/* non-zero flag indicates the pixels need swapping back. */
|
||||
if (flag)
|
||||
VGLSetXY(object, y, x, color);
|
||||
else
|
||||
VGLSetXY(object, x, y, color);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color)
|
||||
{
|
||||
int d, x, y, ax, ay, sx, sy, dx, dy;
|
||||
int dx, dy, incr1, incr2, D, x, y, xend, c, pixels_left;
|
||||
int sign_x, sign_y, step, reverse, i;
|
||||
|
||||
dx = x2-x1; ax = ABS(dx)<<1; sx = SGN(dx); x = x1;
|
||||
dy = y2-y1; ay = ABS(dy)<<1; sy = SGN(dy); y = y1;
|
||||
dx = SL_ABSOLUTE(x2, x1, sign_x);
|
||||
dy = SL_ABSOLUTE(y2, y1, sign_y);
|
||||
/* decide increment sign by the slope sign */
|
||||
if (sign_x == sign_y)
|
||||
step = 1;
|
||||
else
|
||||
step = -1;
|
||||
|
||||
if (ax>ay) { /* x dominant */
|
||||
d = ay-(ax>>1);
|
||||
for (;;) {
|
||||
VGLSetXY(object, x, y, color);
|
||||
if (x==x2)
|
||||
break;
|
||||
if (d>=0) {
|
||||
y += sy; d -= ax;
|
||||
}
|
||||
x += sx; d += ay;
|
||||
}
|
||||
if (dy > dx) { /* chooses axis of greatest movement (make dx) */
|
||||
SL_SWAP(x1, y1);
|
||||
SL_SWAP(x2, y2);
|
||||
SL_SWAP(dx, dy);
|
||||
reverse = 1;
|
||||
} else
|
||||
reverse = 0;
|
||||
/* note error check for dx==0 should be included here */
|
||||
if (x1 > x2) { /* start from the smaller coordinate */
|
||||
x = x2;
|
||||
y = y2;
|
||||
/* x1 = x1;
|
||||
y1 = y1; */
|
||||
} else {
|
||||
x = x1;
|
||||
y = y1;
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
}
|
||||
else { /* y dominant */
|
||||
d = ax-(ay>>1);
|
||||
for (;;) {
|
||||
VGLSetXY(object, x, y, color);
|
||||
if (y==y2)
|
||||
break;
|
||||
if (d>=0) {
|
||||
x += sx; d -= ay;
|
||||
|
||||
|
||||
/* Note dx=n implies 0 - n or (dx+1) pixels to be set */
|
||||
/* Go round loop dx/4 times then plot last 0,1,2 or 3 pixels */
|
||||
/* In fact (dx-1)/4 as 2 pixels are already plotted */
|
||||
xend = (dx - 1) / 4;
|
||||
pixels_left = (dx - 1) % 4; /* number of pixels left over at the
|
||||
* end */
|
||||
plot(object, x, y, reverse, color);
|
||||
if (pixels_left < 0)
|
||||
return; /* plot only one pixel for zero length
|
||||
* vectors */
|
||||
plot(object, x1, y1, reverse, color); /* plot first two points */
|
||||
incr2 = 4 * dy - 2 * dx;
|
||||
if (incr2 < 0) { /* slope less than 1/2 */
|
||||
c = 2 * dy;
|
||||
incr1 = 2 * c;
|
||||
D = incr1 - dx;
|
||||
|
||||
for (i = 0; i < xend; i++) { /* plotting loop */
|
||||
++x;
|
||||
--x1;
|
||||
if (D < 0) {
|
||||
/* pattern 1 forwards */
|
||||
plot(object, x, y, reverse, color);
|
||||
plot(object, ++x, y, reverse, color);
|
||||
/* pattern 1 backwards */
|
||||
plot(object, x1, y1, reverse, color);
|
||||
plot(object, --x1, y1, reverse, color);
|
||||
D += incr1;
|
||||
} else {
|
||||
if (D < c) {
|
||||
/* pattern 2 forwards */
|
||||
plot(object, x, y, reverse, color);
|
||||
plot(object, ++x, y += step, reverse,
|
||||
color);
|
||||
/* pattern 2 backwards */
|
||||
plot(object, x1, y1, reverse, color);
|
||||
plot(object, --x1, y1 -= step, reverse,
|
||||
color);
|
||||
} else {
|
||||
/* pattern 3 forwards */
|
||||
plot(object, x, y += step, reverse, color);
|
||||
plot(object, ++x, y, reverse, color);
|
||||
/* pattern 3 backwards */
|
||||
plot(object, x1, y1 -= step, reverse,
|
||||
color);
|
||||
plot(object, --x1, y1, reverse, color);
|
||||
}
|
||||
D += incr2;
|
||||
}
|
||||
} /* end for */
|
||||
|
||||
/* plot last pattern */
|
||||
if (pixels_left) {
|
||||
if (D < 0) {
|
||||
plot(object, ++x, y, reverse, color); /* pattern 1 */
|
||||
if (pixels_left > 1)
|
||||
plot(object, ++x, y, reverse, color);
|
||||
if (pixels_left > 2)
|
||||
plot(object, --x1, y1, reverse, color);
|
||||
} else {
|
||||
if (D < c) {
|
||||
plot(object, ++x, y, reverse, color); /* pattern 2 */
|
||||
if (pixels_left > 1)
|
||||
plot(object, ++x, y += step, reverse, color);
|
||||
if (pixels_left > 2)
|
||||
plot(object, --x1, y1, reverse, color);
|
||||
} else {
|
||||
/* pattern 3 */
|
||||
plot(object, ++x, y += step, reverse, color);
|
||||
if (pixels_left > 1)
|
||||
plot(object, ++x, y, reverse, color);
|
||||
if (pixels_left > 2)
|
||||
plot(object, --x1, y1 -= step, reverse, color);
|
||||
}
|
||||
}
|
||||
} /* end if pixels_left */
|
||||
}
|
||||
/* end slope < 1/2 */
|
||||
else { /* slope greater than 1/2 */
|
||||
c = 2 * (dy - dx);
|
||||
incr1 = 2 * c;
|
||||
D = incr1 + dx;
|
||||
for (i = 0; i < xend; i++) {
|
||||
++x;
|
||||
--x1;
|
||||
if (D > 0) {
|
||||
/* pattern 4 forwards */
|
||||
plot(object, x, y += step, reverse, color);
|
||||
plot(object, ++x, y += step, reverse, color);
|
||||
/* pattern 4 backwards */
|
||||
plot(object, x1, y1 -= step, reverse, color);
|
||||
plot(object, --x1, y1 -= step, reverse, color);
|
||||
D += incr1;
|
||||
} else {
|
||||
if (D < c) {
|
||||
/* pattern 2 forwards */
|
||||
plot(object, x, y, reverse, color);
|
||||
plot(object, ++x, y += step, reverse,
|
||||
color);
|
||||
|
||||
/* pattern 2 backwards */
|
||||
plot(object, x1, y1, reverse, color);
|
||||
plot(object, --x1, y1 -= step, reverse,
|
||||
color);
|
||||
} else {
|
||||
/* pattern 3 forwards */
|
||||
plot(object, x, y += step, reverse, color);
|
||||
plot(object, ++x, y, reverse, color);
|
||||
/* pattern 3 backwards */
|
||||
plot(object, x1, y1 -= step, reverse, color);
|
||||
plot(object, --x1, y1, reverse, color);
|
||||
}
|
||||
D += incr2;
|
||||
}
|
||||
} /* end for */
|
||||
/* plot last pattern */
|
||||
if (pixels_left) {
|
||||
if (D > 0) {
|
||||
plot(object, ++x, y += step, reverse, color); /* pattern 4 */
|
||||
if (pixels_left > 1)
|
||||
plot(object, ++x, y += step, reverse,
|
||||
color);
|
||||
if (pixels_left > 2)
|
||||
plot(object, --x1, y1 -= step, reverse,
|
||||
color);
|
||||
} else {
|
||||
if (D < c) {
|
||||
plot(object, ++x, y, reverse, color); /* pattern 2 */
|
||||
if (pixels_left > 1)
|
||||
plot(object, ++x, y += step, reverse, color);
|
||||
if (pixels_left > 2)
|
||||
plot(object, --x1, y1, reverse, color);
|
||||
} else {
|
||||
/* pattern 3 */
|
||||
plot(object, ++x, y += step, reverse, color);
|
||||
if (pixels_left > 1)
|
||||
plot(object, ++x, y, reverse, color);
|
||||
if (pixels_left > 2) {
|
||||
if (D > c) /* step 3 */
|
||||
plot(object, --x1, y1 -= step, reverse, color);
|
||||
else /* step 2 */
|
||||
plot(object, --x1, y1, reverse, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
y += sy; d += ax;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ grscan(int search, int gid)
|
||||
return(0);
|
||||
bp = line;
|
||||
/* skip lines that are too big */
|
||||
if (!index(line, '\n')) {
|
||||
if (!strchr(line, '\n')) {
|
||||
int ch;
|
||||
|
||||
while ((ch = getc(_gr_fp)) != '\n' && ch != EOF)
|
||||
|
@ -543,16 +543,17 @@ extern char **environ;
|
||||
void
|
||||
setup_term(int fd)
|
||||
{
|
||||
char *cp = index(term+ENVSIZE, '/');
|
||||
char *cp;
|
||||
char *speed;
|
||||
struct termios tt, def;
|
||||
|
||||
cp = strchr(term + ENVSIZE, '/');
|
||||
#ifndef notyet
|
||||
tcgetattr(fd, &tt);
|
||||
if (cp) {
|
||||
*cp++ = '\0';
|
||||
speed = cp;
|
||||
cp = index(speed, '/');
|
||||
cp = strchr(speed, '/');
|
||||
if (cp)
|
||||
*cp++ = '\0';
|
||||
cfsetspeed(&tt, atoi(speed));
|
||||
@ -567,7 +568,7 @@ setup_term(int fd)
|
||||
if (cp) {
|
||||
*cp++ = '\0';
|
||||
speed = cp;
|
||||
cp = index(speed, '/');
|
||||
cp = strchr(speed, '/');
|
||||
if (cp)
|
||||
*cp++ = '\0';
|
||||
tcgetattr(fd, &tt);
|
||||
|
@ -515,10 +515,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||
ld_bind_now != NULL && *ld_bind_now != '\0', &obj_rtld, NULL) == -1)
|
||||
die();
|
||||
|
||||
if (resolve_objects_ifunc(obj_main,
|
||||
ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1)
|
||||
die();
|
||||
|
||||
dbg("doing copy relocations");
|
||||
if (do_copy_relocations(obj_main) == -1)
|
||||
die();
|
||||
@ -549,6 +545,11 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||
|
||||
map_stacks_exec(NULL);
|
||||
|
||||
dbg("resolving ifuncs");
|
||||
if (resolve_objects_ifunc(obj_main,
|
||||
ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1)
|
||||
die();
|
||||
|
||||
wlock_acquire(rtld_bind_lock, &lockstate);
|
||||
objlist_call_init(&initlist, &lockstate);
|
||||
objlist_clear(&initlist);
|
||||
|
@ -13,6 +13,7 @@ BINMAKE?=make
|
||||
SRC?=/usr/src
|
||||
CONFIG?=config
|
||||
MODULES?=-DNO_MODULES # do not build them as a default
|
||||
KERNCONF ?= PICOBSD
|
||||
|
||||
# caller will set MODULES to empty if modules are needed.
|
||||
# Indeed, it can be used to specify other Makefile options as well.
|
||||
@ -45,10 +46,10 @@ ${COMPILE}: ${CONF}/${CONFFILE}
|
||||
(cd ${CONF}; ${CONFIG} -d ${COMPILE} ${CONFFILE}; \
|
||||
cd ${COMPILE}; ${BINMAKE} KERNEL=kernel ${MODULES} depend )
|
||||
|
||||
${CONF}/${CONFFILE}: PICOBSD
|
||||
${CONF}/${CONFFILE}: ${KERNCONF}
|
||||
# -mkdir -p ${CONF} # XXX not needed yet.
|
||||
cp ${.OODATE} ${.TARGET}
|
||||
if [ -f PICOBSD.hints ] ; then cp PICOBSD.hints ${CONF}/PICOBSD.hints ; fi
|
||||
[ -f PICOBSD.hints ] && cp PICOBSD.hints ${CONF}/
|
||||
|
||||
# This part creates crunch1.conf and crunch.mk from crunch.conf
|
||||
${BUILDDIR}/crunch.mk: ${BUILDDIR}/crunch1.conf
|
||||
|
@ -105,11 +105,6 @@ set_defaults() { # no arguments
|
||||
EDITOR=${EDITOR:-vi}
|
||||
fd_size=${fd_size:-1440}
|
||||
|
||||
o_use_loader="yes" # use /boot/loader
|
||||
# You should not change it unless you are really short
|
||||
# of space, and your kernel is small enough that the
|
||||
# bootblocks manage to load it.
|
||||
|
||||
o_all_in_mfs="yes" # put all files in mfs so you can boot
|
||||
# and run the image via diskless boot.
|
||||
o_clean="" # set if you want to clean prev.builds.
|
||||
@ -166,20 +161,30 @@ set_defaults() { # no arguments
|
||||
# and also to build a specific target
|
||||
create_includes_and_libraries2() { # opt_dir opt_target
|
||||
local no
|
||||
log "create_includes_and_libraries2() for ${SRC}"
|
||||
log "create_includes_and_libraries2() for ${SRC} $1"
|
||||
if [ ${OSVERSION} -ge 600000 ] ; then
|
||||
no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1"
|
||||
else
|
||||
no="-DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R"
|
||||
fi
|
||||
MAKEOBJDIRPREFIX=${l_objtree}
|
||||
export MAKEOBJDIRPREFIX
|
||||
( cd ${SRC};
|
||||
# make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld
|
||||
if [ -d "$1" ] ; then
|
||||
cd $1 ; ${BINMAKE} ${o_par} $2 # specific target, e.g. ld-elf.so
|
||||
else
|
||||
${BINMAKE} ${o_par} _+_= $no toolchain _includes _libraries
|
||||
MAKEOBJDIRPREFIX=${l_objtree}
|
||||
export MAKEOBJDIRPREFIX
|
||||
# export WITH_RESCUE=yes # build crunchide
|
||||
# ${BINMAKE} ${o_par} _+_= $no toolchain _includes _libraries
|
||||
(
|
||||
# eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V BMAKEENV`
|
||||
eval "export XMAKE=\"`cd ${SRC}; make -f Makefile -V XMAKE`\""
|
||||
${BINMAKE} ${o_par} _+_= $no toolchain
|
||||
)
|
||||
eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV`
|
||||
${BINMAKE} ${o_par} _+_= $no _includes _libraries
|
||||
[ ${o_arch} != `uname -m` ] && \
|
||||
(cd ${l_objtree}; ln -s . ${o_arch}.${o_arch} || true )
|
||||
fi
|
||||
)
|
||||
}
|
||||
@ -242,16 +247,19 @@ set_type() { # the_type the_site
|
||||
name="" # clear in case of errors
|
||||
for i in ${c_startdir}/${a} ${PICO_TREE}/${a} ; do
|
||||
log "set_type: checking $i"
|
||||
[ -d $i -a -f $i/PICOBSD -a -f $i/crunch.conf ] || continue
|
||||
set -- `cat $i/PICOBSD | \
|
||||
[ -d $i -a -f $i/crunch.conf ] || continue
|
||||
# look for a kernel config file, privilege arch-specific
|
||||
l_kernconf=$i/PICOBSD.${o_arch}
|
||||
[ -f $l_kernconf ] || l_kernconf=$i/PICOBSD
|
||||
[ -f $l_kernconf ] || continue
|
||||
set -- `cat $l_kernconf | \
|
||||
awk '/^#PicoBSD/ {print $2, $3, $4, $5, $6}'`
|
||||
[ x"$1" != "x" ] || continue
|
||||
MFS_SIZE=$1 ; init_name=$2
|
||||
mfs_inodes=$3 ; fd_inodes=$4
|
||||
MFS_SIZE=$1
|
||||
name=`(cd $i ; pwd) `
|
||||
name=`basename $name`
|
||||
MY_TREE=$i
|
||||
BUILDDIR=${c_startdir}/build_dir-${name}
|
||||
BUILDDIR=${c_startdir}/build_dir-${name}-${o_arch}
|
||||
log "Matching file $name in $i"
|
||||
return ;
|
||||
done
|
||||
@ -328,10 +336,7 @@ main_dialog() {
|
||||
K "edit Kernel config file" \
|
||||
E "Edit crunch.conf file" \
|
||||
S "MFS Size: ${MFS_SIZE}kB" \
|
||||
I "Init type: ${init_name}" \
|
||||
F "Floppy size: ${fd_size}kB" \
|
||||
M "MFS bytes per inode: ${mfs_inodes}" \
|
||||
U "UFS bytes per inode: ${fd_inodes}" \
|
||||
$ "Site-info: ${SITE}" \
|
||||
Q "Quit" \
|
||||
2> ${c_reply}
|
||||
@ -349,12 +354,6 @@ main_dialog() {
|
||||
{ dialog --menu "Setup the type of configuration" 12 70 5 $l \
|
||||
2> ${c_reply} && set_type "`cat ${c_reply}`" ${SITE} ; } || true
|
||||
;;
|
||||
I)
|
||||
{ dialog --menu "Choose your init(8) program" \
|
||||
10 70 2 init "Standard init (requires getty)" \
|
||||
oinit "small init from TinyWare" 2> ${c_reply} \
|
||||
&& init_name=`cat ${c_reply}` ; } || true
|
||||
;;
|
||||
|
||||
K) ${EDITOR} ${MY_TREE}/PICOBSD ;;
|
||||
|
||||
@ -386,20 +385,6 @@ this as small as possible. " 10 70 2> ${c_reply} \
|
||||
2> ${c_reply} && fd_size=`cat ${c_reply}` ; } || true
|
||||
;;
|
||||
|
||||
M)
|
||||
{ dialog --title "MFS bytes per inode:" --inputbox \
|
||||
"Enter MFS bytes per inode (typically 4096..65536). \
|
||||
A larger value means fewer inodes but more space on MFS" \
|
||||
10 70 2> ${c_reply} && mfs_inodes=`cat ${c_reply}` ; } || true
|
||||
;;
|
||||
|
||||
U)
|
||||
{ dialog --title "Floppy bytes per inode:" --inputbox \
|
||||
"Enter floppy bytes per inode (typically 3072..65536). \
|
||||
A larger value means fewer inodes but more space on the floppy." \
|
||||
10 70 2> ${c_reply} && fd_inodes=`cat ${c_reply}` ; } || true
|
||||
;;
|
||||
|
||||
N) break 2
|
||||
;;
|
||||
|
||||
@ -454,8 +439,9 @@ do_kernel() { # OK
|
||||
# export CONFIG
|
||||
export WARNS CWARNFLAGS
|
||||
[ "${o_do_modules}" = "yes" ] && export MODULES=""
|
||||
${BINMAKE} ${o_par} -v -f ${PICO_TREE}/build/Makefile.conf ) || \
|
||||
fail $? missing_kernel
|
||||
${BINMAKE} ${o_par} KERNCONF=${l_kernconf} \
|
||||
-v -f ${PICO_TREE}/build/Makefile.conf ) || \
|
||||
fail $? missing_kernel
|
||||
}
|
||||
|
||||
# Populate the variable part of the floppy filesystem. Must be done before
|
||||
@ -565,7 +551,7 @@ do_links() { # rootdir varname
|
||||
# find_progs is a helper function to locate the named programs
|
||||
# or libraries in ${o_objdir} or ${_SHLIBDIRPREFIX},
|
||||
# and return the full pathnames.
|
||||
# Called as "find_progs [-L libpath] [-P binpath] prog1 prog2 ... "
|
||||
# Called as "find_progs [[-L libpath] [-P binpath]] prog1 prog2 ... "
|
||||
# On return it sets ${u_progs} to the list of programs, and ${u_libs}
|
||||
# to the list of shared libraries used.
|
||||
#
|
||||
@ -588,23 +574,32 @@ do_links() { # rootdir varname
|
||||
# }
|
||||
|
||||
find_progs() { # programs
|
||||
local i
|
||||
local oo=${o_objdir:-${_SHLIBDIRPREFIX}} # default objdir
|
||||
local lp=$oo/lib # default lib.prefix
|
||||
local o="" # additional objdir
|
||||
local pass i old_libs="" tmp o=""
|
||||
if [ x"$1" = "x-L" -a -d "$2" ] ; then # set lib search path
|
||||
o=$2; shift; shift
|
||||
lp="$lp:$o/lib:$o/usr/lib:$o/usr/local/lib"
|
||||
o="-P $o"
|
||||
o="-P $2"; shift; shift
|
||||
fi
|
||||
u_libs=""
|
||||
u_progs="`find_progs_helper $*`"
|
||||
log "looking for libs for <$u_progs> in $lp"
|
||||
# Result returned in global variables
|
||||
u_libs="" ; u_progs="`find_progs_helper $*`"
|
||||
[ -z "${u_progs}" ] && return 1 # not found, error
|
||||
i="`( LD_LIBRARY_PATH=$lp ldd ${u_progs} ) | \
|
||||
grep -v '^/' | awk '{print $1}' | sort | uniq`"
|
||||
u_libs="`find_progs_helper $o $i`"
|
||||
return 0
|
||||
# use objdump to find libraries. Iterate to fetch recursive
|
||||
# dependencies.
|
||||
tmp="${u_progs}" ; pass=1
|
||||
while [ $pass -lt 10 ] ; do
|
||||
pass=$(($pass + 1))
|
||||
i="`objdump -x ${tmp} | \
|
||||
awk '$1 == "NEEDED" { print $2 }' | sort | uniq`"
|
||||
if [ "$old_libs" = "$i" ] ; then
|
||||
log "libraries for: $my_progs ($u_progs) are ($i) $u_libs"
|
||||
log "--- done find_progs ---"
|
||||
return 0
|
||||
else
|
||||
# logverbose "old--- $old_libs --- new +++ $i +++"
|
||||
fi
|
||||
u_libs="`find_progs_helper $o $i`"
|
||||
old_libs="$i"
|
||||
tmp="$tmp $u_libs"
|
||||
done
|
||||
log "WARNING: Too many passes, giving up"
|
||||
}
|
||||
|
||||
find_progs_helper() { # programs
|
||||
@ -637,8 +632,12 @@ find_progs_helper() { # programs
|
||||
[ -d "${ldir}/${i}" ] && places="${places} ${ldir}/${i}"
|
||||
done
|
||||
fi
|
||||
for i in $progs ; do
|
||||
# full pathnames are just listed
|
||||
[ -f "$i" ] && echo $i && continue
|
||||
find ${places} -maxdepth 3 -type f -name ${i} | head -1
|
||||
done
|
||||
# use maxdepth 3 because some libs are way down
|
||||
find ${places} -maxdepth 3 -type f \( ${names} \)
|
||||
}
|
||||
|
||||
# Populate the memory filesystem with binaries and non-variable
|
||||
@ -788,7 +787,6 @@ populate_mfs_tree() {
|
||||
final_cleanup() {
|
||||
log "final_cleanup()"
|
||||
rm -rf ${c_mnt} ${c_reply} 2> /dev/null || true
|
||||
rm -f ${c_reply}
|
||||
}
|
||||
|
||||
# fail errno errcode
|
||||
@ -857,17 +855,6 @@ fill_floppy_image() {
|
||||
fi
|
||||
|
||||
log "Labeling floppy image"
|
||||
b2=${BUILDDIR}/boot2 # modified boot2
|
||||
cp -f ${c_boot2} ${b2}
|
||||
chmod 0644 ${b2}
|
||||
|
||||
if [ ${o_use_loader} = "no" ] ; then
|
||||
log "patch ${c_boot2} to boot /kernel right away"
|
||||
set `strings -at d ${b2} | grep "/boot/loader"`
|
||||
echo -e "/kernel\0\0\0\0\0" | \
|
||||
dd of=${b2} obs=$1 oseek=1 conv=notrunc 2>/dev/null
|
||||
fi
|
||||
chmod 0444 ${b2}
|
||||
|
||||
dst=${BUILDDIR}/image.tree
|
||||
rm -rf ${dst}
|
||||
@ -893,17 +880,13 @@ fill_floppy_image() {
|
||||
log "not loading mfs, size ${mfs_size} img ${imgsize}"
|
||||
fi
|
||||
log "Compress with kgzip and copy to floppy image"
|
||||
if [ ${o_use_loader} = "no" ] ; then
|
||||
kgzip -o kernel.gz kernel
|
||||
cp -p kernel.gz ${dst}/kernel || fail $? no_space "copying kernel"
|
||||
else
|
||||
gzip kernel
|
||||
mkdir -p ${dst}/boot/kernel
|
||||
echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf
|
||||
echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf
|
||||
cp -p /boot/loader ${dst}/boot/loader || fail $? no_space "copying bootloader"
|
||||
cp -p kernel.gz ${dst}/boot/kernel/kernel.gz || fail $? no_space "copying kernel"
|
||||
fi
|
||||
|
||||
mkdir -p ${dst}/boot/kernel
|
||||
# XXX update loader.conf
|
||||
echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf
|
||||
echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf
|
||||
cp -p /boot/loader ${dst}/boot/loader || fail $? no_space "copying bootloader"
|
||||
gzip -c kernel > ${dst}/boot/kernel/kernel.gz || fail $? no_space "copying kernel"
|
||||
|
||||
# now transfer the floppy tree. If it is already in mfs, dont bother.
|
||||
if [ "${o_all_in_mfs}" != "yes" ] ; then
|
||||
@ -953,10 +936,13 @@ fill_floppy_image() {
|
||||
# so we skip 276 from the source, and 276+512=788 from dst
|
||||
# the old style blocks used 512 and 1024 respectively
|
||||
|
||||
dd if=${b2} iseek=1 ibs=276 2> /dev/null | \
|
||||
dd if=${c_boot2} iseek=1 ibs=276 2> /dev/null | \
|
||||
dd of=${BUILDDIR}/${c_img} oseek=1 obs=788 conv=notrunc 2>/dev/null
|
||||
log "done disk image"
|
||||
# XXX (log "Fixing permissions"; cd ${dst}; chown -R root *)
|
||||
# leave build stuff if verbose
|
||||
[ ${o_verbose} -gt 0 ] && return
|
||||
|
||||
rm -rf ${BUILDDIR}/floppy.tree || true # cleanup
|
||||
# df -ik ${dst} | colrm 70 > .build.reply
|
||||
rm -rf ${dst}
|
||||
@ -984,9 +970,10 @@ set_build_parameters() {
|
||||
if [ ${OSVERSION} -ge 500035 ] ; then
|
||||
export MAKEOBJDIRPREFIX=${l_objtree}
|
||||
export TARGET_ARCH=${o_arch} TARGET=${o_arch}
|
||||
# XXX why change machine_arch ?
|
||||
#-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m`
|
||||
# export CWARNFLAGS="-Wextra -Wno-sign-compare -Wno-missing-field-initializers"
|
||||
eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\""
|
||||
eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV`
|
||||
fi
|
||||
|
||||
if [ "${o_init_src}" != "" ] ; then
|
||||
@ -995,6 +982,8 @@ set_build_parameters() {
|
||||
else
|
||||
create_includes_and_libraries2
|
||||
fi
|
||||
else
|
||||
eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV`
|
||||
fi
|
||||
if [ ${OSVERSION} -lt 500035 ] ; then
|
||||
# Create the right LIBS and CFLAGS for further builds.
|
||||
@ -1030,29 +1019,29 @@ set_defaults
|
||||
while [ true ]; do
|
||||
log "Parsing $1"
|
||||
case $1 in
|
||||
--par)
|
||||
o_par="-j 8"
|
||||
;;
|
||||
|
||||
--src) # set the source path instead of /usr/src
|
||||
SRC=`realpath $2`
|
||||
shift
|
||||
;;
|
||||
--init)
|
||||
|
||||
--init) # run a partial buildworld on the source tree
|
||||
o_init_src="YES"
|
||||
;;
|
||||
|
||||
--arch)
|
||||
--arch) # override the target architecture
|
||||
o_arch=$2
|
||||
shift
|
||||
;;
|
||||
|
||||
--floppy_size)
|
||||
--floppy_size) # image size
|
||||
fd_size=$2
|
||||
shift
|
||||
;;
|
||||
|
||||
--no_loader) # omit /boot/loader, just rely on boot2
|
||||
# (it may have problems with kernels > 4MB)
|
||||
o_use_loader="no"
|
||||
;;
|
||||
|
||||
--all_in_mfs)
|
||||
o_all_in_mfs="yes"
|
||||
;;
|
||||
@ -1064,6 +1053,7 @@ while [ true ]; do
|
||||
--modules) # also build kernel modules
|
||||
o_do_modules="yes"
|
||||
;;
|
||||
|
||||
-n)
|
||||
o_interactive="NO"
|
||||
;;
|
||||
|
@ -782,12 +782,12 @@ getasciilabel(FILE *f, struct disklabel *lp)
|
||||
lp->d_sbsize = 0; /* XXX */
|
||||
while (fgets(line, sizeof(line) - 1, f)) {
|
||||
lineno++;
|
||||
if ((cp = index(line,'\n')) != 0)
|
||||
if ((cp = strchr(line,'\n')) != 0)
|
||||
*cp = '\0';
|
||||
cp = skip(line);
|
||||
if (cp == NULL)
|
||||
continue;
|
||||
tp = index(cp, ':');
|
||||
tp = strchr(cp, ':');
|
||||
if (tp == NULL) {
|
||||
fprintf(stderr, "line %d: syntax error\n", lineno);
|
||||
errors++;
|
||||
|
@ -290,7 +290,7 @@ main(int argc, char *argv[])
|
||||
tape = strchr(host, ':');
|
||||
*tape++ = '\0';
|
||||
#ifdef RDUMP
|
||||
if (index(tape, '\n')) {
|
||||
if (strchr(tape, '\n')) {
|
||||
(void)fprintf(stderr, "invalid characters in tape\n");
|
||||
exit(X_STARTUP);
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ fix_extraneous(struct inoinfo *inp, struct inodesc *idesc)
|
||||
printf(" (IGNORED)\n");
|
||||
return (0);
|
||||
}
|
||||
if ((cp = rindex(oldname, '/')) == NULL) {
|
||||
if ((cp = strchr(oldname, '/')) == NULL) {
|
||||
printf(" (IGNORED)\n");
|
||||
return (0);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 17, 2011
|
||||
.Dd January 4, 2012
|
||||
.Dt IFCONFIG 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -2378,7 +2378,7 @@ interfaces:
|
||||
.It Cm vlan Ar vlan_tag
|
||||
Set the VLAN tag value to
|
||||
.Ar vlan_tag .
|
||||
This value is a 16-bit number which is used to create an 802.1Q
|
||||
This value is a 12-bit VLAN Identifier (VID) which is used to create an 802.1Q
|
||||
VLAN header for packets sent from the
|
||||
.Xr vlan 4
|
||||
interface.
|
||||
@ -2400,7 +2400,7 @@ diverted to the specified physical interface
|
||||
.Ar iface
|
||||
with 802.1Q VLAN encapsulation.
|
||||
Packets with 802.1Q encapsulation received
|
||||
by the parent interface with the correct VLAN tag will be diverted to
|
||||
by the parent interface with the correct VLAN Identifier will be diverted to
|
||||
the associated
|
||||
.Xr vlan 4
|
||||
pseudo-interface.
|
||||
@ -2439,7 +2439,8 @@ pseudo device, disassociate the parent interface from it.
|
||||
This breaks the link between the
|
||||
.Xr vlan 4
|
||||
interface and its parent,
|
||||
clears its VLAN tag, flags and its link address and shuts the interface down.
|
||||
clears its VLAN Identifier, flags and its link address and shuts the interface
|
||||
down.
|
||||
The
|
||||
.Ar iface
|
||||
argument is useless and hence deprecated.
|
||||
|
@ -122,9 +122,9 @@ ipfw_main(int oldac, char **oldav)
|
||||
break;
|
||||
if (copy) {
|
||||
arg[j++] = arg[i];
|
||||
copy = !index("," WHITESP, arg[i]);
|
||||
copy = !strchr("," WHITESP, arg[i]);
|
||||
} else {
|
||||
copy = !index(WHITESP, arg[i]);
|
||||
copy = !strchr(WHITESP, arg[i]);
|
||||
if (copy)
|
||||
arg[j++] = arg[i];
|
||||
}
|
||||
@ -141,7 +141,7 @@ ipfw_main(int oldac, char **oldav)
|
||||
* processing, this is just the number of blanks plus 1.
|
||||
*/
|
||||
for (i = 0, ac = 1; i < l; i++)
|
||||
if (index(WHITESP, arg[i]) != NULL)
|
||||
if (strchr(WHITESP, arg[i]) != NULL)
|
||||
ac++;
|
||||
|
||||
/*
|
||||
@ -162,7 +162,7 @@ ipfw_main(int oldac, char **oldav)
|
||||
*/
|
||||
av_p = (char *)&av[ac+1];
|
||||
for (ac = 1, i = j = 0; i < l; i++) {
|
||||
if (index(WHITESP, arg[i]) != NULL || i == l-1) {
|
||||
if (strchr(WHITESP, arg[i]) != NULL || i == l-1) {
|
||||
if (i == l-1)
|
||||
i++;
|
||||
bcopy(arg+j, av_p, i-j);
|
||||
@ -240,7 +240,7 @@ ipfw_main(int oldac, char **oldav)
|
||||
" ipfw sysctl -a\n");
|
||||
return 0;
|
||||
}
|
||||
s = index(av[2], '=');
|
||||
s = strchr(av[2], '=');
|
||||
if (s == NULL) {
|
||||
s = !strcmp(av[2], "-a") ? NULL : av[2];
|
||||
sysctlbyname(s, NULL, NULL, NULL, 0);
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 1, 2011
|
||||
.Dd Jan 5, 2012
|
||||
.Dt RECOVERDISK 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -124,7 +124,11 @@ recoverdisk -b 0 /dev/ad3 /somewhere
|
||||
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr dd 1
|
||||
.Xr dd 1 ,
|
||||
.Xr ada 4,
|
||||
.Xr cam 4,
|
||||
.Xr cd 4,
|
||||
.Xr da 4
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
@ -149,6 +153,18 @@ flying by.
|
||||
This is harmless and can be avoided by setting
|
||||
.Fl b
|
||||
to no more than 128kB.
|
||||
.Pp
|
||||
.Nm
|
||||
needs to know about read errors as fast as possible, i.e. retries by lower
|
||||
layers will usually slow down the operation.
|
||||
When using
|
||||
.Xr cam 4
|
||||
attached drives, you may want to set kern.cam.XX.retry_count to zero, e.g.:
|
||||
.Bd -literal
|
||||
# sysctl kern.cam.ada.retry_count=0
|
||||
# sysctl kern.cam.cd.retry_count=0
|
||||
# sysctl kern.cam.da.retry_count=0
|
||||
.Ed
|
||||
.\".Pp
|
||||
.\"When reading from optical media, a bug in the GEOM framework will
|
||||
.\"prevent it from seeing that the media has been removed.
|
||||
|
@ -123,7 +123,7 @@ main(int argc, char **argv)
|
||||
* Test for the special case where the utility is called as
|
||||
* "poweroff", for which it runs 'shutdown -p now'.
|
||||
*/
|
||||
if ((p = rindex(argv[0], '/')) == NULL)
|
||||
if ((p = strrchr(argv[0], '/')) == NULL)
|
||||
p = argv[0];
|
||||
else
|
||||
++p;
|
||||
|
@ -274,7 +274,7 @@ When using GCC, all atomic operations are executed as if they are using
|
||||
.Dv memory_order_seq_cst .
|
||||
.Pp
|
||||
Instead of using the atomic operations provided by this interface,
|
||||
.St -isoC-11
|
||||
.St -isoC-2011
|
||||
allows the atomic variables to be modified directly using built-in
|
||||
language operators.
|
||||
This behaviour cannot be emulated for older compilers.
|
||||
@ -292,7 +292,7 @@ datatypes, if supported by the CPU.
|
||||
.Xr atomic 9
|
||||
.Sh STANDARDS
|
||||
These macros attempt to conform to
|
||||
.St -isoC-11 .
|
||||
.St -isoC-2011 .
|
||||
.Sh HISTORY
|
||||
These macros appeared in
|
||||
.Fx 10.0 .
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd August 14, 2004
|
||||
.Dd January 4, 2012
|
||||
.Dt TGMATH 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -139,15 +139,24 @@ The header
|
||||
.In tgmath.h
|
||||
first appeared in
|
||||
.Fx 5.3 .
|
||||
.Sh BUGS
|
||||
The header
|
||||
.Sh COMPILER SUPPORT
|
||||
Before
|
||||
.St -isoC-2011 ,
|
||||
the header
|
||||
.In tgmath.h
|
||||
cannot be implemented with strictly conforming C code and needs
|
||||
could not be implemented with strictly conforming C code and needed
|
||||
special compiler support.
|
||||
The current implementation only works for GCC.
|
||||
.Pp
|
||||
As of
|
||||
.St -isoC-2011 ,
|
||||
this header file can be implemented using the
|
||||
.Fn _Generic
|
||||
language keyword.
|
||||
In addition to compilers that support this keyword, this header file
|
||||
works with GCC.
|
||||
.Sh BUGS
|
||||
Many of the functions mentioned here are not prototyped in
|
||||
.In math.h
|
||||
or
|
||||
.In complex.h
|
||||
as they are not yet implemented.
|
||||
This prevents the corresponding type-generic macro from working at all.
|
||||
|
@ -61,7 +61,7 @@ In addition, they are able to accept and generate inter-processor interrupts
|
||||
I/O APICs contain a redirection table, which is used to route the interrupts
|
||||
they receive from peripheral buses to one or more local APICs.
|
||||
.Pp
|
||||
Each local APIC includes one 32-bit programable timer.
|
||||
Each local APIC includes one 32-bit programmable timer.
|
||||
This driver uses them to supply kernel with one event timer named "LAPIC".
|
||||
Event timer provided by the driver supports both one-shot an periodic modes.
|
||||
Because of local APIC nature it is per-CPU.
|
||||
|
@ -251,7 +251,7 @@ status block.
|
||||
.It "bce%d: Could not allocate status block DMA memory!"
|
||||
The driver could not allocate DMA addressable memory for the controller's
|
||||
status block.
|
||||
.It "bce_d: Could not map status block DMA memory!"
|
||||
.It "bce%d: Could not map status block DMA memory!"
|
||||
The driver could not map the status block memory into the controller's DMA
|
||||
address space.
|
||||
.It "bce%d: Could not allocate statistics block DMA tag!"
|
||||
|
@ -193,7 +193,7 @@ This can be accomplished by using
|
||||
hooks.
|
||||
Master/slave events are signalled under system
|
||||
.Dv CARP .
|
||||
Subsystem specifies vhid and name of interface, where event occured.
|
||||
Subsystem specifies vhid and name of interface, where event occurred.
|
||||
Type of the message displays new state of vhid.
|
||||
Please see
|
||||
.Xr devd.conf 5
|
||||
|
@ -126,7 +126,7 @@ The BSD and SVR4/GNU variants use different schemes for encoding file
|
||||
names for members.
|
||||
.Bl -tag -width "SVR4/GNU"
|
||||
.It "BSD"
|
||||
File names that are upto 16 bytes long and which do not contain
|
||||
File names that are up to 16 bytes long and which do not contain
|
||||
embedded spaces are stored directly in the
|
||||
.Ar ar_name
|
||||
field of the archive header.
|
||||
@ -164,7 +164,7 @@ ASCII
|
||||
.Dq "A BC D"
|
||||
.Pc .
|
||||
.It "SVR4/GNU"
|
||||
File names that are upto 15 characters long are stored directly in the
|
||||
File names that are up to 15 characters long are stored directly in the
|
||||
.Ar ar_name
|
||||
field of the header, terminated by a
|
||||
.Dq Li /
|
||||
|
@ -1,7 +1,7 @@
|
||||
.\" DO NOT EDIT-- this file is automatically generated.
|
||||
.\" from FreeBSD: head/tools/build/options/makeman 221733 2011-05-10 13:01:11Z ru
|
||||
.\" $FreeBSD$
|
||||
.Dd December 2, 2011
|
||||
.Dd December 30, 2011
|
||||
.Dt SRC.CONF 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -251,6 +251,9 @@ Set to build some programs without optional bzip2 support.
|
||||
.\" from FreeBSD: head/tools/build/options/WITHOUT_CALENDAR 156932 2006-03-21 07:50:50Z ru
|
||||
Set to not build
|
||||
.Xr calendar 1 .
|
||||
.It Va WITHOUT_CAPSICUM
|
||||
.\" $FreeBSD$
|
||||
Set to not build Capsicum support into system programs.
|
||||
.It Va WITHOUT_CDDL
|
||||
.\" from FreeBSD: head/tools/build/options/WITHOUT_CDDL 163861 2006-11-01 09:02:11Z jb
|
||||
Set to not build code licensed under Sun's CDDL.
|
||||
@ -821,7 +824,7 @@ Set to not build
|
||||
.Xr ppp 8
|
||||
and related programs.
|
||||
.It Va WITHOUT_PROFILE
|
||||
.\" from FreeBSD: head/tools/build/options/WITH_PROFILE 228143 2011-11-29 19:46:17Z fjoe
|
||||
.\" from FreeBSD: head/tools/build/options/WITHOUT_PROFILE 228196 2011-12-02 09:09:54Z fjoe
|
||||
Set to avoid compiling profiled libraries.
|
||||
.It Va WITHOUT_QUOTAS
|
||||
.\" from FreeBSD: head/tools/build/options/WITHOUT_QUOTAS 183242 2008-09-21 22:02:26Z sam
|
||||
|
@ -164,6 +164,7 @@ MAN= accept_filter.9 \
|
||||
mbuf_tags.9 \
|
||||
MD5.9 \
|
||||
mdchain.9 \
|
||||
memcchr.9 \
|
||||
memguard.9 \
|
||||
microseq.9 \
|
||||
microtime.9 \
|
||||
|
59
share/man/man9/memcchr.9
Normal file
59
share/man/man9/memcchr.9
Normal file
@ -0,0 +1,59 @@
|
||||
.\" Copyright (c) 2012 Ed Schouten <ed@FreeBSD.org>
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd January 1, 2012
|
||||
.Dt MEMCCHR 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm memcchr
|
||||
.Nd locate the complement of a byte in byte string
|
||||
.Sh SYNOPSIS
|
||||
.In sys/libkern.h
|
||||
.Ft void *
|
||||
.Fn memcchr "const void *b" "int c" "size_t len"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn memcchr
|
||||
function locates the first occurrence of a byte unequal to
|
||||
.Fa c
|
||||
(converted to an
|
||||
.Vt "unsigned char" )
|
||||
in string
|
||||
.Fa b .
|
||||
.Sh RETURN VALUES
|
||||
The
|
||||
.Fn memcchr
|
||||
function returns a pointer to the byte located, or NULL if no such byte
|
||||
exists within
|
||||
.Fa len
|
||||
bytes.
|
||||
.Sh SEE ALSO
|
||||
.Xr memchr 3
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Fn memcchr
|
||||
function first appeared in
|
||||
.Fx 10.0 .
|
@ -22,6 +22,8 @@
|
||||
# Specific links can be suppressed by setting
|
||||
# CRUNCH_SUPPRESS_LINK_$(NAME) to 1.
|
||||
#
|
||||
# If CRUNCH_GENERATE_LINKS is set to no, no links will be generated.
|
||||
#
|
||||
|
||||
# $FreeBSD$
|
||||
|
||||
@ -39,6 +41,7 @@ CANONICALOBJDIR:= ${MAKEOBJDIRPREFIX}${.CURDIR}
|
||||
.else
|
||||
CANONICALOBJDIR:= /usr/obj${.CURDIR}
|
||||
.endif
|
||||
CRUNCH_GENERATE_LINKS?= yes
|
||||
|
||||
CLEANFILES+= $(CONF) *.o *.lo *.c *.mk *.cache *.a *.h
|
||||
|
||||
@ -51,6 +54,7 @@ $(OUTPUTS): $(CRUNCH_SRCDIR_${P})/Makefile
|
||||
.else
|
||||
$(OUTPUTS): $(.CURDIR)/../../$(D)/$(P)/Makefile
|
||||
.endif
|
||||
.if ${CRUNCH_GENERATE_LINKS} == "yes"
|
||||
.ifndef CRUNCH_SUPPRESS_LINK_${P}
|
||||
LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(P)
|
||||
.endif
|
||||
@ -59,6 +63,7 @@ LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(P)
|
||||
LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(A)
|
||||
.endif
|
||||
.endfor
|
||||
.endif
|
||||
.endfor
|
||||
.endfor
|
||||
|
||||
|
@ -322,6 +322,7 @@ __DEFAULT_YES_OPTIONS = \
|
||||
BSNMP \
|
||||
BZIP2 \
|
||||
CALENDAR \
|
||||
CAPSICUM \
|
||||
CDDL \
|
||||
CPP \
|
||||
CRYPT \
|
||||
|
12
sys/Makefile
12
sys/Makefile
@ -13,10 +13,18 @@ CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \
|
||||
netgraph netinet netinet6 netipsec netipx netnatm netncp \
|
||||
netsmb nfs nfsclient nfsserver nlm opencrypto \
|
||||
pci rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR}
|
||||
.if !defined(CSCOPE_ARCHDIR)
|
||||
.if defined(ALL_ARCH)
|
||||
CSCOPE_ARCHDIR ?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86
|
||||
CSCOPE_ARCHDIR = amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86
|
||||
.else
|
||||
CSCOPE_ARCHDIR ?= ${MACHINE}
|
||||
CSCOPE_ARCHDIR = ${MACHINE}
|
||||
.if ${MACHINE} != ${MACHINE_CPUARCH}
|
||||
CSCOPE_ARCHDIR += ${MACHINE_CPUARCH}
|
||||
.endif
|
||||
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
|
||||
CSCOPE_ARCHDIR += x86
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
# Loadable kernel modules
|
||||
|
@ -138,3 +138,6 @@ device wlan_wep # 802.11 WEP support
|
||||
device wlan_ccmp # 802.11 CCMP support
|
||||
device wlan_tkip # 802.11 TKIP support
|
||||
device wlan_amrr # AMRR transmit rate control algorithm
|
||||
options IEEE80211_SUPPORT_MESH
|
||||
|
||||
options AH_SUPPORT_AR5416
|
||||
|
@ -137,7 +137,7 @@ parse(int *argc, char ***argv, char *str)
|
||||
|
||||
case VAR:
|
||||
if (token) {
|
||||
PARSE_FAIL((q = index(p, token)) == NULL);
|
||||
PARSE_FAIL((q = strchr(p, token)) == NULL);
|
||||
} else {
|
||||
q = p;
|
||||
while (*q && !isspace(*q))
|
||||
|
@ -342,3 +342,9 @@ biospci_read_config(uint32_t locator, int offset, int width, uint32_t *val)
|
||||
return (0);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
biospci_locator(int8_t bus, uint8_t device, uint8_t function)
|
||||
{
|
||||
|
||||
return ((bus << 8) | ((device & 0x1f) << 3) | (function & 0x7));
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <bootstrap.h>
|
||||
#include <machine/cpufunc.h>
|
||||
#include <dev/ic/ns16550.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include "libi386.h"
|
||||
|
||||
#define COMC_FMT 0x3 /* 8N1 */
|
||||
@ -49,14 +50,23 @@ static int comc_init(int arg);
|
||||
static void comc_putchar(int c);
|
||||
static int comc_getchar(void);
|
||||
static int comc_getspeed(void);
|
||||
static void set_hw_console_hint(void);
|
||||
static int comc_ischar(void);
|
||||
static int comc_parsespeed(const char *string);
|
||||
static void comc_setup(int speed);
|
||||
static int comc_parseint(const char *string);
|
||||
static uint32_t comc_parse_pcidev(const char *string);
|
||||
static int comc_pcidev_set(struct env_var *ev, int flags,
|
||||
const void *value);
|
||||
static int comc_pcidev_handle(uint32_t locator);
|
||||
static int comc_port_set(struct env_var *ev, int flags,
|
||||
const void *value);
|
||||
static void comc_setup(int speed, int port);
|
||||
static int comc_speed_set(struct env_var *ev, int flags,
|
||||
const void *value);
|
||||
|
||||
static int comc_started;
|
||||
static int comc_curspeed;
|
||||
static int comc_port = COMPORT;
|
||||
static uint32_t comc_locator;
|
||||
|
||||
struct console comconsole = {
|
||||
"comconsole",
|
||||
@ -72,9 +82,10 @@ struct console comconsole = {
|
||||
static void
|
||||
comc_probe(struct console *cp)
|
||||
{
|
||||
char speedbuf[16];
|
||||
char *cons, *speedenv;
|
||||
int speed;
|
||||
char intbuf[16];
|
||||
char *cons, *env;
|
||||
int speed, port;
|
||||
uint32_t locator;
|
||||
|
||||
/* XXX check the BIOS equipment list? */
|
||||
cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
|
||||
@ -90,16 +101,40 @@ comc_probe(struct console *cp)
|
||||
getenv("boot_multicons") != NULL) {
|
||||
comc_curspeed = comc_getspeed();
|
||||
}
|
||||
speedenv = getenv("comconsole_speed");
|
||||
if (speedenv != NULL) {
|
||||
speed = comc_parsespeed(speedenv);
|
||||
|
||||
env = getenv("comconsole_speed");
|
||||
if (env != NULL) {
|
||||
speed = comc_parseint(env);
|
||||
if (speed > 0)
|
||||
comc_curspeed = speed;
|
||||
}
|
||||
|
||||
sprintf(speedbuf, "%d", comc_curspeed);
|
||||
sprintf(intbuf, "%d", comc_curspeed);
|
||||
unsetenv("comconsole_speed");
|
||||
env_setenv("comconsole_speed", EV_VOLATILE, speedbuf, comc_speed_set,
|
||||
env_setenv("comconsole_speed", EV_VOLATILE, intbuf, comc_speed_set,
|
||||
env_nounset);
|
||||
|
||||
env = getenv("comconsole_port");
|
||||
if (env != NULL) {
|
||||
port = comc_parseint(env);
|
||||
if (port > 0)
|
||||
comc_port = port;
|
||||
}
|
||||
|
||||
sprintf(intbuf, "%d", comc_port);
|
||||
unsetenv("comconsole_port");
|
||||
env_setenv("comconsole_port", EV_VOLATILE, intbuf, comc_port_set,
|
||||
env_nounset);
|
||||
|
||||
env = getenv("comconsole_pcidev");
|
||||
if (env != NULL) {
|
||||
locator = comc_parse_pcidev(env);
|
||||
if (locator != 0)
|
||||
comc_pcidev_handle(locator);
|
||||
}
|
||||
|
||||
unsetenv("comconsole_pcidev");
|
||||
env_setenv("comconsole_pcidev", EV_VOLATILE, env, comc_pcidev_set,
|
||||
env_nounset);
|
||||
}
|
||||
}
|
||||
@ -111,7 +146,7 @@ comc_init(int arg)
|
||||
return 0;
|
||||
comc_started = 1;
|
||||
|
||||
comc_setup(comc_curspeed);
|
||||
comc_setup(comc_curspeed, comc_port);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -122,8 +157,8 @@ comc_putchar(int c)
|
||||
int wait;
|
||||
|
||||
for (wait = COMC_TXWAIT; wait > 0; wait--)
|
||||
if (inb(COMPORT + com_lsr) & LSR_TXRDY) {
|
||||
outb(COMPORT + com_data, (u_char)c);
|
||||
if (inb(comc_port + com_lsr) & LSR_TXRDY) {
|
||||
outb(comc_port + com_data, (u_char)c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -131,13 +166,13 @@ comc_putchar(int c)
|
||||
static int
|
||||
comc_getchar(void)
|
||||
{
|
||||
return(comc_ischar() ? inb(COMPORT + com_data) : -1);
|
||||
return(comc_ischar() ? inb(comc_port + com_data) : -1);
|
||||
}
|
||||
|
||||
static int
|
||||
comc_ischar(void)
|
||||
{
|
||||
return(inb(COMPORT + com_lsr) & LSR_RXRDY);
|
||||
return(inb(comc_port + com_lsr) & LSR_RXRDY);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -145,13 +180,33 @@ comc_speed_set(struct env_var *ev, int flags, const void *value)
|
||||
{
|
||||
int speed;
|
||||
|
||||
if (value == NULL || (speed = comc_parsespeed(value)) <= 0) {
|
||||
if (value == NULL || (speed = comc_parseint(value)) <= 0) {
|
||||
printf("Invalid speed\n");
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
|
||||
if (comc_started && comc_curspeed != speed)
|
||||
comc_setup(speed);
|
||||
comc_setup(speed, comc_port);
|
||||
|
||||
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
|
||||
|
||||
return (CMD_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
comc_port_set(struct env_var *ev, int flags, const void *value)
|
||||
{
|
||||
int port;
|
||||
|
||||
if (value == NULL || (port = comc_parseint(value)) <= 0) {
|
||||
printf("Invalid port\n");
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
|
||||
if (comc_started && comc_port != port) {
|
||||
comc_setup(comc_curspeed, port);
|
||||
set_hw_console_hint();
|
||||
}
|
||||
|
||||
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
|
||||
|
||||
@ -159,24 +214,126 @@ comc_speed_set(struct env_var *ev, int flags, const void *value)
|
||||
}
|
||||
|
||||
static void
|
||||
comc_setup(int speed)
|
||||
set_hw_console_hint(void)
|
||||
{
|
||||
char intbuf[64];
|
||||
|
||||
comc_curspeed = speed;
|
||||
unsetenv("hw.uart.console");
|
||||
sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed);
|
||||
env_setenv("hw.uart.console", EV_VOLATILE, intbuf,
|
||||
env_noset, env_nounset);
|
||||
}
|
||||
|
||||
outb(COMPORT + com_cfcr, CFCR_DLAB | COMC_FMT);
|
||||
outb(COMPORT + com_dlbl, COMC_BPS(speed) & 0xff);
|
||||
outb(COMPORT + com_dlbh, COMC_BPS(speed) >> 8);
|
||||
outb(COMPORT + com_cfcr, COMC_FMT);
|
||||
outb(COMPORT + com_mcr, MCR_RTS | MCR_DTR);
|
||||
/*
|
||||
* Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10.
|
||||
* Output: bar[24:16] bus[15:8] dev[7:3] func[2:0]
|
||||
*/
|
||||
static uint32_t
|
||||
comc_parse_pcidev(const char *string)
|
||||
{
|
||||
char *p, *p1;
|
||||
uint8_t bus, dev, func, bar;
|
||||
uint32_t locator;
|
||||
int pres;
|
||||
|
||||
do
|
||||
inb(COMPORT + com_data);
|
||||
while (inb(COMPORT + com_lsr) & LSR_RXRDY);
|
||||
pres = strtol(string, &p, 0);
|
||||
if (p == string || *p != ':' || pres < 0 )
|
||||
return (0);
|
||||
bus = pres;
|
||||
p1 = ++p;
|
||||
|
||||
pres = strtol(p1, &p, 0);
|
||||
if (p == string || *p != ':' || pres < 0 )
|
||||
return (0);
|
||||
dev = pres;
|
||||
p1 = ++p;
|
||||
|
||||
pres = strtol(p1, &p, 0);
|
||||
if (p == string || (*p != ':' && *p != '\0') || pres < 0 )
|
||||
return (0);
|
||||
func = pres;
|
||||
|
||||
if (*p == ':') {
|
||||
p1 = ++p;
|
||||
pres = strtol(p1, &p, 0);
|
||||
if (p == string || *p != '\0' || pres <= 0 )
|
||||
return (0);
|
||||
bar = pres;
|
||||
} else
|
||||
bar = 0x10;
|
||||
|
||||
locator = (bar << 16) | biospci_locator(bus, dev, func);
|
||||
return (locator);
|
||||
}
|
||||
|
||||
static int
|
||||
comc_parsespeed(const char *speedstr)
|
||||
comc_pcidev_handle(uint32_t locator)
|
||||
{
|
||||
char intbuf[64];
|
||||
uint32_t port;
|
||||
|
||||
if (biospci_read_config(locator & 0xffff,
|
||||
(locator & 0xff0000) >> 16, 2, &port) == -1) {
|
||||
printf("Cannot read bar at 0x%x\n", locator);
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
if (!PCI_BAR_IO(port)) {
|
||||
printf("Memory bar at 0x%x\n", locator);
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
port &= PCIM_BAR_IO_BASE;
|
||||
|
||||
sprintf(intbuf, "%d", port);
|
||||
unsetenv("comconsole_port");
|
||||
env_setenv("comconsole_port", EV_VOLATILE, intbuf,
|
||||
comc_port_set, env_nounset);
|
||||
|
||||
comc_setup(comc_curspeed, port);
|
||||
set_hw_console_hint();
|
||||
comc_locator = locator;
|
||||
|
||||
return (CMD_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
comc_pcidev_set(struct env_var *ev, int flags, const void *value)
|
||||
{
|
||||
uint32_t locator;
|
||||
int error;
|
||||
|
||||
if (value == NULL || (locator = comc_parse_pcidev(value)) <= 0) {
|
||||
printf("Invalid pcidev\n");
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
if (comc_started && comc_locator != locator) {
|
||||
error = comc_pcidev_handle(locator);
|
||||
if (error != CMD_OK)
|
||||
return (error);
|
||||
}
|
||||
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
|
||||
return (CMD_OK);
|
||||
}
|
||||
|
||||
static void
|
||||
comc_setup(int speed, int port)
|
||||
{
|
||||
|
||||
comc_curspeed = speed;
|
||||
comc_port = port;
|
||||
|
||||
outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT);
|
||||
outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff);
|
||||
outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8);
|
||||
outb(comc_port + com_cfcr, COMC_FMT);
|
||||
outb(comc_port + com_mcr, MCR_RTS | MCR_DTR);
|
||||
|
||||
do
|
||||
inb(comc_port + com_data);
|
||||
while (inb(comc_port + com_lsr) & LSR_RXRDY);
|
||||
}
|
||||
|
||||
static int
|
||||
comc_parseint(const char *speedstr)
|
||||
{
|
||||
char *p;
|
||||
int speed;
|
||||
@ -196,13 +353,13 @@ comc_getspeed(void)
|
||||
u_char dlbl;
|
||||
u_char cfcr;
|
||||
|
||||
cfcr = inb(COMPORT + com_cfcr);
|
||||
outb(COMPORT + com_cfcr, CFCR_DLAB | cfcr);
|
||||
cfcr = inb(comc_port + com_cfcr);
|
||||
outb(comc_port + com_cfcr, CFCR_DLAB | cfcr);
|
||||
|
||||
dlbl = inb(COMPORT + com_dlbl);
|
||||
dlbh = inb(COMPORT + com_dlbh);
|
||||
dlbl = inb(comc_port + com_dlbl);
|
||||
dlbh = inb(comc_port + com_dlbh);
|
||||
|
||||
outb(COMPORT + com_cfcr, cfcr);
|
||||
outb(comc_port + com_cfcr, cfcr);
|
||||
|
||||
divisor = dlbh << 8 | dlbl;
|
||||
|
||||
|
@ -97,6 +97,7 @@ extern vm_offset_t high_heap_base; /* for use as the heap */
|
||||
int biospci_find_devclass(uint32_t class, int index, uint32_t *locator);
|
||||
int biospci_write_config(uint32_t locator, int offset, int width, uint32_t val);
|
||||
int biospci_read_config(uint32_t locator, int offset, int width, uint32_t *val);
|
||||
uint32_t biospci_locator(int8_t bus, uint8_t device, uint8_t function);
|
||||
|
||||
void biosacpi_detect(void);
|
||||
|
||||
|
@ -133,7 +133,7 @@ main(int (*openfirm)(void *))
|
||||
printf("Memory: %lldKB\n", memsize() / 1024);
|
||||
|
||||
OF_getprop(chosen, "bootpath", bootpath, 64);
|
||||
ch = index(bootpath, ':');
|
||||
ch = strchr(bootpath, ':');
|
||||
*ch = '\0';
|
||||
printf("Booted from: %s\n", bootpath);
|
||||
|
||||
|
@ -185,7 +185,7 @@ ofwn_init(struct iodesc *desc, void *machdep_hint)
|
||||
int pathlen;
|
||||
|
||||
pathlen = OF_getprop(chosen, "bootpath", path, 64);
|
||||
if ((ch = index(path, ':')) != NULL)
|
||||
if ((ch = strchr(path, ':')) != NULL)
|
||||
*ch = '\0';
|
||||
netdev = OF_finddevice(path);
|
||||
#ifdef __sparc64__
|
||||
|
@ -219,7 +219,7 @@ read: xor %ax,%ax
|
||||
jc read_load
|
||||
and $0xff7f,%si /* SCSI MO */
|
||||
mov %di,%cx
|
||||
shr $16,%di
|
||||
shr $16,%edi
|
||||
mov %di,%dx
|
||||
jmp read_load
|
||||
read_fd: or $0xd000,%si
|
||||
|
@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <bootstrap.h>
|
||||
#include <machine/cpufunc.h>
|
||||
#include <dev/ic/ns16550.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include "libi386.h"
|
||||
|
||||
#define COMC_FMT 0x3 /* 8N1 */
|
||||
@ -49,14 +50,23 @@ static int comc_init(int arg);
|
||||
static void comc_putchar(int c);
|
||||
static int comc_getchar(void);
|
||||
static int comc_getspeed(void);
|
||||
static void set_hw_console_hint(void);
|
||||
static int comc_ischar(void);
|
||||
static int comc_parsespeed(const char *string);
|
||||
static void comc_setup(int speed);
|
||||
static int comc_parseint(const char *string);
|
||||
static uint32_t comc_parse_pcidev(const char *string);
|
||||
static int comc_pcidev_set(struct env_var *ev, int flags,
|
||||
const void *value);
|
||||
static int comc_pcidev_handle(uint32_t locator);
|
||||
static int comc_port_set(struct env_var *ev, int flags,
|
||||
const void *value);
|
||||
static void comc_setup(int speed, int port);
|
||||
static int comc_speed_set(struct env_var *ev, int flags,
|
||||
const void *value);
|
||||
|
||||
static int comc_started;
|
||||
static int comc_curspeed;
|
||||
static int comc_port = COMPORT;
|
||||
static uint32_t comc_locator;
|
||||
|
||||
struct console comconsole = {
|
||||
"comconsole",
|
||||
@ -72,9 +82,10 @@ struct console comconsole = {
|
||||
static void
|
||||
comc_probe(struct console *cp)
|
||||
{
|
||||
char speedbuf[16];
|
||||
char *cons, *speedenv;
|
||||
int speed;
|
||||
char intbuf[16];
|
||||
char *cons, *env;
|
||||
int speed, port;
|
||||
uint32_t locator;
|
||||
|
||||
/* XXX check the BIOS equipment list? */
|
||||
cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
|
||||
@ -90,16 +101,40 @@ comc_probe(struct console *cp)
|
||||
getenv("boot_multicons") != NULL) {
|
||||
comc_curspeed = comc_getspeed();
|
||||
}
|
||||
speedenv = getenv("comconsole_speed");
|
||||
if (speedenv != NULL) {
|
||||
speed = comc_parsespeed(speedenv);
|
||||
|
||||
env = getenv("comconsole_speed");
|
||||
if (env != NULL) {
|
||||
speed = comc_parseint(env);
|
||||
if (speed > 0)
|
||||
comc_curspeed = speed;
|
||||
}
|
||||
|
||||
sprintf(speedbuf, "%d", comc_curspeed);
|
||||
sprintf(intbuf, "%d", comc_curspeed);
|
||||
unsetenv("comconsole_speed");
|
||||
env_setenv("comconsole_speed", EV_VOLATILE, speedbuf, comc_speed_set,
|
||||
env_setenv("comconsole_speed", EV_VOLATILE, intbuf, comc_speed_set,
|
||||
env_nounset);
|
||||
|
||||
env = getenv("comconsole_port");
|
||||
if (env != NULL) {
|
||||
port = comc_parseint(env);
|
||||
if (port > 0)
|
||||
comc_port = port;
|
||||
}
|
||||
|
||||
sprintf(intbuf, "%d", comc_port);
|
||||
unsetenv("comconsole_port");
|
||||
env_setenv("comconsole_port", EV_VOLATILE, intbuf, comc_port_set,
|
||||
env_nounset);
|
||||
|
||||
env = getenv("comconsole_pcidev");
|
||||
if (env != NULL) {
|
||||
locator = comc_parse_pcidev(env);
|
||||
if (locator != 0)
|
||||
comc_pcidev_handle(locator);
|
||||
}
|
||||
|
||||
unsetenv("comconsole_pcidev");
|
||||
env_setenv("comconsole_pcidev", EV_VOLATILE, env, comc_pcidev_set,
|
||||
env_nounset);
|
||||
}
|
||||
}
|
||||
@ -111,7 +146,7 @@ comc_init(int arg)
|
||||
return 0;
|
||||
comc_started = 1;
|
||||
|
||||
comc_setup(comc_curspeed);
|
||||
comc_setup(comc_curspeed, comc_port);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -122,8 +157,8 @@ comc_putchar(int c)
|
||||
int wait;
|
||||
|
||||
for (wait = COMC_TXWAIT; wait > 0; wait--)
|
||||
if (inb(COMPORT + com_lsr) & LSR_TXRDY) {
|
||||
outb(COMPORT + com_data, (u_char)c);
|
||||
if (inb(comc_port + com_lsr) & LSR_TXRDY) {
|
||||
outb(comc_port + com_data, (u_char)c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -131,13 +166,13 @@ comc_putchar(int c)
|
||||
static int
|
||||
comc_getchar(void)
|
||||
{
|
||||
return(comc_ischar() ? inb(COMPORT + com_data) : -1);
|
||||
return(comc_ischar() ? inb(comc_port + com_data) : -1);
|
||||
}
|
||||
|
||||
static int
|
||||
comc_ischar(void)
|
||||
{
|
||||
return(inb(COMPORT + com_lsr) & LSR_RXRDY);
|
||||
return(inb(comc_port + com_lsr) & LSR_RXRDY);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -145,13 +180,33 @@ comc_speed_set(struct env_var *ev, int flags, const void *value)
|
||||
{
|
||||
int speed;
|
||||
|
||||
if (value == NULL || (speed = comc_parsespeed(value)) <= 0) {
|
||||
if (value == NULL || (speed = comc_parseint(value)) <= 0) {
|
||||
printf("Invalid speed\n");
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
|
||||
if (comc_started && comc_curspeed != speed)
|
||||
comc_setup(speed);
|
||||
comc_setup(speed, comc_port);
|
||||
|
||||
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
|
||||
|
||||
return (CMD_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
comc_port_set(struct env_var *ev, int flags, const void *value)
|
||||
{
|
||||
int port;
|
||||
|
||||
if (value == NULL || (port = comc_parseint(value)) <= 0) {
|
||||
printf("Invalid port\n");
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
|
||||
if (comc_started && comc_port != port) {
|
||||
comc_setup(comc_curspeed, port);
|
||||
set_hw_console_hint();
|
||||
}
|
||||
|
||||
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
|
||||
|
||||
@ -159,24 +214,126 @@ comc_speed_set(struct env_var *ev, int flags, const void *value)
|
||||
}
|
||||
|
||||
static void
|
||||
comc_setup(int speed)
|
||||
set_hw_console_hint(void)
|
||||
{
|
||||
char intbuf[64];
|
||||
|
||||
comc_curspeed = speed;
|
||||
unsetenv("hw.uart.console");
|
||||
sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed);
|
||||
env_setenv("hw.uart.console", EV_VOLATILE, intbuf,
|
||||
env_noset, env_nounset);
|
||||
}
|
||||
|
||||
outb(COMPORT + com_cfcr, CFCR_DLAB | COMC_FMT);
|
||||
outb(COMPORT + com_dlbl, COMC_BPS(speed) & 0xff);
|
||||
outb(COMPORT + com_dlbh, COMC_BPS(speed) >> 8);
|
||||
outb(COMPORT + com_cfcr, COMC_FMT);
|
||||
outb(COMPORT + com_mcr, MCR_RTS | MCR_DTR);
|
||||
/*
|
||||
* Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10.
|
||||
* Output: bar[24:16] bus[15:8] dev[7:3] func[2:0]
|
||||
*/
|
||||
static uint32_t
|
||||
comc_parse_pcidev(const char *string)
|
||||
{
|
||||
char *p, *p1;
|
||||
uint8_t bus, dev, func, bar;
|
||||
uint32_t locator;
|
||||
int pres;
|
||||
|
||||
do
|
||||
inb(COMPORT + com_data);
|
||||
while (inb(COMPORT + com_lsr) & LSR_RXRDY);
|
||||
pres = strtol(string, &p, 0);
|
||||
if (p == string || *p != ':' || pres < 0 )
|
||||
return (0);
|
||||
bus = pres;
|
||||
p1 = ++p;
|
||||
|
||||
pres = strtol(p1, &p, 0);
|
||||
if (p == string || *p != ':' || pres < 0 )
|
||||
return (0);
|
||||
dev = pres;
|
||||
p1 = ++p;
|
||||
|
||||
pres = strtol(p1, &p, 0);
|
||||
if (p == string || (*p != ':' && *p != '\0') || pres < 0 )
|
||||
return (0);
|
||||
func = pres;
|
||||
|
||||
if (*p == ':') {
|
||||
p1 = ++p;
|
||||
pres = strtol(p1, &p, 0);
|
||||
if (p == string || *p != '\0' || pres <= 0 )
|
||||
return (0);
|
||||
bar = pres;
|
||||
} else
|
||||
bar = 0x10;
|
||||
|
||||
locator = (bar << 16) | biospci_locator(bus, dev, func);
|
||||
return (locator);
|
||||
}
|
||||
|
||||
static int
|
||||
comc_parsespeed(const char *speedstr)
|
||||
comc_pcidev_handle(uint32_t locator)
|
||||
{
|
||||
char intbuf[64];
|
||||
uint32_t port;
|
||||
|
||||
if (biospci_read_config(locator & 0xffff,
|
||||
(locator & 0xff0000) >> 16, 2, &port) == -1) {
|
||||
printf("Cannot read bar at 0x%x\n", locator);
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
if (!PCI_BAR_IO(port)) {
|
||||
printf("Memory bar at 0x%x\n", locator);
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
port &= PCIM_BAR_IO_BASE;
|
||||
|
||||
sprintf(intbuf, "%d", port);
|
||||
unsetenv("comconsole_port");
|
||||
env_setenv("comconsole_port", EV_VOLATILE, intbuf,
|
||||
comc_port_set, env_nounset);
|
||||
|
||||
comc_setup(comc_curspeed, port);
|
||||
set_hw_console_hint();
|
||||
comc_locator = locator;
|
||||
|
||||
return (CMD_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
comc_pcidev_set(struct env_var *ev, int flags, const void *value)
|
||||
{
|
||||
uint32_t locator;
|
||||
int error;
|
||||
|
||||
if (value == NULL || (locator = comc_parse_pcidev(value)) <= 0) {
|
||||
printf("Invalid pcidev\n");
|
||||
return (CMD_ERROR);
|
||||
}
|
||||
if (comc_started && comc_locator != locator) {
|
||||
error = comc_pcidev_handle(locator);
|
||||
if (error != CMD_OK)
|
||||
return (error);
|
||||
}
|
||||
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
|
||||
return (CMD_OK);
|
||||
}
|
||||
|
||||
static void
|
||||
comc_setup(int speed, int port)
|
||||
{
|
||||
|
||||
comc_curspeed = speed;
|
||||
comc_port = port;
|
||||
|
||||
outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT);
|
||||
outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff);
|
||||
outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8);
|
||||
outb(comc_port + com_cfcr, COMC_FMT);
|
||||
outb(comc_port + com_mcr, MCR_RTS | MCR_DTR);
|
||||
|
||||
do
|
||||
inb(comc_port + com_data);
|
||||
while (inb(comc_port + com_lsr) & LSR_RXRDY);
|
||||
}
|
||||
|
||||
static int
|
||||
comc_parseint(const char *speedstr)
|
||||
{
|
||||
char *p;
|
||||
int speed;
|
||||
@ -196,13 +353,13 @@ comc_getspeed(void)
|
||||
u_char dlbl;
|
||||
u_char cfcr;
|
||||
|
||||
cfcr = inb(COMPORT + com_cfcr);
|
||||
outb(COMPORT + com_cfcr, CFCR_DLAB | cfcr);
|
||||
cfcr = inb(comc_port + com_cfcr);
|
||||
outb(comc_port + com_cfcr, CFCR_DLAB | cfcr);
|
||||
|
||||
dlbl = inb(COMPORT + com_dlbl);
|
||||
dlbh = inb(COMPORT + com_dlbh);
|
||||
dlbl = inb(comc_port + com_dlbl);
|
||||
dlbh = inb(comc_port + com_dlbh);
|
||||
|
||||
outb(COMPORT + com_cfcr, cfcr);
|
||||
outb(comc_port + com_cfcr, cfcr);
|
||||
|
||||
divisor = dlbh << 8 | dlbl;
|
||||
|
||||
|
@ -60,10 +60,10 @@ SRCS+= ntoh.c
|
||||
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \
|
||||
${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \
|
||||
${MACHINE_CPUARCH} == "arm"
|
||||
SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
|
||||
memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
|
||||
strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
|
||||
strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
|
||||
SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \
|
||||
memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
|
||||
strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \
|
||||
strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
|
||||
.endif
|
||||
.if ${MACHINE_CPUARCH} == "arm"
|
||||
.PATH: ${LIBC}/arm/gen
|
||||
|
@ -493,13 +493,6 @@ adaclose(struct disk *dp)
|
||||
|
||||
if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)
|
||||
xpt_print(periph->path, "Synchronize cache failed\n");
|
||||
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path,
|
||||
/*relsim_flags*/0,
|
||||
/*reduction*/0,
|
||||
/*timeout*/0,
|
||||
/*getcount_only*/0);
|
||||
xpt_release_ccb(ccb);
|
||||
}
|
||||
|
||||
|
@ -2685,6 +2685,16 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td)
|
||||
error = cdsetspeed(periph, CDR_MAX_SPEED, *(u_int32_t *)addr);
|
||||
cam_periph_unlock(periph);
|
||||
break;
|
||||
case CDRIOCGETBLOCKSIZE:
|
||||
*(int *)addr = softc->params.blksize;
|
||||
break;
|
||||
case CDRIOCSETBLOCKSIZE:
|
||||
if (*(int *)addr <= 0) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
softc->disk->d_sectorsize = softc->params.blksize = *(int *)addr;
|
||||
break;
|
||||
case DVDIOCSENDKEY:
|
||||
case DVDIOCREPORTKEY: {
|
||||
struct dvd_authinfo *authinfo;
|
||||
|
@ -990,13 +990,6 @@ daclose(struct disk *dp)
|
||||
}
|
||||
}
|
||||
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path,
|
||||
/*relsim_flags*/0,
|
||||
/*reduction*/0,
|
||||
/*timeout*/0,
|
||||
/*getcount_only*/0);
|
||||
|
||||
xpt_release_ccb(ccb);
|
||||
|
||||
}
|
||||
@ -2281,14 +2274,6 @@ dagetcapacity(struct cam_periph *periph)
|
||||
/*cam_flags*/CAM_RETRY_SELTO,
|
||||
sense_flags,
|
||||
softc->disk->d_devstat);
|
||||
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path,
|
||||
/*relsim_flags*/0,
|
||||
/*reduction*/0,
|
||||
/*timeout*/0,
|
||||
/*getcount_only*/0);
|
||||
|
||||
if (error == 0)
|
||||
goto rc16ok;
|
||||
|
||||
@ -2326,14 +2311,6 @@ dagetcapacity(struct cam_periph *periph)
|
||||
/*cam_flags*/CAM_RETRY_SELTO,
|
||||
sense_flags,
|
||||
softc->disk->d_devstat);
|
||||
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path,
|
||||
/*relsim_flags*/0,
|
||||
/*reduction*/0,
|
||||
/*timeout*/0,
|
||||
/*getcount_only*/0);
|
||||
|
||||
if (error == 0) {
|
||||
block_len = scsi_4btoul(rcap->length);
|
||||
maxsector = scsi_4btoul(rcap->addr);
|
||||
@ -2360,14 +2337,6 @@ dagetcapacity(struct cam_periph *periph)
|
||||
/*cam_flags*/CAM_RETRY_SELTO,
|
||||
sense_flags,
|
||||
softc->disk->d_devstat);
|
||||
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path,
|
||||
/*relsim_flags*/0,
|
||||
/*reduction*/0,
|
||||
/*timeout*/0,
|
||||
/*getcount_only*/0);
|
||||
|
||||
if (error == 0) {
|
||||
rc16ok:
|
||||
block_len = scsi_4btoul(rcaplong->length);
|
||||
|
@ -1853,14 +1853,12 @@ samount(struct cam_periph *periph, int oflags, struct cdev *dev)
|
||||
MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, IO_TIMEOUT);
|
||||
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
|
||||
softc->device_stats);
|
||||
QFRLS(ccb);
|
||||
if (error == ENXIO) {
|
||||
softc->flags &= ~SA_FLAG_TAPE_MOUNTED;
|
||||
scsi_test_unit_ready(&ccb->csio, 0, sadone,
|
||||
MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, IO_TIMEOUT);
|
||||
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
|
||||
softc->device_stats);
|
||||
QFRLS(ccb);
|
||||
} else if (error) {
|
||||
/*
|
||||
* We don't need to freeze the tape because we
|
||||
@ -1882,7 +1880,6 @@ samount(struct cam_periph *periph, int oflags, struct cdev *dev)
|
||||
MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, IO_TIMEOUT);
|
||||
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
|
||||
softc->device_stats);
|
||||
QFRLS(ccb);
|
||||
}
|
||||
|
||||
if ((softc->flags & SA_FLAG_TAPE_MOUNTED) == 0) {
|
||||
@ -1905,7 +1902,6 @@ samount(struct cam_periph *periph, int oflags, struct cdev *dev)
|
||||
FALSE, FALSE, 1, SSD_FULL_SIZE, REWIND_TIMEOUT);
|
||||
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
|
||||
softc->device_stats);
|
||||
QFRLS(ccb);
|
||||
|
||||
/*
|
||||
* In case this doesn't work, do a REWIND instead
|
||||
@ -1915,7 +1911,6 @@ samount(struct cam_periph *periph, int oflags, struct cdev *dev)
|
||||
FALSE, SSD_FULL_SIZE, REWIND_TIMEOUT);
|
||||
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
|
||||
softc->device_stats);
|
||||
QFRLS(ccb);
|
||||
}
|
||||
if (error) {
|
||||
xpt_release_ccb(ccb);
|
||||
@ -1945,13 +1940,11 @@ samount(struct cam_periph *periph, int oflags, struct cdev *dev)
|
||||
IO_TIMEOUT);
|
||||
(void) cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
|
||||
softc->device_stats);
|
||||
QFRLS(ccb);
|
||||
scsi_rewind(&ccb->csio, 1, sadone, MSG_SIMPLE_Q_TAG,
|
||||
FALSE, SSD_FULL_SIZE, REWIND_TIMEOUT);
|
||||
error = cam_periph_runccb(ccb, saerror, CAM_RETRY_SELTO,
|
||||
SF_NO_PRINT | SF_RETRY_UA,
|
||||
softc->device_stats);
|
||||
QFRLS(ccb);
|
||||
if (error) {
|
||||
xpt_print(periph->path,
|
||||
"unable to rewind after test read\n");
|
||||
@ -1969,7 +1962,6 @@ samount(struct cam_periph *periph, int oflags, struct cdev *dev)
|
||||
error = cam_periph_runccb(ccb, saerror, CAM_RETRY_SELTO,
|
||||
SF_NO_PRINT | SF_RETRY_UA, softc->device_stats);
|
||||
|
||||
QFRLS(ccb);
|
||||
xpt_release_ccb(ccb);
|
||||
|
||||
if (error != 0) {
|
||||
@ -2580,7 +2572,6 @@ retry:
|
||||
|
||||
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
|
||||
softc->device_stats);
|
||||
QFRLS(ccb);
|
||||
|
||||
status = ccb->ccb_h.status & CAM_STATUS_MASK;
|
||||
|
||||
@ -2644,7 +2635,6 @@ retry:
|
||||
|
||||
error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT,
|
||||
softc->device_stats);
|
||||
QFRLS(ccb);
|
||||
|
||||
if (error != 0)
|
||||
goto sagetparamsexit;
|
||||
@ -2956,7 +2946,6 @@ retry:
|
||||
|
||||
error = cam_periph_runccb(ccb, saerror, 0,
|
||||
sense_flags, softc->device_stats);
|
||||
QFRLS(ccb);
|
||||
|
||||
if (CAM_DEBUGGED(periph->path, CAM_DEBUG_INFO)) {
|
||||
int idx;
|
||||
@ -3014,7 +3003,6 @@ retry:
|
||||
ccb->ccb_h.retry_count = 1;
|
||||
cam_periph_runccb(ccb, saerror, 0, sense_flags,
|
||||
softc->device_stats);
|
||||
QFRLS(ccb);
|
||||
}
|
||||
|
||||
xpt_release_ccb(ccb);
|
||||
@ -3072,7 +3060,6 @@ saprevent(struct cam_periph *periph, int action)
|
||||
SSD_FULL_SIZE, SCSIOP_TIMEOUT);
|
||||
|
||||
error = cam_periph_runccb(ccb, saerror, 0, sf, softc->device_stats);
|
||||
QFRLS(ccb);
|
||||
if (error == 0) {
|
||||
if (action == PR_ALLOW)
|
||||
softc->flags &= ~SA_FLAG_TAPE_LOCKED;
|
||||
@ -3102,9 +3089,6 @@ sarewind(struct cam_periph *periph)
|
||||
error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
|
||||
softc->dsreg = MTIO_DSREG_REST;
|
||||
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE);
|
||||
|
||||
xpt_release_ccb(ccb);
|
||||
if (error == 0)
|
||||
softc->fileno = softc->blkno = (daddr_t) 0;
|
||||
@ -3138,9 +3122,6 @@ saspace(struct cam_periph *periph, int count, scsi_space_code code)
|
||||
error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
|
||||
softc->dsreg = MTIO_DSREG_REST;
|
||||
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE);
|
||||
|
||||
xpt_release_ccb(ccb);
|
||||
|
||||
/*
|
||||
@ -3212,9 +3193,6 @@ sawritefilemarks(struct cam_periph *periph, int nmarks, int setmarks)
|
||||
|
||||
error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
|
||||
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE);
|
||||
|
||||
if (error == 0 && nmarks) {
|
||||
struct sa_softc *softc = (struct sa_softc *)periph->softc;
|
||||
nwm = nmarks - softc->last_ctl_resid;
|
||||
@ -3265,8 +3243,6 @@ sardpos(struct cam_periph *periph, int hard, u_int32_t *blkptr)
|
||||
softc->dsreg = MTIO_DSREG_RBSY;
|
||||
error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
|
||||
softc->dsreg = MTIO_DSREG_REST;
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path, 0, 0, 0, 0);
|
||||
|
||||
if (error == 0) {
|
||||
if (loc.flags & SA_RPOS_UNCERTAIN) {
|
||||
@ -3306,8 +3282,6 @@ sasetpos(struct cam_periph *periph, int hard, u_int32_t *blkptr)
|
||||
softc->dsreg = MTIO_DSREG_POS;
|
||||
error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
|
||||
softc->dsreg = MTIO_DSREG_REST;
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path, 0, 0, 0, 0);
|
||||
xpt_release_ccb(ccb);
|
||||
/*
|
||||
* Note relative file && block number position as now unknown.
|
||||
@ -3335,8 +3309,6 @@ saretension(struct cam_periph *periph)
|
||||
error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
|
||||
softc->dsreg = MTIO_DSREG_REST;
|
||||
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE);
|
||||
xpt_release_ccb(ccb);
|
||||
if (error == 0)
|
||||
softc->fileno = softc->blkno = (daddr_t) 0;
|
||||
@ -3362,7 +3334,6 @@ sareservereleaseunit(struct cam_periph *periph, int reserve)
|
||||
error = cam_periph_runccb(ccb, saerror, 0,
|
||||
SF_RETRY_UA | SF_NO_PRINT, softc->device_stats);
|
||||
softc->dsreg = MTIO_DSREG_REST;
|
||||
QFRLS(ccb);
|
||||
xpt_release_ccb(ccb);
|
||||
|
||||
/*
|
||||
@ -3394,7 +3365,6 @@ saloadunload(struct cam_periph *periph, int load)
|
||||
softc->dsreg = (load)? MTIO_DSREG_LD : MTIO_DSREG_UNL;
|
||||
error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
|
||||
softc->dsreg = MTIO_DSREG_REST;
|
||||
QFRLS(ccb);
|
||||
xpt_release_ccb(ccb);
|
||||
|
||||
if (error || load == 0)
|
||||
@ -3425,8 +3395,6 @@ saerase(struct cam_periph *periph, int longerase)
|
||||
error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats);
|
||||
softc->dsreg = MTIO_DSREG_REST;
|
||||
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE);
|
||||
xpt_release_ccb(ccb);
|
||||
return (error);
|
||||
}
|
||||
|
@ -679,8 +679,6 @@ ses_runcmd(struct ses_softc *ssc, char *cdb, int cdbl, char *dptr, int *dlenp)
|
||||
bcopy(cdb, ccb->csio.cdb_io.cdb_bytes, cdbl);
|
||||
|
||||
error = cam_periph_runccb(ccb, seserror, SES_CFLAGS, SES_FLAGS, NULL);
|
||||
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
|
||||
cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE);
|
||||
if (error) {
|
||||
if (dptr) {
|
||||
*dlenp = dlen;
|
||||
|
@ -2693,7 +2693,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, int flags, cred_t *cr,
|
||||
links = zp->z_links + 1;
|
||||
else
|
||||
links = zp->z_links;
|
||||
vap->va_nlink = MIN(links, UINT32_MAX); /* nlink_t limit! */
|
||||
vap->va_nlink = MIN(links, LINK_MAX); /* nlink_t limit! */
|
||||
vap->va_size = zp->z_size;
|
||||
#ifdef sun
|
||||
vap->va_rdev = vp->v_rdev;
|
||||
|
@ -2182,7 +2182,7 @@ linux_ifconf(struct thread *td, struct ifconf *uifc)
|
||||
|
||||
CURVNET_SET(TD_TO_VNET(td));
|
||||
/* handle the 'request buffer size' case */
|
||||
if (ifc.ifc_buf == PTROUT(NULL)) {
|
||||
if ((l_uintptr_t)ifc.ifc_buf == PTROUT(NULL)) {
|
||||
ifc.ifc_len = 0;
|
||||
IFNET_RLOCK();
|
||||
TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
|
||||
|
@ -50,7 +50,7 @@ aic79xx_reg_print.c optional ahd pci \
|
||||
aic79xx_reg_print.o optional ahd pci ahd_reg_pretty_print \
|
||||
compile-with "${NORMAL_C}" \
|
||||
no-implicit-rule local
|
||||
emu10k1-alsa%diked.h optional snd_emu10k1 | snd_emu10kx \
|
||||
emu10k1-alsa%diked.h optional snd_emu10kx \
|
||||
dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h" \
|
||||
compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h emu10k1-alsa%diked.h" \
|
||||
no-obj no-implicit-rule before-depend \
|
||||
@ -1732,9 +1732,7 @@ dev/sound/pci/csa.c optional snd_csa pci \
|
||||
warning "kernel contains GPL contaminated csaimg.h header"
|
||||
dev/sound/pci/csapcm.c optional snd_csa pci
|
||||
dev/sound/pci/ds1.c optional snd_ds1 pci
|
||||
dev/sound/pci/emu10k1.c optional snd_emu10k1 pci \
|
||||
dependency "emu10k1-alsa%diked.h" \
|
||||
warning "kernel contains GPL contaminated emu10k1 headers"
|
||||
dev/sound/pci/emu10k1.c optional snd_emu10k1 pci
|
||||
dev/sound/pci/emu10kx.c optional snd_emu10kx pci \
|
||||
dependency "emu10k1-alsa%diked.h" \
|
||||
dependency "p16v-alsa%diked.h" \
|
||||
@ -2268,6 +2266,22 @@ geom/raid3/g_raid3.c optional geom_raid3
|
||||
geom/raid3/g_raid3_ctl.c optional geom_raid3
|
||||
geom/shsec/g_shsec.c optional geom_shsec
|
||||
geom/stripe/g_stripe.c optional geom_stripe
|
||||
geom/uncompress/g_uncompress.c optional geom_uncompress
|
||||
contrib/xz-embedded/freebsd/xz_malloc.c \
|
||||
optional xz_embedded | geom_uncompress \
|
||||
compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/"
|
||||
contrib/xz-embedded/linux/lib/xz/xz_crc32.c \
|
||||
optional xz_embedded | geom_uncompress \
|
||||
compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/"
|
||||
contrib/xz-embedded/linux/lib/xz/xz_dec_bcj.c \
|
||||
optional xz_embedded | geom_uncompress \
|
||||
compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/"
|
||||
contrib/xz-embedded/linux/lib/xz/xz_dec_lzma2.c \
|
||||
optional xz_embedded | geom_uncompress \
|
||||
compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/"
|
||||
contrib/xz-embedded/linux/lib/xz/xz_dec_stream.c \
|
||||
optional xz_embedded | geom_uncompress \
|
||||
compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/"
|
||||
geom/uzip/g_uzip.c optional geom_uzip
|
||||
geom/virstor/binstream.c optional geom_virstor
|
||||
geom/virstor/g_virstor.c optional geom_virstor
|
||||
@ -2551,21 +2565,20 @@ libkern/iconv_converter_if.m optional libiconv
|
||||
libkern/iconv_ucs.c optional libiconv
|
||||
libkern/iconv_xlat.c optional libiconv
|
||||
libkern/iconv_xlat16.c optional libiconv
|
||||
libkern/index.c standard
|
||||
libkern/inet_aton.c standard
|
||||
libkern/inet_ntoa.c standard
|
||||
libkern/inet_ntop.c standard
|
||||
libkern/inet_pton.c standard
|
||||
libkern/mcount.c optional profiling-routine
|
||||
libkern/memcchr.c standard
|
||||
libkern/memcmp.c standard
|
||||
libkern/qsort.c standard
|
||||
libkern/qsort_r.c standard
|
||||
libkern/random.c standard
|
||||
libkern/rindex.c standard
|
||||
libkern/scanc.c standard
|
||||
libkern/skpc.c standard
|
||||
libkern/strcasecmp.c standard
|
||||
libkern/strcat.c standard
|
||||
libkern/strchr.c standard
|
||||
libkern/strcmp.c standard
|
||||
libkern/strcpy.c standard
|
||||
libkern/strcspn.c standard
|
||||
@ -2576,6 +2589,7 @@ libkern/strlen.c standard
|
||||
libkern/strncmp.c standard
|
||||
libkern/strncpy.c standard
|
||||
libkern/strnlen.c standard
|
||||
libkern/strrchr.c standard
|
||||
libkern/strsep.c standard
|
||||
libkern/strspn.c standard
|
||||
libkern/strstr.c standard
|
||||
@ -2638,7 +2652,7 @@ net/slcompress.c optional netgraph_vjc | sppp | \
|
||||
net/vnet.c optional vimage
|
||||
net/zlib.c optional crypto | geom_uzip | ipsec | \
|
||||
mxge | netgraph_deflate | \
|
||||
ddb_ctf | gzio
|
||||
ddb_ctf | gzio | geom_uncompress
|
||||
net80211/ieee80211.c optional wlan
|
||||
net80211/ieee80211_acl.c optional wlan wlan_acl
|
||||
net80211/ieee80211_action.c optional wlan
|
||||
|
@ -71,10 +71,10 @@ INCLUDES+= -I$S/dev/ath -I$S/dev/ath/ath_hal
|
||||
# ... and the same for the NgATM stuff
|
||||
INCLUDES+= -I$S/contrib/ngatm
|
||||
|
||||
# .. and the same for twa
|
||||
# ... and the same for twa
|
||||
INCLUDES+= -I$S/dev/twa
|
||||
|
||||
# ... and XFS
|
||||
# ... and the same for XFS
|
||||
INCLUDES+= -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs
|
||||
|
||||
# ... and the same for cxgb and cxgbe
|
||||
|
@ -112,6 +112,7 @@ GEOM_RAID3 opt_geom.h
|
||||
GEOM_SHSEC opt_geom.h
|
||||
GEOM_STRIPE opt_geom.h
|
||||
GEOM_SUNLABEL opt_geom.h
|
||||
GEOM_UNCOMPRESS opt_geom.h
|
||||
GEOM_UZIP opt_geom.h
|
||||
GEOM_VIRSTOR opt_geom.h
|
||||
GEOM_VOL opt_geom.h
|
||||
|
10
sys/contrib/xz-embedded/COPYING
Normal file
10
sys/contrib/xz-embedded/COPYING
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
Licensing of XZ Embedded
|
||||
========================
|
||||
|
||||
All the files in this package have been written by Lasse Collin
|
||||
and/or Igor Pavlov. All these files have been put into the
|
||||
public domain. You can do whatever you want with these files.
|
||||
|
||||
As usual, this software is provided "as is", without any warranty.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user