IFC @ r227804

Pull in the virtio drivers from head.
This commit is contained in:
Peter Grehan 2011-11-22 02:27:59 +00:00
commit 3ee1a36e2e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/bhyve/; revision=227811
1431 changed files with 101316 additions and 14064 deletions

View File

@ -182,10 +182,12 @@ buildworld: upgrade_checks
#
# In the following, the first 'rm' in a series will usually remove all
# files and directories. If it does not, then there are probably some
# files with chflags set, so this unsets them and tries the 'rm' a
# files with file flags set, so this unsets them and tries the 'rm' a
# second time. There are situations where this target will be cleaning
# some directories via more than one method, but that duplication is
# needed to correctly handle all the possible situations.
# needed to correctly handle all the possible situations. Removing all
# files without file flags set in the first 'rm' instance saves time,
# because 'chflags' will need to operate on fewer files afterwards.
#
BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
cleanworld:

View File

@ -291,7 +291,7 @@ LIB32CPUFLAGS= -mcpu=powerpc
LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
.endif
LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc \
LD="${LD} -m elf32ppc"
LD="${LD} -m elf32ppc_fbsd"
.endif
@ -313,7 +313,8 @@ LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
-DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
-DWITHOUT_HTML -DNO_CTF -DNO_LINT DESTDIR=${LIB32TMP}
-DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \
DESTDIR=${LIB32TMP}
LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
.endif
@ -1229,12 +1230,13 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libhdb} \
${_lib_libgssapi} ${_lib_libipx} \
lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
lib/ncurses/ncurses lib/ncurses/ncursesw \
lib/libopie lib/libpam ${_lib_libthr} \
lib/libopie ${_lib_libthr} \
lib/libradius lib/libsbuf lib/libtacplus \
${_cddl_lib_libumem} \
lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
${_secure_lib_libcrypto} ${_secure_lib_libssh} \
${_secure_lib_libssl}
${_secure_lib_libssl} \
lib/libpam
.if ${MK_LIBTHR} != "no"
_lib_libthr= lib/libthr
@ -1322,7 +1324,7 @@ ${_lib}__PL: .PHONY
.endif
.endfor
.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
.for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
${_lib}__L: .PHONY
.if exists(${.CURDIR}/${_lib})
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
@ -1334,17 +1336,6 @@ ${_lib}__L: .PHONY
.endif
.endfor
# libpam is special: we need to build static PAM modules before
# static PAM library, and dynamic PAM library before dynamic PAM
# modules.
lib/libpam__L: .PHONY
${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
cd ${.CURDIR}/lib/libpam; \
${MAKE} DIRPRFX=lib/libpam/ obj; \
${MAKE} DIRPRFX=lib/libpam/ depend; \
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
_prereq_libs: ${_prereq_libs:S/$/__PL/}
_startup_libs: ${_startup_libs:S/$/__L/}
_prebuild_libs: ${_prebuild_libs:S/$/__L/}

View File

@ -44,10 +44,12 @@ OLD_FILES+=usr/share/man/man8/sysinstall.8.gz
OLD_FILES+=usr/lib/libftpio.a
OLD_FILES+=usr/lib/libftpio.so
OLD_LIBS+=usr/lib/libftpio.so.8
OLD_FILES+=usr/lib/libftpio_p.a
.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
OLD_FILES+=usr/lib32/libftpio.a
OLD_FILES+=usr/lib32/libftpio.so
OLD_LIBS+=usr/lib32/libftpio.so.8
OLD_FILES+=usr/lib32/libftpio_p.a
.endif
OLD_FILES+=usr/include/ftpio.h
OLD_FILES+=usr/share/man/man3/ftpio.3.gz
@ -77,11 +79,22 @@ OLD_LIBS+=usr/lib32/libopie.so.6
OLD_LIBS+=usr/lib32/librtld_db.so.1
OLD_LIBS+=usr/lib32/libtacplus.so.4
.endif
# 20110817: no more acd.4, ad.4, afd.4 and ast.4
OLD_FILES+=usr/share/man/man4/acd.4.gz
OLD_FILES+=usr/share/man/man4/ad.4.gz
OLD_FILES+=usr/share/man/man4/afd.4.gz
OLD_FILES+=usr/share/man/man4/ast.4.gz
# 20110718: no longer useful in the age of rc.d
OLD_FILES+=usr/sbin/named.reconfig
OLD_FILES+=usr/sbin/named.reload
OLD_FILES+=usr/share/man/man8/named.reconfig.8.gz
OLD_FILES+=usr/share/man/man8/named.reload.8.gz
# 20110716: bind 9.8.0 import
OLD_LIBS+=usr/lib/liblwres.so.50
OLD_FILES+=usr/share/doc/bind9/KNOWN-DEFECTS
OLD_FILES+=usr/share/doc/bind9/NSEC3-NOTES
OLD_FILES+=usr/share/doc/bind9/README.idnkit
OLD_FILES+=usr/share/doc/bind9/README.pkcs11
# 20110709: vm_map_clean.9 -> vm_map_sync.9
OLD_FILES+=usr/share/man/man9/vm_map_clean.9.gz
# 20110709: Catch up with removal of these functions.

View File

@ -22,6 +22,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
machines to maximize performance. (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.)
20111108:
The option VFS_ALLOW_NONMPSAFE option has been added in order to
explicitely support non-MPSAFE filesystems.
It is on by default for all supported platform at this present
time.
20111101:
The broken amd(4) driver has been replaced with esp(4) in the amd64,
i386 and pc98 GENERIC kernel configuration files.
20110930:
sysinstall has been removed

View File

@ -64,9 +64,9 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include <stddef.h>
int bflag, eflag, nflag, sflag, tflag, vflag;
int rval;
const char *filename;
static int bflag, eflag, nflag, sflag, tflag, vflag;
static int rval;
static const char *filename;
static void usage(void);
static void scanfiles(char *argv[], int cooked);

View File

@ -54,16 +54,16 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
int fflag; /* Unlink existing files. */
int Fflag; /* Remove empty directories also. */
int hflag; /* Check new name for symlink first. */
int iflag; /* Interactive mode. */
int Pflag; /* Create hard links to symlinks. */
int sflag; /* Symbolic, not hard, link. */
int vflag; /* Verbose output. */
int wflag; /* Warn if symlink target does not
static int fflag; /* Unlink existing files. */
static int Fflag; /* Remove empty directories also. */
static int hflag; /* Check new name for symlink first. */
static int iflag; /* Interactive mode. */
static int Pflag; /* Create hard links to symlinks. */
static int sflag; /* Symbolic, not hard, link. */
static int vflag; /* Verbose output. */
static int wflag; /* Warn if symlink target does not
* exist, and -f is not enabled. */
char linkch;
static char linkch;
int linkit(const char *, const char *, int);
void usage(void);

View File

@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$");
static int build(char *, mode_t);
static void usage(void);
int vflag;
static int vflag;
int
main(int argc, char *argv[])

View File

@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
/* Exit code for a failed exec. */
#define EXEC_FAILED 127
int fflg, iflg, nflg, vflg;
static int fflg, iflg, nflg, vflg;
static int copy(const char *, const char *);
static int do_move(const char *, const char *);

View File

@ -362,7 +362,7 @@ tdev(KINFO *k, VARENT *ve)
v = ve->var;
dev = k->ki_p->ki_tdev;
if (dev == NODEV)
str = strdup("??");
str = strdup("-");
else
asprintf(&str, "%#jx", (uintmax_t)dev);
@ -379,7 +379,7 @@ tname(KINFO *k, VARENT *ve)
v = ve->var;
dev = k->ki_p->ki_tdev;
if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL)
str = strdup("?? ");
str = strdup("- ");
else {
if (strncmp(ttname, "tty", 3) == 0 ||
strncmp(ttname, "cua", 3) == 0)
@ -403,7 +403,7 @@ longtname(KINFO *k, VARENT *ve)
v = ve->var;
dev = k->ki_p->ki_tdev;
if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL)
ttname = "??";
ttname = "-";
return (strdup(ttname));
}

View File

@ -29,7 +29,7 @@
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
.Dd October 1, 2011
.Dd October 30, 2011
.Dt PS 1
.Os
.Sh NAME
@ -437,6 +437,10 @@ This is followed by a
.Ql -
if the process can no longer reach that
controlling terminal (i.e., it has been revoked).
A
.Ql -
without a preceding two letter abbreviation or pseudo-terminal device number
indicates a process which never had a controlling terminal.
The full pathname of the controlling terminal is available via the
.Cm tty
keyword.

View File

@ -57,10 +57,10 @@ __FBSDID("$FreeBSD$");
#include <sysexits.h>
#include <unistd.h>
int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
int rflag, Iflag;
uid_t uid;
volatile sig_atomic_t info;
static int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
static int rflag, Iflag;
static uid_t uid;
static volatile sig_atomic_t info;
int check(char *, char *, struct stat *);
int check2(char **);

View File

@ -131,11 +131,11 @@ static arith_t do_binop(int op, arith_t a, arith_t b)
yyerror("divide error");
return op == ARITH_REM ? a % b : a / b;
case ARITH_MUL:
return a * b;
return (uintmax_t)a * (uintmax_t)b;
case ARITH_ADD:
return a + b;
return (uintmax_t)a + (uintmax_t)b;
case ARITH_SUB:
return a - b;
return (uintmax_t)a - (uintmax_t)b;
case ARITH_LSHIFT:
return a << b;
case ARITH_RSHIFT:

View File

@ -401,9 +401,10 @@ setcmd(int argc, char **argv)
void
getoptsreset(const char *value)
{
if (number(value) == 1) {
while (*value == '0')
value++;
if (strcmp(value, "1") == 0)
shellparam.reset = 1;
}
}
/*

View File

@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
.Dd July 10, 2011
.Dd November 5, 2011
.Dt SH 1
.Os
.Sh NAME
@ -1160,6 +1160,11 @@ of alphabetics, numerics, and underscores.
The first letter of a variable name must not be numeric.
A parameter can also be denoted by a number
or a special character as explained below.
.Pp
Assignments are expanded differently from other words:
tilde expansion is also performed after the equals sign and after any colon
and usernames are also terminated by colons,
and field splitting and pathname expansion are not performed.
.Ss Positional Parameters
A positional parameter is a parameter denoted by a number greater than zero.
The shell sets these initially to the values of its command line
@ -1273,11 +1278,15 @@ used in tilde expansion and as a default directory for the
built-in.
.It Va IFS
Input Field Separators.
This is normally set to
The default value is
.Aq space ,
.Aq tab ,
and
.Aq newline .
.Aq newline
in that order.
This default also applies if
.Va IFS
is unset, but not if it is set to the empty string.
See the
.Sx White Space Splitting
section for more details.
@ -1423,12 +1432,12 @@ part of the name.
If a parameter expansion occurs inside double-quotes:
.Bl -enum
.It
Pathname expansion is not performed on the results of the
expansion.
.It
Field splitting is not performed on the results of the
expansion, with the exception of the special parameter
.Va @ .
.It
Pathname expansion is not performed on the results of the
expansion.
.El
.Pp
In addition, a parameter expansion can be modified by using one of the
@ -1641,16 +1650,51 @@ and contain integer constants.
.Pp
The result of the expression is substituted in decimal.
.Ss White Space Splitting (Field Splitting)
After parameter expansion, command substitution, and
In certain contexts,
after parameter expansion, command substitution, and
arithmetic expansion the shell scans the results of
expansions and substitutions that did not occur in double-quotes for
field splitting and multiple fields can result.
.Pp
The shell treats each character of the
Characters in
.Va IFS
variable as a delimiter and uses
the delimiters to split the results of parameter expansion and command
substitution into fields.
that are whitespace
.Po
.Aq space ,
.Aq tab ,
and
.Aq newline
.Pc
are treated differently from other characters in
.Va IFS .
.Pp
Whitespace in
.Va IFS
at the beginning or end of a word is discarded.
.Pp
Subsequently, a field is delimited by either
.Bl -enum
.It
a non-whitespace character in
.Va IFS
with any whitespace in
.Va IFS
surrounding it, or
.It
one or more whitespace characters in
.Va IFS .
.El
.Pp
If a word ends with a non-whitespace character in
.Va IFS ,
there is no empty field after this character.
.Pp
If no field is delimited, the word is discarded.
In particular, if a word consists solely of an unquoted substitution
and the result of the substitution is null,
it is removed by field splitting even if
.Va IFS
is null.
.Ss Pathname Expansion (File Name Generation)
Unless the
.Fl f

View File

@ -118,7 +118,7 @@ enum token_types {
PAREN
};
struct t_op {
static struct t_op {
const char *op_text;
short op_num, op_type;
} const ops [] = {
@ -165,10 +165,10 @@ struct t_op {
{0, 0, 0}
};
struct t_op const *t_wp_op;
int nargc;
char **t_wp;
int parenlevel;
static struct t_op const *t_wp_op;
static int nargc;
static char **t_wp;
static int parenlevel;
static int aexpr(enum token);
static int binop(void);

View File

@ -3,7 +3,8 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH zdb 1M "31 Oct 2005" "SunOS 5.11" "System Administration Commands"
.\" Portions Copyright 2011 Martin Matuska <mm@FreeBSD.org>
.TH ZDB 8 "Oct 31, 2005"
.SH NAME
zdb \- ZFS debugger
.SH SYNOPSIS
@ -15,70 +16,50 @@ zdb \- ZFS debugger
.SH DESCRIPTION
.sp
.LP
The \fBzdb\fR command is used by support engineers to diagnose failures and gather statistics. Since the \fBZFS\fR file system is always consistent on disk and is self-repairing, \fBzdb\fR should only be run under the direction by a support engineer.
The \fBzdb\fR command is used by support engineers to diagnose failures and
gather statistics. Since the \fBZFS\fR file system is always consistent on disk
and is self-repairing, \fBzdb\fR should only be run under the direction by a
support engineer.
.sp
.LP
If no arguments are specified, \fBzdb\fR, performs basic consistency checks on the pool and associated datasets, and report any problems detected.
If no arguments are specified, \fBzdb\fR, performs basic consistency checks on
the pool and associated datasets, and report any problems detected.
.sp
.LP
Any options supported by this command are internal to Sun and subject to change at any time.
Any options supported by this command are internal to Sun and subject to change
at any time.
.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 5n
.rt
The pool is consistent.
.RE
.sp
.ne 2
.mk
.na
\fB\fB1\fR\fR
.ad
.RS 5n
.rt
An error was detected.
.RE
.sp
.ne 2
.mk
.na
\fB\fB2\fR\fR
.ad
.RS 5n
.rt
Invalid command line options were specified.
.RE
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
AvailabilitySUNWzfsu
_
Interface StabilityUnstable
.TE
.SH SEE ALSO
.sp
.LP
\fBzfs\fR(1M), \fBzpool\fR(1M), \fBattributes\fR(5)
zfs(8), zpool(8)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
#include <solaris.h>
@ -2206,10 +2207,15 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv,
return;
for (c = 0; c < children; c++) {
uint64_t ishole = B_FALSE;
uint64_t ishole = B_FALSE, islog = B_FALSE;
if (nvlist_lookup_uint64(newchild[c],
ZPOOL_CONFIG_IS_HOLE, &ishole) == 0 && ishole)
(void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_HOLE,
&ishole);
(void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_LOG,
&islog);
if (ishole || islog)
continue;
vname = zpool_vdev_name(g_zfs, zhp, newchild[c], B_FALSE);
@ -2218,6 +2224,31 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv,
free(vname);
}
/*
* Log device section
*/
if (num_logs(newnv) > 0) {
(void) printf("%-*s - - - - - "
"-\n", cb->cb_namewidth, "logs");
for (c = 0; c < children; c++) {
uint64_t islog = B_FALSE;
(void) nvlist_lookup_uint64(newchild[c],
ZPOOL_CONFIG_IS_LOG, &islog);
if (islog) {
vname = zpool_vdev_name(g_zfs, zhp, newchild[c],
B_FALSE);
print_vdev_stats(zhp, vname, oldnv ?
oldchild[c] : NULL, newchild[c],
cb, depth + 2);
free(vname);
}
}
}
/*
* Include level 2 ARC devices in iostat output
*/
@ -3565,10 +3596,16 @@ print_dedup_stats(nvlist_t *config)
* table continue processing the stats.
*/
if (nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_DDT_OBJ_STATS,
(uint64_t **)&ddo, &c) != 0 || ddo->ddo_count == 0)
(uint64_t **)&ddo, &c) != 0)
return;
(void) printf("\n");
(void) printf(gettext(" dedup: "));
if (ddo->ddo_count == 0) {
(void) printf(gettext("no DDT entries\n"));
return;
}
(void) printf("DDT entries %llu, size %llu on disk, %llu in core\n",
(u_longlong_t)ddo->ddo_count,
(u_longlong_t)ddo->ddo_dspace,

View File

@ -3,7 +3,8 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH zstreamdump 1M "21 Sep 2009" "SunOS 5.11" "System Administration Commands"
.\" Portions Copyright 2011 Martin Matuska <mm@FreeBSD.org>
.TH ZSTREAMDUMP 1 "Sep 21, 2009"
.SH NAME
zstreamdump \- filter data in zfs send stream
.SH SYNOPSIS
@ -15,14 +16,15 @@ zstreamdump \- filter data in zfs send stream
.SH DESCRIPTION
.sp
.LP
The \fBzstreamdump\fR utility reads from the output of the \fBzfs send\fR command, then displays headers and some statistics from that output. See \fBzfs\fR(1M).
The \fBzstreamdump\fR utility reads from the output of the \fBzfs send\fR
command, then displays headers and some statistics from that output. See
\fBzfs\fR(1M).
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.mk
.na
\fB\fB-C\fR\fR
.ad
@ -33,7 +35,6 @@ Suppress the validation of checksums.
.sp
.ne 2
.mk
.na
\fB\fB-v\fR\fR
.ad
@ -42,26 +43,7 @@ Suppress the validation of checksums.
Verbose. Dump all headers, not only begin and end headers.
.RE
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
AvailabilitySUNWzfsu
_
Interface StabilityUncommitted
.TE
.SH SEE ALSO
.sp
.LP
\fBzfs\fR(1M), \fBattributes\fR(5)
zfs(8)

View File

@ -6,8 +6,8 @@
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common
LIB= zfs
DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL}
LDADD= -lmd -lpthread -lumem -lutil
DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM}
LDADD= -lmd -lpthread -lumem -lutil -lm
SRCS= deviceid.c \
fsshare.c \

View File

@ -21,8 +21,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
DPADD= ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} ${LIBUMEM} \
DPADD= ${LIBGEOM} ${LIBNVPAIR} ${LIBUMEM} \
${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
LDADD= -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
LDADD= -lgeom -lnvpair -lumem -lutil -luutil -lzfs
.include <bsd.prog.mk>

View File

@ -26,8 +26,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common
DPADD= ${LIBAVL} ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} \
DPADD= ${LIBAVL} ${LIBGEOM} ${LIBNVPAIR} \
${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS}
LDADD= -lavl -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
LDADD= -lavl -lgeom -lnvpair -lumem -lutil -luutil -lzfs
.include <bsd.prog.mk>

View File

@ -19,8 +19,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common
CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../lib/libumem
DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \
${LIBZFS} ${LIBZPOOL}
LDADD= -lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
LDADD= -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool
.include <bsd.prog.mk>

View File

@ -18,8 +18,8 @@ CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../lib/libumem
DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \
${LIBPTHREAD} ${LIBZ} ${LIBAVL}
LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lz -lavl
${LIBPTHREAD} ${LIBAVL}
LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lavl
CSTD= c99

View File

@ -23,9 +23,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../lib/libumem
DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
${LIBUUTIL} ${LIBZ} ${LIBZFS} ${LIBZPOOL}
LDADD= -lavl -lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool
DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \
${LIBUUTIL} ${LIBZFS} ${LIBZPOOL}
LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs -lzpool
.include <bsd.prog.mk>

View File

@ -1,3 +1,9 @@
--- 9.8.1-P1 released ---
3218. [security] Cache lookup could return RRSIG data associated with
nonexistent records, leading to an assertion
failure. [RT #26590]
--- 9.8.1 released ---
--- 9.8.1rc1 released ---

View File

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: query.c,v 1.353.8.11 2011-06-09 03:14:03 marka Exp $ */
/* $Id: query.c,v 1.353.8.11.4.1 2011-11-16 09:32:08 marka Exp $ */
/*! \file */
@ -1393,11 +1393,9 @@ query_addadditional(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
goto addname;
if (result == DNS_R_NCACHENXRRSET) {
dns_rdataset_disassociate(rdataset);
/*
* Negative cache entries don't have sigrdatasets.
*/
INSIST(sigrdataset == NULL ||
! dns_rdataset_isassociated(sigrdataset));
if (sigrdataset != NULL &&
dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
}
if (result == ISC_R_SUCCESS) {
mname = NULL;
@ -1438,8 +1436,9 @@ query_addadditional(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
goto addname;
if (result == DNS_R_NCACHENXRRSET) {
dns_rdataset_disassociate(rdataset);
INSIST(sigrdataset == NULL ||
! dns_rdataset_isassociated(sigrdataset));
if (sigrdataset != NULL &&
dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
}
if (result == ISC_R_SUCCESS) {
mname = NULL;
@ -1889,10 +1888,8 @@ query_addadditional2(void *arg, dns_name_t *name, dns_rdatatype_t qtype) {
goto setcache;
if (result == DNS_R_NCACHENXRRSET) {
dns_rdataset_disassociate(rdataset);
/*
* Negative cache entries don't have sigrdatasets.
*/
INSIST(! dns_rdataset_isassociated(sigrdataset));
if (dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
}
if (result == ISC_R_SUCCESS) {
/* Remember the result as a cache */

View File

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rbtdb.c,v 1.310.8.5 2011-06-08 23:02:42 each Exp $ */
/* $Id: rbtdb.c,v 1.310.8.5.4.1 2011-11-16 09:32:08 marka Exp $ */
/*! \file */
@ -5053,7 +5053,7 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
rdataset);
if (need_headerupdate(found, search.now))
update = found;
if (foundsig != NULL) {
if (!NEGATIVE(found) && foundsig != NULL) {
bind_rdataset(search.rbtdb, node, foundsig, search.now,
sigrdataset);
if (need_headerupdate(foundsig, search.now))
@ -5685,7 +5685,7 @@ cache_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
}
if (found != NULL) {
bind_rdataset(rbtdb, rbtnode, found, now, rdataset);
if (foundsig != NULL)
if (!NEGATIVE(found) && foundsig != NULL)
bind_rdataset(rbtdb, rbtnode, foundsig, now,
sigrdataset);
}

View File

@ -1,4 +1,4 @@
# $Id: version,v 1.53.8.9 2011-08-24 02:08:26 marka Exp $
# $Id: version,v 1.53.8.9.6.1 2011-11-16 09:32:07 marka Exp $
#
# This file must follow /bin/sh rules. It is imported directly via
# configure.
@ -6,5 +6,5 @@
MAJORVER=9
MINORVER=8
PATCHVER=1
RELEASETYPE=
RELEASEVER=
RELEASETYPE=-P
RELEASEVER=1

View File

@ -0,0 +1,3 @@
. ${srcdir}/emulparams/elf64ppc.sh
. ${srcdir}/emulparams/elf_fbsd.sh

View File

@ -3217,7 +3217,8 @@ legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg)
gcc_assert (!no_new_pseudos);
if (arm_pic_register != INVALID_REGNUM)
{
cfun->machine->pic_reg = gen_rtx_REG (Pmode, arm_pic_register);
if (!cfun->machine->pic_reg)
cfun->machine->pic_reg = gen_rtx_REG (Pmode, arm_pic_register);
/* Play games to avoid marking the function as needing pic
if we are being called as part of the cost-estimation
@ -3229,7 +3230,8 @@ legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg)
{
rtx seq;
cfun->machine->pic_reg = gen_reg_rtx (Pmode);
if (!cfun->machine->pic_reg)
cfun->machine->pic_reg = gen_reg_rtx (Pmode);
/* Play games to avoid marking the function as needing pic
if we are being called as part of the cost-estimation

View File

@ -193,7 +193,7 @@ extern int dot_symbols;
#undef LINK_OS_FREEBSD_SPEC
#define ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
#define ASM_SPEC "%{m32:-a32}%{!m32:-a64} " SVR4_ASM_SPEC
#define LINK_OS_FREEBSD_SPEC "%{m32:-melf32ppc}%{!m32:-melf64ppc} " LINK_OS_FREEBSD_SPEC_DEF
#define LINK_OS_FREEBSD_SPEC "%{m32:-melf32ppc_fbsd}%{!m32:-melf64ppc_fbsd} " LINK_OS_FREEBSD_SPEC_DEF
#endif
/* _init and _fini functions are built from bits spread across many
@ -253,3 +253,22 @@ extern int dot_symbols;
#undef NEED_INDICATE_EXEC_STACK
#define NEED_INDICATE_EXEC_STACK 1
/* This is how to declare the size of a function. */
#undef ASM_DECLARE_FUNCTION_SIZE
#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
do \
{ \
if (!flag_inhibit_size_directive) \
{ \
fputs ("\t.size\t", (FILE)); \
if (TARGET_64BIT && DOT_SYMBOLS) \
putc ('.', (FILE)); \
assemble_name ((FILE), (FNAME)); \
fputs (",.-", (FILE)); \
rs6000_output_function_entry (FILE, FNAME); \
putc ('\n', (FILE)); \
} \
} \
while (0)

View File

@ -201,6 +201,7 @@ THIS SOFTWARE.
#include "namespace.h"
#include <pthread.h>
#include "un-namespace.h"
#include "xlocale_private.h"
#ifdef KR_headers
#define Char char
@ -525,11 +526,11 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t));
#define strtoIQ __strtoIQ
#define strtoIx __strtoIx
#define strtoIxL __strtoIxL
#define strtord __strtord
#define strtord_l __strtord_l
#define strtordd __strtordd
#define strtorf __strtorf
#define strtorQ __strtorQ
#define strtorx __strtorx
#define strtorQ_l __strtorQ_l
#define strtorx_l __strtorx_l
#define strtorxL __strtorxL
#define strtodI __strtodI
#define strtopd __strtopd
@ -634,7 +635,7 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t));
extern Bigint *s2b ANSI((CONST char*, int, int, ULong, int));
extern Bigint *set_ones ANSI((Bigint*, int));
extern char *strcp ANSI((char*, const char*));
extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
extern int strtodg_l ANSI((CONST char*, char**, FPI*, Long*, ULong*, locale_t));
extern int strtoId ANSI((CONST char *, char **, double *, double *));
extern int strtoIdd ANSI((CONST char *, char **, double *, double *));
@ -644,17 +645,18 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t));
extern int strtoIx ANSI((CONST char *, char **, void *, void *));
extern int strtoIxL ANSI((CONST char *, char **, void *, void *));
extern double strtod ANSI((const char *s00, char **se));
extern double strtod_l ANSI((const char *s00, char **se, locale_t));
extern int strtopQ ANSI((CONST char *, char **, Void *));
extern int strtopf ANSI((CONST char *, char **, float *));
extern int strtopd ANSI((CONST char *, char **, double *));
extern int strtopdd ANSI((CONST char *, char **, double *));
extern int strtopx ANSI((CONST char *, char **, Void *));
extern int strtopxL ANSI((CONST char *, char **, Void *));
extern int strtord ANSI((CONST char *, char **, int, double *));
extern int strtord_l ANSI((CONST char *, char **, int, double *, locale_t));
extern int strtordd ANSI((CONST char *, char **, int, double *));
extern int strtorf ANSI((CONST char *, char **, int, float *));
extern int strtorQ ANSI((CONST char *, char **, int, void *));
extern int strtorx ANSI((CONST char *, char **, int, void *));
extern int strtorQ_l ANSI((CONST char *, char **, int, void *, locale_t));
extern int strtorx_l ANSI((CONST char *, char **, int, void *, locale_t));
extern int strtorxL ANSI((CONST char *, char **, int, void *));
extern Bigint *sum ANSI((Bigint*, Bigint*));
extern int trailz ANSI((Bigint*));

View File

@ -82,11 +82,11 @@ sulp
#endif /*}*/
double
strtod
strtod_l
#ifdef KR_headers
(s00, se) CONST char *s00; char **se;
(s00, se, loc) CONST char *s00; char **se; locale_t loc
#else
(CONST char *s00, char **se)
(CONST char *s00, char **se, locale_t loc)
#endif
{
#ifdef Avoid_Underflow
@ -108,14 +108,14 @@ strtod
#endif
#ifdef USE_LOCALE /*{{*/
#ifdef NO_LOCALE_CACHE
char *decimalpoint = localeconv()->decimal_point;
char *decimalpoint = localeconv_l(loc)->decimal_point;
int dplen = strlen(decimalpoint);
#else
char *decimalpoint;
static char *decimalpoint_cache;
static int dplen;
if (!(s0 = decimalpoint_cache)) {
s0 = localeconv()->decimal_point;
s0 = localeconv_l(loc)->decimal_point;
if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
strcpy(decimalpoint_cache, s0);
s0 = decimalpoint_cache;
@ -1074,3 +1074,14 @@ strtod
return sign ? -dval(&rv) : dval(&rv);
}
double
strtod
#ifdef KR_headers
(s00, se, loc) CONST char *s00; char **se; locale_t
#else
(CONST char *s00, char **se)
#endif
{
return strtod_l(s00, se, __get_locale());
}

View File

@ -313,12 +313,12 @@ mantbits(U *d)
}
int
strtodg
strtodg_l
#ifdef KR_headers
(s00, se, fpi, exp, bits)
CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits;
(s00, se, fpi, exp, bits, loc)
CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits; locale_t loc;
#else
(CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits)
(CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits, locale_t loc)
#endif
{
int abe, abits, asub;
@ -334,14 +334,14 @@ strtodg
Bigint *ab, *bb, *bb1, *bd, *bd0, *bs, *delta, *rvb, *rvb0;
#ifdef USE_LOCALE /*{{*/
#ifdef NO_LOCALE_CACHE
char *decimalpoint = localeconv()->decimal_point;
char *decimalpoint = localeconv_l(loc)->decimal_point;
int dplen = strlen(decimalpoint);
#else
char *decimalpoint;
static char *decimalpoint_cache;
static int dplen;
if (!(s0 = decimalpoint_cache)) {
s0 = localeconv()->decimal_point;
s0 = localeconv_l(loc)->decimal_point;
if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
strcpy(decimalpoint_cache, s0);
s0 = decimalpoint_cache;

View File

@ -35,9 +35,9 @@ THIS SOFTWARE.
float
#ifdef KR_headers
strtof(s, sp) CONST char *s; char **sp;
strtof_l(s, sp, loc) CONST char *s; char **sp; locale_t loc;
#else
strtof(CONST char *s, char **sp)
strtof_l(CONST char *s, char **sp, locale_t loc)
#endif
{
static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, SI };
@ -51,7 +51,7 @@ strtof(CONST char *s, char **sp)
#define fpi &fpi0
#endif
k = strtodg(s, sp, fpi, &exp, bits);
k = strtodg_l(s, sp, fpi, &exp, bits, loc);
switch(k & STRTOG_Retmask) {
case STRTOG_NoNumber:
case STRTOG_Zero:
@ -82,3 +82,13 @@ strtof(CONST char *s, char **sp)
u.L[0] |= 0x80000000L;
return u.f;
}
float
#ifdef KR_headers
strtof(s, sp) CONST char *s; char **sp;
#else
strtof(CONST char *s, char **sp)
#endif
{
return strtof_l(s, sp, __get_locale());
}

View File

@ -103,9 +103,10 @@ ULtoQ(ULong *L, ULong *bits, Long exp, int k)
int
#ifdef KR_headers
strtorQ(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L;
strtorQ_l(s, sp, rounding, L, locale) CONST char *s; char **sp; int rounding;
void *L; locale_t locale;
#else
strtorQ(CONST char *s, char **sp, int rounding, void *L)
strtorQ_l(CONST char *s, char **sp, int rounding, void *L, locale_t locale)
#endif
{
static FPI fpi0 = { 113, 1-16383-113+1, 32766-16383-113+1, 1, SI };
@ -120,7 +121,7 @@ strtorQ(CONST char *s, char **sp, int rounding, void *L)
fpi1.rounding = rounding;
fpi = &fpi1;
}
k = strtodg(s, sp, fpi, &exp, bits);
k = strtodg_l(s, sp, fpi, &exp, bits, locale);
ULtoQ((ULong*)L, bits, exp, k);
return k;
}

View File

@ -70,9 +70,10 @@ ULtod(ULong *L, ULong *bits, Long exp, int k)
int
#ifdef KR_headers
strtord(s, sp, rounding, d) CONST char *s; char **sp; int rounding; double *d;
strtord_l(s, sp, rounding, d, locale) CONST char *s; char **sp; int rounding;
double *d; locale_t locale;
#else
strtord(CONST char *s, char **sp, int rounding, double *d)
strtord_l(CONST char *s, char **sp, int rounding, double *d, locale_t locale)
#endif
{
static FPI fpi0 = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI };
@ -87,7 +88,8 @@ strtord(CONST char *s, char **sp, int rounding, double *d)
fpi1.rounding = rounding;
fpi = &fpi1;
}
k = strtodg(s, sp, fpi, &exp, bits);
k = strtodg_l(s, sp, fpi, &exp, bits, locale);
ULtod((ULong*)d, bits, exp, k);
return k;
}

View File

@ -106,9 +106,10 @@ ULtox(UShort *L, ULong *bits, Long exp, int k)
int
#ifdef KR_headers
strtorx(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L;
strtorx_l(s, sp, rounding, L, locale) CONST char *s; char **sp; int rounding;
void *L; locale_t locale;
#else
strtorx(CONST char *s, char **sp, int rounding, void *L)
strtorx_l(CONST char *s, char **sp, int rounding, void *L, locale_t locale)
#endif
{
static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI };
@ -123,7 +124,7 @@ strtorx(CONST char *s, char **sp, int rounding, void *L)
fpi1.rounding = rounding;
fpi = &fpi1;
}
k = strtodg(s, sp, fpi, &exp, bits);
k = strtodg_l(s, sp, fpi, &exp, bits, locale);
ULtox((UShort*)L, bits, exp, k);
return k;
}

View File

@ -229,6 +229,9 @@ class ASTContext : public llvm::RefCountedBase<ASTContext> {
/// \brief The type for the C sigjmp_buf type.
TypeDecl *sigjmp_bufDecl;
/// \brief The type for the C ucontext_t type.
TypeDecl *ucontext_tDecl;
/// \brief Type for the Block descriptor for Blocks CodeGen.
///
/// Since this is only used for generation of debug info, it is not
@ -955,6 +958,18 @@ class ASTContext : public llvm::RefCountedBase<ASTContext> {
return QualType();
}
/// \brief Set the type for the C ucontext_t type.
void setucontext_tDecl(TypeDecl *ucontext_tDecl) {
this->ucontext_tDecl = ucontext_tDecl;
}
/// \brief Retrieve the C ucontext_t type.
QualType getucontext_tType() const {
if (ucontext_tDecl)
return getTypeDeclType(ucontext_tDecl);
return QualType();
}
/// \brief The result type of logical operations, '<', '>', '!=', etc.
QualType getLogicalOperationType() const {
return getLangOptions().CPlusPlus ? BoolTy : IntTy;
@ -1099,7 +1114,8 @@ class ASTContext : public llvm::RefCountedBase<ASTContext> {
enum GetBuiltinTypeError {
GE_None, //< No error
GE_Missing_stdio, //< Missing a type from <stdio.h>
GE_Missing_setjmp //< Missing a type from <setjmp.h>
GE_Missing_setjmp, //< Missing a type from <setjmp.h>
GE_Missing_ucontext //< Missing a type from <ucontext.h>
};
/// GetBuiltinType - Return the type for the specified builtin. If

View File

@ -39,6 +39,7 @@
// P -> FILE
// J -> jmp_buf
// SJ -> sigjmp_buf
// K -> ucontext_t
// . -> "...". This may only occur at the end of the function list.
//
// Types may be prefixed with the following modifiers:
@ -480,111 +481,111 @@ BUILTIN(__builtin_alloca, "v*z" , "n")
// FIXME: These assume that char -> i8, short -> i16, int -> i32,
// long long -> i64.
BUILTIN(__sync_fetch_and_add, "v.", "")
BUILTIN(__sync_fetch_and_add_1, "ccD*c.", "n")
BUILTIN(__sync_fetch_and_add_2, "ssD*s.", "n")
BUILTIN(__sync_fetch_and_add_4, "iiD*i.", "n")
BUILTIN(__sync_fetch_and_add_8, "LLiLLiD*LLi.", "n")
BUILTIN(__sync_fetch_and_add_16, "LLLiLLLiD*LLLi.", "n")
BUILTIN(__sync_fetch_and_add, "v.", "t")
BUILTIN(__sync_fetch_and_add_1, "ccD*c.", "nt")
BUILTIN(__sync_fetch_and_add_2, "ssD*s.", "nt")
BUILTIN(__sync_fetch_and_add_4, "iiD*i.", "nt")
BUILTIN(__sync_fetch_and_add_8, "LLiLLiD*LLi.", "nt")
BUILTIN(__sync_fetch_and_add_16, "LLLiLLLiD*LLLi.", "nt")
BUILTIN(__sync_fetch_and_sub, "v.", "")
BUILTIN(__sync_fetch_and_sub_1, "ccD*c.", "n")
BUILTIN(__sync_fetch_and_sub_2, "ssD*s.", "n")
BUILTIN(__sync_fetch_and_sub_4, "iiD*i.", "n")
BUILTIN(__sync_fetch_and_sub_8, "LLiLLiD*LLi.", "n")
BUILTIN(__sync_fetch_and_sub_16, "LLLiLLLiD*LLLi.", "n")
BUILTIN(__sync_fetch_and_sub, "v.", "t")
BUILTIN(__sync_fetch_and_sub_1, "ccD*c.", "nt")
BUILTIN(__sync_fetch_and_sub_2, "ssD*s.", "nt")
BUILTIN(__sync_fetch_and_sub_4, "iiD*i.", "nt")
BUILTIN(__sync_fetch_and_sub_8, "LLiLLiD*LLi.", "nt")
BUILTIN(__sync_fetch_and_sub_16, "LLLiLLLiD*LLLi.", "nt")
BUILTIN(__sync_fetch_and_or, "v.", "")
BUILTIN(__sync_fetch_and_or_1, "ccD*c.", "n")
BUILTIN(__sync_fetch_and_or_2, "ssD*s.", "n")
BUILTIN(__sync_fetch_and_or_4, "iiD*i.", "n")
BUILTIN(__sync_fetch_and_or_8, "LLiLLiD*LLi.", "n")
BUILTIN(__sync_fetch_and_or_16, "LLLiLLLiD*LLLi.", "n")
BUILTIN(__sync_fetch_and_or, "v.", "t")
BUILTIN(__sync_fetch_and_or_1, "ccD*c.", "nt")
BUILTIN(__sync_fetch_and_or_2, "ssD*s.", "nt")
BUILTIN(__sync_fetch_and_or_4, "iiD*i.", "nt")
BUILTIN(__sync_fetch_and_or_8, "LLiLLiD*LLi.", "nt")
BUILTIN(__sync_fetch_and_or_16, "LLLiLLLiD*LLLi.", "nt")
BUILTIN(__sync_fetch_and_and, "v.", "")
BUILTIN(__sync_fetch_and_and_1, "ccD*c.", "n")
BUILTIN(__sync_fetch_and_and_2, "ssD*s.", "n")
BUILTIN(__sync_fetch_and_and_4, "iiD*i.", "n")
BUILTIN(__sync_fetch_and_and_8, "LLiLLiD*LLi.", "n")
BUILTIN(__sync_fetch_and_and_16, "LLLiLLLiD*LLLi.", "n")
BUILTIN(__sync_fetch_and_and, "v.", "t")
BUILTIN(__sync_fetch_and_and_1, "ccD*c.", "tn")
BUILTIN(__sync_fetch_and_and_2, "ssD*s.", "tn")
BUILTIN(__sync_fetch_and_and_4, "iiD*i.", "tn")
BUILTIN(__sync_fetch_and_and_8, "LLiLLiD*LLi.", "tn")
BUILTIN(__sync_fetch_and_and_16, "LLLiLLLiD*LLLi.", "tn")
BUILTIN(__sync_fetch_and_xor, "v.", "")
BUILTIN(__sync_fetch_and_xor_1, "ccD*c.", "n")
BUILTIN(__sync_fetch_and_xor_2, "ssD*s.", "n")
BUILTIN(__sync_fetch_and_xor_4, "iiD*i.", "n")
BUILTIN(__sync_fetch_and_xor_8, "LLiLLiD*LLi.", "n")
BUILTIN(__sync_fetch_and_xor_16, "LLLiLLLiD*LLLi.", "n")
BUILTIN(__sync_fetch_and_xor, "v.", "t")
BUILTIN(__sync_fetch_and_xor_1, "ccD*c.", "tn")
BUILTIN(__sync_fetch_and_xor_2, "ssD*s.", "tn")
BUILTIN(__sync_fetch_and_xor_4, "iiD*i.", "tn")
BUILTIN(__sync_fetch_and_xor_8, "LLiLLiD*LLi.", "tn")
BUILTIN(__sync_fetch_and_xor_16, "LLLiLLLiD*LLLi.", "tn")
BUILTIN(__sync_add_and_fetch, "v.", "")
BUILTIN(__sync_add_and_fetch_1, "ccD*c.", "n")
BUILTIN(__sync_add_and_fetch_2, "ssD*s.", "n")
BUILTIN(__sync_add_and_fetch_4, "iiD*i.", "n")
BUILTIN(__sync_add_and_fetch_8, "LLiLLiD*LLi.", "n")
BUILTIN(__sync_add_and_fetch_16, "LLLiLLLiD*LLLi.", "n")
BUILTIN(__sync_add_and_fetch, "v.", "t")
BUILTIN(__sync_add_and_fetch_1, "ccD*c.", "tn")
BUILTIN(__sync_add_and_fetch_2, "ssD*s.", "tn")
BUILTIN(__sync_add_and_fetch_4, "iiD*i.", "tn")
BUILTIN(__sync_add_and_fetch_8, "LLiLLiD*LLi.", "tn")
BUILTIN(__sync_add_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
BUILTIN(__sync_sub_and_fetch, "v.", "")
BUILTIN(__sync_sub_and_fetch_1, "ccD*c.", "n")
BUILTIN(__sync_sub_and_fetch_2, "ssD*s.", "n")
BUILTIN(__sync_sub_and_fetch_4, "iiD*i.", "n")
BUILTIN(__sync_sub_and_fetch_8, "LLiLLiD*LLi.", "n")
BUILTIN(__sync_sub_and_fetch_16, "LLLiLLLiD*LLLi.", "n")
BUILTIN(__sync_sub_and_fetch, "v.", "t")
BUILTIN(__sync_sub_and_fetch_1, "ccD*c.", "tn")
BUILTIN(__sync_sub_and_fetch_2, "ssD*s.", "tn")
BUILTIN(__sync_sub_and_fetch_4, "iiD*i.", "tn")
BUILTIN(__sync_sub_and_fetch_8, "LLiLLiD*LLi.", "tn")
BUILTIN(__sync_sub_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
BUILTIN(__sync_or_and_fetch, "v.", "")
BUILTIN(__sync_or_and_fetch_1, "ccD*c.", "n")
BUILTIN(__sync_or_and_fetch_2, "ssD*s.", "n")
BUILTIN(__sync_or_and_fetch_4, "iiD*i.", "n")
BUILTIN(__sync_or_and_fetch_8, "LLiLLiD*LLi.", "n")
BUILTIN(__sync_or_and_fetch_16, "LLLiLLLiD*LLLi.", "n")
BUILTIN(__sync_or_and_fetch, "v.", "t")
BUILTIN(__sync_or_and_fetch_1, "ccD*c.", "tn")
BUILTIN(__sync_or_and_fetch_2, "ssD*s.", "tn")
BUILTIN(__sync_or_and_fetch_4, "iiD*i.", "tn")
BUILTIN(__sync_or_and_fetch_8, "LLiLLiD*LLi.", "tn")
BUILTIN(__sync_or_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
BUILTIN(__sync_and_and_fetch, "v.", "")
BUILTIN(__sync_and_and_fetch_1, "ccD*c.", "n")
BUILTIN(__sync_and_and_fetch_2, "ssD*s.", "n")
BUILTIN(__sync_and_and_fetch_4, "iiD*i.", "n")
BUILTIN(__sync_and_and_fetch_8, "LLiLLiD*LLi.", "n")
BUILTIN(__sync_and_and_fetch_16, "LLLiLLLiD*LLLi.", "n")
BUILTIN(__sync_and_and_fetch, "v.", "t")
BUILTIN(__sync_and_and_fetch_1, "ccD*c.", "tn")
BUILTIN(__sync_and_and_fetch_2, "ssD*s.", "tn")
BUILTIN(__sync_and_and_fetch_4, "iiD*i.", "tn")
BUILTIN(__sync_and_and_fetch_8, "LLiLLiD*LLi.", "tn")
BUILTIN(__sync_and_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
BUILTIN(__sync_xor_and_fetch, "v.", "")
BUILTIN(__sync_xor_and_fetch_1, "ccD*c.", "n")
BUILTIN(__sync_xor_and_fetch_2, "ssD*s.", "n")
BUILTIN(__sync_xor_and_fetch_4, "iiD*i.", "n")
BUILTIN(__sync_xor_and_fetch_8, "LLiLLiD*LLi.", "n")
BUILTIN(__sync_xor_and_fetch_16, "LLLiLLLiD*LLLi.", "n")
BUILTIN(__sync_xor_and_fetch, "v.", "t")
BUILTIN(__sync_xor_and_fetch_1, "ccD*c.", "tn")
BUILTIN(__sync_xor_and_fetch_2, "ssD*s.", "tn")
BUILTIN(__sync_xor_and_fetch_4, "iiD*i.", "tn")
BUILTIN(__sync_xor_and_fetch_8, "LLiLLiD*LLi.", "tn")
BUILTIN(__sync_xor_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
BUILTIN(__sync_bool_compare_and_swap, "v.", "")
BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "n")
BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "n")
BUILTIN(__sync_bool_compare_and_swap_4, "biD*ii.", "n")
BUILTIN(__sync_bool_compare_and_swap_8, "bLLiD*LLiLLi.", "n")
BUILTIN(__sync_bool_compare_and_swap_16, "bLLLiD*LLLiLLLi.", "n")
BUILTIN(__sync_bool_compare_and_swap, "v.", "t")
BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "tn")
BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "tn")
BUILTIN(__sync_bool_compare_and_swap_4, "biD*ii.", "tn")
BUILTIN(__sync_bool_compare_and_swap_8, "bLLiD*LLiLLi.", "tn")
BUILTIN(__sync_bool_compare_and_swap_16, "bLLLiD*LLLiLLLi.", "tn")
BUILTIN(__sync_val_compare_and_swap, "v.", "")
BUILTIN(__sync_val_compare_and_swap_1, "ccD*cc.", "n")
BUILTIN(__sync_val_compare_and_swap_2, "ssD*ss.", "n")
BUILTIN(__sync_val_compare_and_swap_4, "iiD*ii.", "n")
BUILTIN(__sync_val_compare_and_swap_8, "LLiLLiD*LLiLLi.", "n")
BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLiD*LLLiLLLi.", "n")
BUILTIN(__sync_val_compare_and_swap, "v.", "t")
BUILTIN(__sync_val_compare_and_swap_1, "ccD*cc.", "tn")
BUILTIN(__sync_val_compare_and_swap_2, "ssD*ss.", "tn")
BUILTIN(__sync_val_compare_and_swap_4, "iiD*ii.", "tn")
BUILTIN(__sync_val_compare_and_swap_8, "LLiLLiD*LLiLLi.", "tn")
BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLiD*LLLiLLLi.", "tn")
BUILTIN(__sync_lock_test_and_set, "v.", "")
BUILTIN(__sync_lock_test_and_set_1, "ccD*c.", "n")
BUILTIN(__sync_lock_test_and_set_2, "ssD*s.", "n")
BUILTIN(__sync_lock_test_and_set_4, "iiD*i.", "n")
BUILTIN(__sync_lock_test_and_set_8, "LLiLLiD*LLi.", "n")
BUILTIN(__sync_lock_test_and_set_16, "LLLiLLLiD*LLLi.", "n")
BUILTIN(__sync_lock_test_and_set, "v.", "t")
BUILTIN(__sync_lock_test_and_set_1, "ccD*c.", "tn")
BUILTIN(__sync_lock_test_and_set_2, "ssD*s.", "tn")
BUILTIN(__sync_lock_test_and_set_4, "iiD*i.", "tn")
BUILTIN(__sync_lock_test_and_set_8, "LLiLLiD*LLi.", "tn")
BUILTIN(__sync_lock_test_and_set_16, "LLLiLLLiD*LLLi.", "tn")
BUILTIN(__sync_lock_release, "v.", "")
BUILTIN(__sync_lock_release_1, "vcD*.", "n")
BUILTIN(__sync_lock_release_2, "vsD*.", "n")
BUILTIN(__sync_lock_release_4, "viD*.", "n")
BUILTIN(__sync_lock_release_8, "vLLiD*.", "n")
BUILTIN(__sync_lock_release_16, "vLLLiD*.", "n")
BUILTIN(__sync_lock_release, "v.", "t")
BUILTIN(__sync_lock_release_1, "vcD*.", "tn")
BUILTIN(__sync_lock_release_2, "vsD*.", "tn")
BUILTIN(__sync_lock_release_4, "viD*.", "tn")
BUILTIN(__sync_lock_release_8, "vLLiD*.", "tn")
BUILTIN(__sync_lock_release_16, "vLLLiD*.", "tn")
BUILTIN(__sync_swap, "v.", "")
BUILTIN(__sync_swap_1, "ccD*c.", "n")
BUILTIN(__sync_swap_2, "ssD*s.", "n")
BUILTIN(__sync_swap_4, "iiD*i.", "n")
BUILTIN(__sync_swap_8, "LLiLLiD*LLi.", "n")
BUILTIN(__sync_swap_16, "LLLiLLLiD*LLLi.", "n")
BUILTIN(__sync_swap, "v.", "t")
BUILTIN(__sync_swap_1, "ccD*c.", "tn")
BUILTIN(__sync_swap_2, "ssD*s.", "tn")
BUILTIN(__sync_swap_4, "iiD*i.", "tn")
BUILTIN(__sync_swap_8, "LLiLLiD*LLi.", "tn")
BUILTIN(__sync_swap_16, "LLLiLLLiD*LLLi.", "tn")
BUILTIN(__atomic_load, "v.", "t")
BUILTIN(__atomic_store, "v.", "t")
@ -679,13 +680,13 @@ LIBBUILTIN(vfork, "i", "fj", "unistd.h", ALL_LANGUAGES)
// it here to avoid having two identical LIBBUILTIN entries.
#undef setjmp
LIBBUILTIN(_setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(__sigsetjmp, "iJi", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(__sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(sigsetjmp, "iJi", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(setjmp_syscall, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(savectx, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(qsetjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(getcontext, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(getcontext, "iK*", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h", ALL_LANGUAGES)

View File

@ -26,6 +26,7 @@ def : DiagGroup<"attributes">;
def : DiagGroup<"bad-function-cast">;
def Availability : DiagGroup<"availability">;
def BoolConversions : DiagGroup<"bool-conversions">;
def BuiltinRequiresHeader : DiagGroup<"builtin-requires-header">;
def CXXCompat: DiagGroup<"c++-compat">;
def CastAlign : DiagGroup<"cast-align">;
def : DiagGroup<"cast-qual">;

View File

@ -254,10 +254,16 @@ def note_please_include_header : Note<
def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
def warn_implicit_decl_requires_stdio : Warning<
"declaration of built-in function '%0' requires inclusion of the header "
"<stdio.h>">;
"<stdio.h>">,
InGroup<BuiltinRequiresHeader>;
def warn_implicit_decl_requires_setjmp : Warning<
"declaration of built-in function '%0' requires inclusion of the header "
"<setjmp.h>">;
"<setjmp.h>">,
InGroup<BuiltinRequiresHeader>;
def warn_implicit_decl_requires_ucontext : Warning<
"declaration of built-in function '%0' requires inclusion of the header "
"<ucontext.h>">,
InGroup<BuiltinRequiresHeader>;
def warn_redecl_library_builtin : Warning<
"incompatible redeclaration of library function %0">;
def err_builtin_definition : Error<"definition of builtin function %0">;

View File

@ -677,7 +677,9 @@ namespace clang {
/// \brief Objective-C "Class" redefinition type
SPECIAL_TYPE_OBJC_CLASS_REDEFINITION = 7,
/// \brief Objective-C "SEL" redefinition type
SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 8
SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 8,
/// \brief C ucontext_t typedef type
SPECIAL_TYPE_UCONTEXT_T = 9
};
/// \brief The number of special type IDs.

View File

@ -227,8 +227,9 @@ ASTContext::ASTContext(LangOptions& LOpts, SourceManager &SM,
ObjCIdDecl(0), ObjCSelDecl(0), ObjCClassDecl(0),
CFConstantStringTypeDecl(0), ObjCInstanceTypeDecl(0),
FILEDecl(0),
jmp_bufDecl(0), sigjmp_bufDecl(0), BlockDescriptorType(0),
BlockDescriptorExtendedType(0), cudaConfigureCallDecl(0),
jmp_bufDecl(0), sigjmp_bufDecl(0), ucontext_tDecl(0),
BlockDescriptorType(0), BlockDescriptorExtendedType(0),
cudaConfigureCallDecl(0),
NullTypeSourceInfo(QualType()),
SourceMgr(SM), LangOpts(LOpts),
AddrSpaceMap(0), Target(t), PrintingPolicy(LOpts),
@ -6293,6 +6294,15 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context,
return QualType();
}
break;
case 'K':
assert(HowLong == 0 && !Signed && !Unsigned && "Bad modifiers for 'K'!");
Type = Context.getucontext_tType();
if (Type.isNull()) {
Error = ASTContext::GE_Missing_ucontext;
return QualType();
}
break;
}
// If there are modifiers and if we're allowed to parse them, go for it.

View File

@ -1282,6 +1282,7 @@ class X86TargetInfo : public TargetInfo {
CK_K8SSE3,
CK_Opteron,
CK_OpteronSSE3,
CK_AMDFAM10,
/// This specification is deprecated and will be removed in the future.
/// Users should prefer \see CK_K8.
@ -1381,6 +1382,7 @@ class X86TargetInfo : public TargetInfo {
.Case("k8-sse3", CK_K8SSE3)
.Case("opteron", CK_Opteron)
.Case("opteron-sse3", CK_OpteronSSE3)
.Case("amdfam10", CK_AMDFAM10)
.Case("x86-64", CK_x86_64)
.Case("geode", CK_Geode)
.Default(CK_Generic);
@ -1441,6 +1443,7 @@ class X86TargetInfo : public TargetInfo {
case CK_K8SSE3:
case CK_Opteron:
case CK_OpteronSSE3:
case CK_AMDFAM10:
case CK_x86_64:
return true;
}
@ -1459,12 +1462,10 @@ void X86TargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const {
Features["ssse3"] = false;
Features["sse41"] = false;
Features["sse42"] = false;
Features["sse4a"] = false;
Features["aes"] = false;
Features["avx"] = false;
// LLVM does not currently recognize this.
// Features["sse4a"] = false;
// FIXME: This *really* should not be here.
// X86_64 always has SSE2.
@ -1561,6 +1562,11 @@ void X86TargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const {
setFeatureEnabled(Features, "sse3", true);
setFeatureEnabled(Features, "3dnowa", true);
break;
case CK_AMDFAM10:
setFeatureEnabled(Features, "sse3", true);
setFeatureEnabled(Features, "sse4a", true);
setFeatureEnabled(Features, "3dnowa", true);
break;
case CK_C3_2:
setFeatureEnabled(Features, "mmx", true);
setFeatureEnabled(Features, "sse", true);
@ -1604,6 +1610,8 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
else if (Name == "avx")
Features["avx"] = Features["sse"] = Features["sse2"] = Features["sse3"] =
Features["ssse3"] = Features["sse41"] = Features["sse42"] = true;
else if (Name == "sse4a")
Features["sse4a"] = true;
} else {
if (Name == "mmx")
Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = false;
@ -1630,6 +1638,8 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
Features["aes"] = false;
else if (Name == "avx")
Features["avx"] = false;
else if (Name == "sse4a")
Features["sse4a"] = false;
}
return true;
@ -1826,6 +1836,11 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__k8__");
Builder.defineMacro("__tune_k8__");
break;
case CK_AMDFAM10:
Builder.defineMacro("__amdfam10");
Builder.defineMacro("__amdfam10__");
Builder.defineMacro("__tune_amdfam10__");
break;
case CK_Geode:
Builder.defineMacro("__geode");
Builder.defineMacro("__geode__");

View File

@ -3926,7 +3926,7 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
if (getToolChain().getArchName() == "powerpc") {
CmdArgs.push_back("-m");
CmdArgs.push_back("elf32ppc");
CmdArgs.push_back("elf32ppc_fbsd");
}
if (Output.isFilename()) {

View File

@ -803,14 +803,6 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
for (unsigned i = 0; i != NumFixed; ++i) {
ExprResult Arg = TheCall->getArg(i+1);
// If the argument is an implicit cast, then there was a promotion due to
// "...", just remove it now.
if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Arg.get())) {
Arg = ICE->getSubExpr();
ICE->setSubExpr(0);
TheCall->setArg(i+1, Arg.get());
}
// GCC does an implicit conversion to the pointer or integer ValType. This
// can fail in some cases (1i -> int**), check for this error case now.
// Initialize the argument.

View File

@ -1305,6 +1305,12 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid,
Diag(Loc, diag::warn_implicit_decl_requires_setjmp)
<< Context.BuiltinInfo.GetName(BID);
return 0;
case ASTContext::GE_Missing_ucontext:
if (ForRedeclaration)
Diag(Loc, diag::warn_implicit_decl_requires_ucontext)
<< Context.BuiltinInfo.GetName(BID);
return 0;
}
if (!ForRedeclaration && Context.BuiltinInfo.isPredefinedLibFunction(BID)) {
@ -3635,6 +3641,8 @@ Sema::ActOnTypedefNameDecl(Scope *S, DeclContext *DC, TypedefNameDecl *NewTD,
Context.setjmp_bufDecl(NewTD);
else if (II->isStr("sigjmp_buf"))
Context.setsigjmp_bufDecl(NewTD);
else if (II->isStr("ucontext_t"))
Context.setucontext_tDecl(NewTD);
else if (II->isStr("__builtin_va_list"))
Context.setBuiltinVaListType(Context.getTypedefType(NewTD));
}

View File

@ -2659,6 +2659,24 @@ void ASTReader::InitializeContext() {
if (Context.ObjCSelRedefinitionType.isNull())
Context.ObjCSelRedefinitionType = GetType(ObjCSelRedef);
}
if (unsigned Ucontext_t = SpecialTypes[SPECIAL_TYPE_UCONTEXT_T]) {
QualType Ucontext_tType = GetType(Ucontext_t);
if (Ucontext_tType.isNull()) {
Error("ucontext_t type is NULL");
return;
}
if (!Context.ucontext_tDecl) {
if (const TypedefType *Typedef = Ucontext_tType->getAs<TypedefType>())
Context.setucontext_tDecl(Typedef->getDecl());
else {
const TagType *Tag = Ucontext_tType->getAs<TagType>();
assert(Tag && "Invalid ucontext_t type in AST file");
Context.setucontext_tDecl(Tag->getDecl());
}
}
}
}
ReadPragmaDiagnosticMappings(Context.getDiagnostics());

View File

@ -2994,6 +2994,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls,
AddTypeRef(Context.ObjCIdRedefinitionType, SpecialTypes);
AddTypeRef(Context.ObjCClassRedefinitionType, SpecialTypes);
AddTypeRef(Context.ObjCSelRedefinitionType, SpecialTypes);
AddTypeRef(Context.getucontext_tType(), SpecialTypes);
// Keep writing types and declarations until all types and
// declarations have been written.

View File

@ -450,6 +450,7 @@ register const int doextend;
_close(fid);
return -1;
}
free(fullname);
}
u = malloc(sizeof(*u));
if (u == NULL)

View File

@ -1,5 +1,5 @@
# <pre>
# @(#)australasia 8.28
# @(#)australasia 8.29
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@ -308,6 +308,20 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
# advance at 2am to 3am on October 23, 2011 and one hour back at 3am to
# 2am on February 26 next year.
# From Ken Rylander (2011-10-24)
# Another change to the Fiji DST end date. In the TZ database the end date for
# Fiji DST 2012, is currently Feb 26. This has been changed to Jan 22.
#
# <a href="http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=5017:amendments-to-daylight-savings&catid=71:press-releases&Itemid=155">
# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=5017:amendments-to-daylight-savings&catid=71:press-releases&Itemid=155
# </a>
# states:
#
# The end of daylight saving scheduled initially for the 26th of February 2012
# has been brought forward to the 22nd of January 2012.
# The commencement of daylight saving will remain unchanged and start
# on the 23rd of October, 2011.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S
Rule Fiji 1999 2000 - Feb lastSun 3:00 0 -
@ -316,7 +330,7 @@ Rule Fiji 2010 only - Mar lastSun 3:00 0 -
Rule Fiji 2010 only - Oct 24 2:00 1:00 S
Rule Fiji 2011 only - Mar Sun>=1 3:00 0 -
Rule Fiji 2011 only - Oct 23 2:00 1:00 S
Rule Fiji 2012 only - Feb 26 3:00 0 -
Rule Fiji 2012 only - Jan 22 3:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Fiji 11:53:40 - LMT 1915 Oct 26 # Suva
12:00 Fiji FJ%sT # Fiji Time

View File

@ -1,5 +1,5 @@
# <pre>
# @(#)backward 8.10
# @(#)backward 8.11
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@ -67,6 +67,7 @@ Link America/Havana Cuba
Link Africa/Cairo Egypt
Link Europe/Dublin Eire
Link Europe/London Europe/Belfast
Link Europe/Chisinau Europe/Tiraspol
Link Europe/London GB
Link Europe/London GB-Eire
Link Etc/GMT GMT+0

View File

@ -1,5 +1,5 @@
# <pre>
# @(#)europe 8.39
# @(#)europe 8.40
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@ -1678,6 +1678,18 @@ Zone Europe/Malta 0:58:04 - LMT 1893 Nov 2 0:00s # Valletta
# a pre-1880 LMT offset of 1:58:32.
#
# (which agrees with the earlier entry that had been removed)
#
# From Alexander Krivenyshev (2011-10-26)
# NO need to divide Moldova into two timezones at this point.
# As of today, Transnistria (Pridnestrovie)- Tiraspol reversed its own
# decision to abolish DST this winter.
# Following Moldova and neighboring Ukraine- Transnistria (Pridnestrovie)-
# Tiraspol will go back to winter time on October 30, 2011.
# News from Moldova (in russian):
# <a href="http://ru.publika.md/link_317061.html">
# http://ru.publika.md/link_317061.html
# </a>
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Europe/Chisinau 1:55:20 - LMT 1880
@ -1694,21 +1706,6 @@ Zone Europe/Chisinau 1:55:20 - LMT 1880
# See Romania commentary for the guessed 1997 transition to EU rules.
2:00 EU EE%sT
Zone Europe/Tiraspol 1:58:32 - LMT 1880
1:55 - CMT 1918 Feb 15 # Chisinau MT
1:44:24 - BMT 1931 Jul 24 # Bucharest MT
2:00 Romania EE%sT 1940 Aug 15
2:00 1:00 EEST 1941 Jul 17
1:00 C-Eur CE%sT 1944 Aug 24
3:00 Russia MSK/MSD 1990
3:00 - MSK 1990 May 6
2:00 - EET 1991
2:00 Russia EE%sT 1992
2:00 E-Eur EE%sT 1997
# See Romania commentary for the guessed 1997 transition to EU rules.
2:00 EU EE%sT 2011 Mar lastSun 1:00u
3:00 - FET # Further-eastern European Time
# Monaco
# Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
# more precise 0:09:21.

View File

@ -1,5 +1,5 @@
# <pre>
# @(#)northamerica 8.50
# @(#)northamerica 8.51
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@ -2690,6 +2690,20 @@ Zone America/Costa_Rica -5:36:20 - LMT 1890 # San Jose
# <a href="http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html">
# http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html
# </a>
#
# From Steffen Thorsen (2011-10-30)
# Cuba will end DST two weeks later this year. Instead of going back
# tonight, it has been delayed to 2011-11-13 at 01:00.
#
# One source (Spanish)
# <a href="http://www.radioangulo.cu/noticias/cuba/17105-cuba-restablecera-el-horario-del-meridiano-de-greenwich.html">
# http://www.radioangulo.cu/noticias/cuba/17105-cuba-restablecera-el-horario-del-meridiano-de-greenwich.html
# </a>
#
# Our page:
# <a href="http://www.timeanddate.com/news/time/cuba-time-changes-2011.html">
# http://www.timeanddate.com/news/time/cuba-time-changes-2011.html
# </a>
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Cuba 1928 only - Jun 10 0:00 1:00 D
@ -2721,12 +2735,14 @@ Rule Cuba 1997 only - Oct 12 0:00s 0 S
Rule Cuba 1998 1999 - Mar lastSun 0:00s 1:00 D
Rule Cuba 1998 2003 - Oct lastSun 0:00s 0 S
Rule Cuba 2000 2004 - Apr Sun>=1 0:00s 1:00 D
Rule Cuba 2006 max - Oct lastSun 0:00s 0 S
Rule Cuba 2006 2010 - Oct lastSun 0:00s 0 S
Rule Cuba 2007 only - Mar Sun>=8 0:00s 1:00 D
Rule Cuba 2008 only - Mar Sun>=15 0:00s 1:00 D
Rule Cuba 2009 2010 - Mar Sun>=8 0:00s 1:00 D
Rule Cuba 2011 only - Mar Sun>=15 0:00s 1:00 D
Rule Cuba 2011 only - Nov 13 0:00s 0 S
Rule Cuba 2012 max - Mar Sun>=8 0:00s 1:00 D
Rule Cuba 2012 max - Oct lastSun 0:00s 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Havana -5:29:28 - LMT 1890

View File

@ -1,5 +1,5 @@
# <pre>
# @(#)zone.tab 8.50
# @(#)zone.tab 8.52
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
#
@ -257,8 +257,7 @@ LV +5657+02406 Europe/Riga
LY +3254+01311 Africa/Tripoli
MA +3339-00735 Africa/Casablanca
MC +4342+00723 Europe/Monaco
MD +4700+02850 Europe/Chisinau most locations
MD +4651+02938 Europe/Tiraspol Pridnestrovie
MD +4700+02850 Europe/Chisinau
ME +4226+01916 Europe/Podgorica
MF +1804-06305 America/Marigot
MG -1855+04731 Indian/Antananarivo

View File

@ -150,8 +150,8 @@ daily_submit_queuerun="YES" # Also submit queue
# 800.scrub-zfs
daily_scrub_zfs_enable="NO"
daily_scrub_zfs_pools="" # empty string selects all pools
daily_scrub_zfs_default_threshold="30" # days between scrubs
#daily_scrub_zfs_${poolname}_threshold="30" # pool specific threshold
daily_scrub_zfs_default_threshold="35" # days between scrubs
#daily_scrub_zfs_${poolname}_threshold="35" # pool specific threshold
# 999.local
daily_local="/etc/daily.local" # Local scripts

View File

@ -31,11 +31,9 @@
#
# Examples:
# Historically X depended on this, but version 4.3.0 doesn't seem to anymore
#link ttyv0 vga
# Commonly used by many ports
#link acd0 cdrom
#link cd0 cdrom
#link cd0 dvd
# Allow a user in the wheel group to query the smb0 device
#perm smb0 0660

View File

@ -30,8 +30,13 @@ case "$daily_accounting_enable" in
cd /var/account
rc=0
n=$daily_accounting_save
rm -f acct.$n.gz acct.$n || rc=3
n=$(( $daily_accounting_save - 1 ))
for f in acct.*; do
case "$f" in acct.\*) continue ;; esac # No files match
m=${f%.gz} ; m=${m#acct.}
[ $m -ge $n ] && { rm $f || rc=3; }
done
m=$n
n=$(($n - 1))
while [ $n -ge 0 ]
@ -44,13 +49,14 @@ case "$daily_accounting_enable" in
/etc/rc.d/accounting rotate_log || rc=3
rm -f acct.merge && cp acct.0 acct.merge || rc=3
sa -s $daily_accounting_flags /var/account/acct.merge || rc=3
rm acct.merge
case "$daily_accounting_compress" in
[Yy][Ee][Ss])
gzip --keep -f acct.0 || rc=3;;
gzip -f acct.0 || rc=3;;
esac
sa -s $daily_accounting_flags /var/account/acct.0 &&
unlink acct.0 || rc=3
fi;;
*) rc=0;;

View File

@ -15,7 +15,7 @@ then
source_periodic_confs
fi
: ${daily_scrub_zfs_default_threshold=30}
: ${daily_scrub_zfs_default_threshold=35}
case "$daily_scrub_zfs_enable" in
[Yy][Ee][Ss])

View File

@ -15,9 +15,21 @@ name="dhclient"
rcvar=
pidfile="/var/run/${name}.${ifn}.pid"
start_precmd="dhclient_prestart"
stop_precmd="dhclient_pre_check"
# rc_force check can only be done at the run_rc_command
# time, so we're testing it in the pre* hooks.
dhclient_pre_check()
{
if [ -z "${rc_force}" ] && ! dhcpif $ifn; then
err 1 "'$ifn' is not a DHCP-enabled interface"
fi
}
dhclient_prestart()
{
dhclient_pre_check
# Interface-specific flags (see rc.subr for $flags setting)
specific=$(get_if_var $ifn dhclient_flags_IF)
if [ -z "$flags" -a -n "$specific" ]; then
@ -38,11 +50,8 @@ load_rc_config network
if [ -z $ifn ] ; then
# only complain if a command was specified but no interface
if [ -n "$1" ] ; then
echo 1>&2 "$0: no interface specified"
return 1
err 1 "$0: no interface specified"
fi
elif [ -z "${rc_force}" ] && ! dhcpif $ifn; then
return 1
fi
run_rc_command "$1"

View File

@ -29,6 +29,8 @@ nfsd_precmd()
if checkyesno nfs_reserved_port_only; then
echo 'NFS on reserved port only=YES'
sysctl vfs.nfsrv.nfs_privport=1 > /dev/null
else
sysctl vfs.nfsrv.nfs_privport=0 > /dev/null
fi
else
rc_flags="${nfs_server_flags}"
@ -40,9 +42,12 @@ nfsd_precmd()
if checkyesno nfs_reserved_port_only; then
echo 'NFS on reserved port only=YES'
sysctl vfs.nfsd.nfs_privport=1 > /dev/null
else
sysctl vfs.nfsd.nfs_privport=0 > /dev/null
fi
if checkyesno nfsv4_server_enable; then
sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null
if ! checkyesno nfsuserd_enable && \
! /etc/rc.d/nfsuserd forcestatus 1>/dev/null 2>&1
then

View File

@ -247,6 +247,7 @@ static_atm()
static_ipx()
{
:
}
ropts_init()

View File

@ -99,7 +99,7 @@ syscons_configure_keyboard()
*)
sc_init
echo -n ' keychange'
set - ${keychange}
set -- ${keychange}
while [ $# -gt 0 ]; do
kbdcontrol <${kbddev} -f "$1" "$2"
shift; shift

View File

@ -49,6 +49,10 @@ if [ -r /var/run/rc.suspend.tch ]; then
/bin/rm -f /var/run/rc.suspend.tch
fi
if [ -r /var/run/moused.pid ]; then
pkill -HUP -F /var/run/moused.pid
fi
# Turns on a power supply of a card in the slot inactivated.
# See also contrib/pccardq.c (only for PAO users).
# pccardq | awk -F '~' '$5 == "inactive" \

View File

@ -1638,7 +1638,7 @@ find_local_scripts_old () {
continue
zlist="$zlist $file"
done
for file in ${dir}/[^0-9]*.sh; do
for file in ${dir}/[!0-9]*.sh; do
grep '^# PROVIDE:' $file >/dev/null 2>&1 &&
continue
slist="$slist $file"

View File

@ -82,7 +82,7 @@ static const char rcsid[] =
#include <string.h>
#include <unistd.h>
u_short holes[256] = {
static u_short holes[256] = {
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@ -117,7 +117,7 @@ u_short holes[256] = {
0x202, 0x201, 0x082, 0x806, 0x822, 0x600, 0x282, 0x0
};
void printcard(char *);
static void printcard(char *);
/*
* i'th bit of w.
@ -148,7 +148,7 @@ main(int argc, char **argv)
#define COLUMNS 48
void
static void
printcard(char *str)
{
static char rowchars[] = " 123456789";

View File

@ -67,13 +67,13 @@ __FBSDID("$FreeBSD$");
* letter frequencies (taken from some unix(tm) documentation)
* (unix is a trademark of Bell Laboratories)
*/
double stdf[26] = {
static double stdf[26] = {
7.97, 1.35, 3.61, 4.78, 12.37, 2.01, 1.46, 4.49, 6.39, 0.04,
0.42, 3.81, 2.69, 5.92, 6.96, 2.91, 0.08, 6.63, 8.77, 9.68,
2.62, 0.81, 1.88, 0.23, 2.07, 0.06,
};
void printit(char *);
static void printit(char *);
int
main(int argc, char **argv)
@ -147,7 +147,7 @@ main(int argc, char **argv)
exit(0);
}
void
static void
printit(char *arg)
{
int ch, rot;

View File

@ -4942,25 +4942,37 @@ cats on the dinette table, etc.
"That stop him?"
"No, but it sure slowed him up."
%
Youth is not a time of life, it is a state of mind; it is a temper of
the will, a quality of the imagination, a vigor of the emotions, a predominance
of courage over timidity, of the appetite for adventure over love of ease.
Nobody grows old by merely living a number of years; people grow
old only by deserting their ideals. Years wrinkle the skin, but to give up
enthusiasm wrinkles the soul. Worry, doubt, self-distrust, fear, and despair
-- these are the long, long years that bow the head and turn the growing spirit
back to dust.
Whether seventy or sixteen, there is in every being's heart the love
of wonder, the sweet amazement at the stars and the starlike things and
thoughts, the undaunted challenge of events, the unfailing childlike appetite
for what next, and the joy and the game of life.
You are as young as your faith, as old as your doubt; as young as your
self-confidence, as old as your fear, as young as your hope, as old as your
despair.
So long as your heart receives messages of beauty, cheer, courage,
grandeur and power from the earth, from man, and from the Infinite, so long
you are young.
-- Samuel Ullman
Youth is not a time of life--it is a state of mind. It is not a
matter of red cheeks, red lips and supple knees. It is a temper of the
will; a quality of the imagination; a vigor of the emotions; it is a
freshness of the deep springs of life. Youth means a tempermental
predominance of courage over timidity, of the appetite for adventure
over a life of ease. This often exists in a man of fifty, more than in
a boy of twenty. Nobody grows old by merely living a number of years;
people grow old by deserting their ideals.
Years may wrinkle the skin, but to give up enthusiasm wrinkles
the soul. Worry, doubt, self-distrust, fear and despair--these are the
long, long years that bow the head and turn the growing spirit back to
dust.
Whether seventy or sixteen, there is in every beings heart a
love of wonder; the sweet amazement at the stars and starlike things and
thoughts; the undaunted challenge of events, the unfailing childlike
appetite for what comes next, and the joy in the game of life.
You are as young as your faith, as old as your doubt; as young
as your self-confidence, as old as your fear, as young as your hope, as
old as your despair.
In the central place of your heart there is a wireless station.
So long as it receives messages of beauty, hope, cheer, grandeur,
courage, and power from the earth, from men and from the Infinite--so
long are you young. When the wires are all down and the central places
of your heart are covered with the snows of pessimism and the ice of
cynicism, then are you grown old, indeed!
-- Samuel Ullman, "Youth" (1934), as published in
The Silver Treasury, Prose and Verse for Every Mood
%
" "
-- Charlie Chaplin

View File

@ -97,73 +97,71 @@ typedef struct fd {
struct fd *next, *prev;
} FILEDESC;
bool Found_one; /* did we find a match? */
bool Find_files = FALSE; /* just find a list of proper fortune files */
bool Fortunes_only = FALSE; /* check only "fortunes" files */
bool Wait = FALSE; /* wait desired after fortune */
bool Short_only = FALSE; /* short fortune desired */
bool Long_only = FALSE; /* long fortune desired */
bool Offend = FALSE; /* offensive fortunes only */
bool All_forts = FALSE; /* any fortune allowed */
bool Equal_probs = FALSE; /* scatter un-allocted prob equally */
bool Match = FALSE; /* dump fortunes matching a pattern */
static bool Found_one; /* did we find a match? */
static bool Find_files = FALSE; /* just find a list of proper fortune files */
static bool Fortunes_only = FALSE; /* check only "fortunes" files */
static bool Wait = FALSE; /* wait desired after fortune */
static bool Short_only = FALSE; /* short fortune desired */
static bool Long_only = FALSE; /* long fortune desired */
static bool Offend = FALSE; /* offensive fortunes only */
static bool All_forts = FALSE; /* any fortune allowed */
static bool Equal_probs = FALSE; /* scatter un-allocted prob equally */
static bool Match = FALSE; /* dump fortunes matching a pattern */
#ifdef DEBUG
bool Debug = FALSE; /* print debug messages */
static bool Debug = FALSE; /* print debug messages */
#endif
char *Fortbuf = NULL; /* fortune buffer for -m */
static char *Fortbuf = NULL; /* fortune buffer for -m */
int Fort_len = 0;
static int Fort_len = 0;
off_t Seekpts[2]; /* seek pointers to fortunes */
static off_t Seekpts[2]; /* seek pointers to fortunes */
FILEDESC *File_list = NULL, /* Head of file list */
static FILEDESC *File_list = NULL, /* Head of file list */
*File_tail = NULL; /* Tail of file list */
FILEDESC *Fortfile; /* Fortune file to use */
static FILEDESC *Fortfile; /* Fortune file to use */
STRFILE Noprob_tbl; /* sum of data for all no prob files */
static STRFILE Noprob_tbl; /* sum of data for all no prob files */
const char *Fortune_path;
char **Fortune_path_arr;
static const char *Fortune_path;
static char **Fortune_path_arr;
int add_dir(FILEDESC *);
int add_file(int, const char *, const char *, FILEDESC **, FILEDESC **,
FILEDESC *);
void all_forts(FILEDESC *, char *);
char *copy(const char *, u_int);
void display(FILEDESC *);
void do_free(void *);
void *do_malloc(u_int);
int form_file_list(char **, int);
int fortlen(void);
void get_fort(void);
void get_pos(FILEDESC *);
void get_tbl(FILEDESC *);
void getargs(int, char *[]);
void getpath(void);
void init_prob(void);
int is_dir(const char *);
int is_fortfile(const char *, char **, char **, int);
int is_off_name(const char *);
int max(int, int);
FILEDESC *
new_fp(void);
char *off_name(const char *);
void open_dat(FILEDESC *);
void open_fp(FILEDESC *);
FILEDESC *
pick_child(FILEDESC *);
void print_file_list(void);
void print_list(FILEDESC *, int);
void sum_noprobs(FILEDESC *);
void sum_tbl(STRFILE *, STRFILE *);
void usage(void);
void zero_tbl(STRFILE *);
static int add_dir(FILEDESC *);
static int add_file(int, const char *, const char *, FILEDESC **,
FILEDESC **, FILEDESC *);
static void all_forts(FILEDESC *, char *);
static char *copy(const char *, u_int);
static void display(FILEDESC *);
static void do_free(void *);
static void *do_malloc(u_int);
static int form_file_list(char **, int);
static int fortlen(void);
static void get_fort(void);
static void get_pos(FILEDESC *);
static void get_tbl(FILEDESC *);
static void getargs(int, char *[]);
static void getpath(void);
static void init_prob(void);
static int is_dir(const char *);
static int is_fortfile(const char *, char **, char **, int);
static int is_off_name(const char *);
static int max(int, int);
static FILEDESC *new_fp(void);
static char *off_name(const char *);
static void open_dat(FILEDESC *);
static void open_fp(FILEDESC *);
static FILEDESC *pick_child(FILEDESC *);
static void print_file_list(void);
static void print_list(FILEDESC *, int);
static void sum_noprobs(FILEDESC *);
static void sum_tbl(STRFILE *, STRFILE *);
static void usage(void);
static void zero_tbl(STRFILE *);
char *conv_pat(char *);
int find_matches(void);
void matches_in_list(FILEDESC *);
int maxlen_in_list(FILEDESC *);
static char *conv_pat(char *);
static int find_matches(void);
static void matches_in_list(FILEDESC *);
static int maxlen_in_list(FILEDESC *);
static regex_t Re_pat;
@ -219,7 +217,7 @@ main(int argc, char *argv[])
exit(0);
}
void
static void
display(FILEDESC *fp)
{
char *p;
@ -252,7 +250,7 @@ display(FILEDESC *fp)
* fortlen:
* Return the length of the fortune.
*/
int
static int
fortlen(void)
{
int nchar;
@ -276,7 +274,7 @@ fortlen(void)
/*
* This routine evaluates the arguments on the command line
*/
void
static void
getargs(int argc, char *argv[])
{
int ignore_case;
@ -362,7 +360,7 @@ getargs(int argc, char *argv[])
* form_file_list:
* Form the file list from the file specifications.
*/
int
static int
form_file_list(char **files, int file_cnt)
{
int i, percent;
@ -456,7 +454,7 @@ form_file_list(char **files, int file_cnt)
* add_file:
* Add a file to the file list.
*/
int
static int
add_file(int percent, const char *file, const char *dir, FILEDESC **head,
FILEDESC **tail, FILEDESC *parent)
{
@ -598,7 +596,7 @@ add_file(int percent, const char *file, const char *dir, FILEDESC **head,
* new_fp:
* Return a pointer to an initialized new FILEDESC.
*/
FILEDESC *
static FILEDESC *
new_fp(void)
{
FILEDESC *fp;
@ -624,7 +622,7 @@ new_fp(void)
* off_name:
* Return a pointer to the offensive version of a file of this name.
*/
char *
static char *
off_name(const char *file)
{
char *new;
@ -638,7 +636,7 @@ off_name(const char *file)
* is_off_name:
* Is the file an offensive-style name?
*/
int
static int
is_off_name(const char *file)
{
int len;
@ -653,7 +651,7 @@ is_off_name(const char *file)
* Modify a FILEDESC element to be the parent of two children if
* there are two children to be a parent of.
*/
void
static void
all_forts(FILEDESC *fp, char *offensive)
{
char *sp;
@ -701,7 +699,7 @@ all_forts(FILEDESC *fp, char *offensive)
* add_dir:
* Add the contents of an entire directory.
*/
int
static int
add_dir(FILEDESC *fp)
{
DIR *dir;
@ -740,7 +738,7 @@ add_dir(FILEDESC *fp)
* is_dir:
* Return TRUE if the file is a directory, FALSE otherwise.
*/
int
static int
is_dir(const char *file)
{
struct stat sbuf;
@ -759,7 +757,7 @@ is_dir(const char *file)
* suffixes, as contained in suflist[], are ruled out.
*/
/* ARGSUSED */
int
static int
is_fortfile(const char *file, char **datp, char **posp, int check_for_offend)
{
int i;
@ -840,7 +838,7 @@ is_fortfile(const char *file, char **datp, char **posp, int check_for_offend)
* copy:
* Return a malloc()'ed copy of the string
*/
char *
static char *
copy(const char *str, unsigned int len)
{
char *new, *sp;
@ -858,7 +856,7 @@ copy(const char *str, unsigned int len)
* do_malloc:
* Do a malloc, checking for NULL return.
*/
void *
static void *
do_malloc(unsigned int size)
{
void *new;
@ -875,7 +873,7 @@ do_malloc(unsigned int size)
* do_free:
* Free malloc'ed space, if any.
*/
void
static void
do_free(void *ptr)
{
if (ptr != NULL)
@ -886,7 +884,7 @@ do_free(void *ptr)
* init_prob:
* Initialize the fortune probabilities.
*/
void
static void
init_prob(void)
{
FILEDESC *fp, *last = NULL;
@ -955,7 +953,7 @@ init_prob(void)
* get_fort:
* Get the fortune data file's seek pointer for the next fortune.
*/
void
static void
get_fort(void)
{
FILEDESC *fp;
@ -1018,7 +1016,7 @@ get_fort(void)
* pick_child
* Pick a child from a chosen parent.
*/
FILEDESC *
static FILEDESC *
pick_child(FILEDESC *parent)
{
FILEDESC *fp;
@ -1054,7 +1052,7 @@ pick_child(FILEDESC *parent)
* sum_noprobs:
* Sum up all the noprob probabilities, starting with fp.
*/
void
static void
sum_noprobs(FILEDESC *fp)
{
static bool did_noprobs = FALSE;
@ -1070,7 +1068,7 @@ sum_noprobs(FILEDESC *fp)
did_noprobs = TRUE;
}
int
static int
max(int i, int j)
{
return (i >= j ? i : j);
@ -1080,7 +1078,7 @@ max(int i, int j)
* open_fp:
* Assocatiate a FILE * with the given FILEDESC.
*/
void
static void
open_fp(FILEDESC *fp)
{
if (fp->inf == NULL && (fp->inf = fdopen(fp->fd, "r")) == NULL) {
@ -1093,7 +1091,7 @@ open_fp(FILEDESC *fp)
* open_dat:
* Open up the dat file if we need to.
*/
void
static void
open_dat(FILEDESC *fp)
{
if (fp->datfd < 0 && (fp->datfd = open(fp->datfile, O_RDONLY)) < 0) {
@ -1107,7 +1105,7 @@ open_dat(FILEDESC *fp)
* Get the position from the pos file, if there is one. If not,
* return a random number.
*/
void
static void
get_pos(FILEDESC *fp)
{
#ifdef OK_TO_WRITE_DISK
@ -1137,7 +1135,7 @@ get_pos(FILEDESC *fp)
* get_tbl:
* Get the tbl data file the datfile.
*/
void
static void
get_tbl(FILEDESC *fp)
{
int fd;
@ -1176,7 +1174,7 @@ get_tbl(FILEDESC *fp)
* zero_tbl:
* Zero out the fields we care about in a tbl structure.
*/
void
static void
zero_tbl(STRFILE *tp)
{
tp->str_numstr = 0;
@ -1188,7 +1186,7 @@ zero_tbl(STRFILE *tp)
* sum_tbl:
* Merge the tbl data of t2 into t1.
*/
void
static void
sum_tbl(STRFILE *t1, STRFILE *t2)
{
t1->str_numstr += t2->str_numstr;
@ -1204,7 +1202,7 @@ sum_tbl(STRFILE *t1, STRFILE *t2)
* print_file_list:
* Print out the file list
*/
void
static void
print_file_list(void)
{
print_list(File_list, 0);
@ -1214,7 +1212,7 @@ print_file_list(void)
* print_list:
* Print out the actual list, recursively.
*/
void
static void
print_list(FILEDESC *list, int lev)
{
while (list != NULL) {
@ -1237,7 +1235,7 @@ print_list(FILEDESC *list, int lev)
* conv_pat:
* Convert the pattern to an ignore-case equivalent.
*/
char *
static char *
conv_pat(char *orig)
{
char *sp;
@ -1280,7 +1278,7 @@ conv_pat(char *orig)
* find_matches:
* Find all the fortunes which match the pattern we've been given.
*/
int
static int
find_matches(void)
{
Fort_len = maxlen_in_list(File_list);
@ -1298,7 +1296,7 @@ find_matches(void)
* maxlen_in_list
* Return the maximum fortune len in the file list.
*/
int
static int
maxlen_in_list(FILEDESC *list)
{
FILEDESC *fp;
@ -1324,7 +1322,7 @@ maxlen_in_list(FILEDESC *list)
* matches_in_list
* Print out the matches from the files in the list.
*/
void
static void
matches_in_list(FILEDESC *list)
{
char *sp, *p;
@ -1375,7 +1373,7 @@ matches_in_list(FILEDESC *list)
}
}
void
static void
usage(void)
{
(void) fprintf(stderr, "fortune [-a");
@ -1394,7 +1392,7 @@ usage(void)
* if not set, use the compiled in FORTDIR.
*/
void
static void
getpath(void)
{
int nstr, foundenv;

View File

@ -67,13 +67,13 @@ __FBSDID("$FreeBSD$");
#include "strfile.h"
char *Infile, /* name of input file */
Datafile[MAXPATHLEN], /* name of data file */
Delimch; /* delimiter character */
static char *Infile, /* name of input file */
Datafile[MAXPATHLEN], /* name of data file */
Delimch; /* delimiter character */
FILE *Inf, *Dataf;
static FILE *Inf, *Dataf;
void order_unstr(STRFILE *);
static void order_unstr(STRFILE *);
/* ARGSUSED */
int
@ -107,7 +107,7 @@ main(int argc, char *argv[])
exit(0);
}
void
static void
order_unstr(STRFILE *tbl)
{
uint32_t i;

View File

@ -26,29 +26,30 @@
#define XLENGTH 58
#define YDEPTH 7
struct timespec now;
struct tm *tm;
static struct timespec now;
static struct tm *tm;
short disp[11] = {
static short disp[11] = {
075557, 011111, 071747, 071717, 055711,
074717, 074757, 071111, 075757, 075717, 002020
};
long old[6], next[6], new[6], mask;
static long old[6], next[6], new[6], mask;
volatile sig_atomic_t sigtermed;
static volatile sig_atomic_t sigtermed;
int hascolor = 0;
static int hascolor = 0;
void set(int, int);
void standt(int);
void movto(int, int);
void sighndl(int);
void usage(void);
static void set(int, int);
static void standt(int);
static void movto(int, int);
static void sighndl(int);
static void usage(void);
void
static void
sighndl(int signo)
{
sigtermed=signo;
sigtermed = signo;
}
int
@ -225,7 +226,7 @@ main(int argc, char *argv[])
return(0);
}
void
static void
set(int t, int n)
{
int i, m;
@ -239,7 +240,7 @@ set(int t, int n)
mask |= m;
}
void
static void
standt(int on)
{
if (on) {
@ -257,13 +258,13 @@ standt(int on)
}
}
void
static void
movto(int line, int col)
{
move(line, col);
}
void
static void
usage(void)
{

View File

@ -261,33 +261,33 @@ static const struct morsetab koi8rtab[] = {
{'\0', ""}
};
void show(const char *), play(const char *), morse(char);
void ttyout(const char *);
void sighandler(int);
static void show(const char *), play(const char *), morse(char);
static void ttyout(const char *);
static void sighandler(int);
#define GETOPTOPTS "c:d:ef:lsw:"
#define USAGE \
"usage: morse [-els] [-d device] [-w speed] [-c speed] [-f frequency] [string ...]\n"
static int pflag, lflag, sflag, eflag;
static int wpm = 20; /* effective words per minute */
static int cpm; /* effective words per minute between
static int pflag, lflag, sflag, eflag;
static int wpm = 20; /* effective words per minute */
static int cpm; /* effective words per minute between
* characters */
#define FREQUENCY 600
static int freq = FREQUENCY;
static int freq = FREQUENCY;
static char *device; /* for tty-controlled generator */
#define DASH_LEN 3
#define CHAR_SPACE 3
#define WORD_SPACE (7 - CHAR_SPACE - 1)
static float dot_clock;
static float cdot_clock;
int spkr, line;
struct termios otty, ntty;
int olflags;
static float dot_clock;
static float cdot_clock;
static int spkr, line;
static struct termios otty, ntty;
static int olflags;
#ifdef SPEAKER
tone_t sound;
static tone_t sound;
#undef GETOPTOPTS
#define GETOPTOPTS "c:d:ef:lpsw:"
#undef USAGE
@ -439,7 +439,7 @@ main(int argc, char **argv)
exit(0);
}
void
static void
morse(char c)
{
const struct morsetab *m;
@ -473,7 +473,7 @@ morse(char c)
}
}
void
static void
show(const char *s)
{
if (lflag) {
@ -488,7 +488,7 @@ show(const char *s)
}
}
void
static void
play(const char *s)
{
#ifdef SPEAKER
@ -530,7 +530,7 @@ play(const char *s)
#endif
}
void
static void
ttyout(const char *s)
{
const char *c;
@ -572,7 +572,7 @@ ttyout(const char *s)
usleep(duration);
}
void
static void
sighandler(int signo)
{

View File

@ -74,14 +74,13 @@ static const char *name1[] = {
"novemdecillion", "vigintillion",
};
void convert(char *);
int number(char *, int);
void pfract(int);
void toobig(void);
int unit(int, char *);
void usage(void);
static void convert(char *);
static int number(char *, int);
static void pfract(int);
static int unit(int, char *);
static void usage(void);
int lflag;
static int lflag;
int
main(int argc, char *argv[])
@ -120,7 +119,7 @@ main(int argc, char *argv[])
exit(0);
}
void
static void
convert(char *line)
{
int flen, len, rval;
@ -188,7 +187,7 @@ badnum: errx(1, "illegal number: %s", line);
(void)printf("\n");
}
int
static int
unit(int len, char *p)
{
int off, rval;
@ -222,7 +221,7 @@ unit(int len, char *p)
return (rval);
}
int
static int
number(char *p, int len)
{
int val, rval;
@ -260,7 +259,7 @@ number(char *p, int len)
return (rval);
}
void
static void
pfract(int len)
{
static char const * const pref[] = { "", "ten-", "hundred-" };
@ -278,7 +277,7 @@ pfract(int len)
}
}
void
static void
usage(void)
{
(void)fprintf(stderr, "usage: number [-l] [# ...]\n");

View File

@ -671,7 +671,7 @@
/* #undef VERSION */
/* Define if builtin atomic operations are supported on this host. */
#if defined(__amd64__) || defined(__i386__)
#if defined(__amd64__) || (defined(__i386__) && !defined(__tune_i386__))
#define _GLIBCXX_ATOMIC_BUILTINS 1
#endif

View File

@ -1,6 +1,6 @@
# $FreeBSD$
NATIVE_EMULATION= elf32ppc
NATIVE_EMULATION= elf32ppc_fbsd
SRCS+= e${NATIVE_EMULATION}.c
CLEANFILES+= e${NATIVE_EMULATION}.c

View File

@ -1,6 +1,6 @@
# $FreeBSD$
NATIVE_EMULATION= elf64ppc
NATIVE_EMULATION= elf64ppc_fbsd
SRCS+= e${NATIVE_EMULATION}.c
CLEANFILES+= e${NATIVE_EMULATION}.c
@ -11,7 +11,7 @@ e${NATIVE_EMULATION}.c: emulparams/${NATIVE_EMULATION}.sh emultempl/elf32.em \
${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
${NATIVE_EMULATION} "" no ${NATIVE_EMULATION} ${TARGET_TUPLE}
PPC32_EMULATION= elf32ppc
PPC32_EMULATION= elf32ppc_fbsd
_ppc32_path= \"${TOOLS_PREFIX}/usr/lib32\"
EMS+= ${PPC32_EMULATION}
.for ext in ${ELF_SCR_EXT}

View File

@ -24,7 +24,7 @@ INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
strings.h sysexits.h tar.h termios.h tgmath.h \
time.h timeconv.h timers.h ttyent.h \
ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h vis.h \
wchar.h wctype.h wordexp.h
wchar.h wctype.h wordexp.h xlocale.h _xlocale_ctype.h
MHDRS= float.h floatingpoint.h stdarg.h

162
include/_xlocale_ctype.h Normal file
View File

@ -0,0 +1,162 @@
/*-
* Copyright (c) 2011 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by David Chisnall under sponsorship from
* the FreeBSD Foundation.
*
* 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$
*/
#ifndef _XLOCALE_H_
#error This header should only be included by <xlocale.h>, never directly.
#endif
#ifndef _XLOCALE_CTYPE_H_
__BEGIN_DECLS
unsigned long ___runetype_l(__ct_rune_t, locale_t) __pure;
__ct_rune_t ___tolower_l(__ct_rune_t, locale_t) __pure;
__ct_rune_t ___toupper_l(__ct_rune_t, locale_t) __pure;
_RuneLocale *__runes_for_locale(locale_t, int*);
__END_DECLS
#endif
#ifndef _XLOCALE_INLINE
#if __GNUC__ && !__GNUC_STDC_INLINE__
#define _XLOCALE_INLINE extern inline
#else
#define _XLOCALE_INLINE inline
#endif
#endif
#ifdef XLOCALE_WCTYPES
static __inline int
__maskrune_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
{
int mb_sb_limit;
_RuneLocale *runes = __runes_for_locale(locale, &mb_sb_limit);
return (_c < 0 || _c >= _CACHED_RUNES) ? ___runetype_l(_c, locale) :
runes->__runetype[_c] & _f;
}
static __inline int
__istype_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
{
return (!!__maskrune_l(_c, _f, locale));
}
#define XLOCALE_ISCTYPE(fname, cat) \
_XLOCALE_INLINE int isw##fname##_l(int c, locale_t l)\
{ return __istype_l(c, cat, l); }
#else
static __inline int
__sbmaskrune_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
{
int mb_sb_limit;
_RuneLocale *runes = __runes_for_locale(locale, &mb_sb_limit);
return (_c < 0 || _c >= mb_sb_limit) ? 0 :
runes->__runetype[_c] & _f;
}
static __inline int
__sbistype_l(__ct_rune_t _c, unsigned long _f, locale_t locale)
{
return (!!__sbmaskrune_l(_c, _f, locale));
}
#define XLOCALE_ISCTYPE(fname, cat) \
_XLOCALE_INLINE int is##fname##_l(int c, locale_t l)\
{ return __sbistype_l(c, cat, l); }
#endif
XLOCALE_ISCTYPE(alnum, _CTYPE_A|_CTYPE_D)
XLOCALE_ISCTYPE(alpha, _CTYPE_A)
XLOCALE_ISCTYPE(blank, _CTYPE_B)
XLOCALE_ISCTYPE(cntrl, _CTYPE_C)
XLOCALE_ISCTYPE(digit, _CTYPE_D)
XLOCALE_ISCTYPE(graph, _CTYPE_G)
XLOCALE_ISCTYPE(hexnumber, _CTYPE_X)
XLOCALE_ISCTYPE(ideogram, _CTYPE_I)
XLOCALE_ISCTYPE(lower, _CTYPE_L)
XLOCALE_ISCTYPE(number, _CTYPE_D)
XLOCALE_ISCTYPE(phonogram, _CTYPE_Q)
XLOCALE_ISCTYPE(print, _CTYPE_R)
XLOCALE_ISCTYPE(punct, _CTYPE_P)
XLOCALE_ISCTYPE(rune, 0xFFFFFF00L)
XLOCALE_ISCTYPE(space, _CTYPE_S)
XLOCALE_ISCTYPE(special, _CTYPE_T)
XLOCALE_ISCTYPE(upper, _CTYPE_U)
XLOCALE_ISCTYPE(xdigit, _CTYPE_X)
#undef XLOCALE_ISCTYPE
#ifdef XLOCALE_WCTYPES
_XLOCALE_INLINE int towlower_l(int c, locale_t locale)
{
int mb_sb_limit;
_RuneLocale *runes = __runes_for_locale(locale, &mb_sb_limit);
return (c < 0 || c >= _CACHED_RUNES) ? ___tolower_l(c, locale) :
runes->__maplower[c];
}
_XLOCALE_INLINE int towupper_l(int c, locale_t locale)
{
int mb_sb_limit;
_RuneLocale *runes = __runes_for_locale(locale, &mb_sb_limit);
return (c < 0 || c >= _CACHED_RUNES) ? ___toupper_l(c, locale) :
runes->__mapupper[c];
}
_XLOCALE_INLINE int
__wcwidth_l(__ct_rune_t _c, locale_t locale)
{
unsigned int _x;
if (_c == 0)
return (0);
_x = (unsigned int)__maskrune_l(_c, _CTYPE_SWM|_CTYPE_R, locale);
if ((_x & _CTYPE_SWM) != 0)
return ((_x & _CTYPE_SWM) >> _CTYPE_SWS);
return ((_x & _CTYPE_R) != 0 ? 1 : -1);
}
int iswctype_l(wint_t wc, wctype_t charclass, locale_t locale);
wctype_t wctype_l(const char *property, locale_t locale);
wint_t towctrans_l(wint_t wc, wctrans_t desc, locale_t locale);
wint_t nextwctype_l(wint_t wc, wctype_t wct, locale_t locale);
wctrans_t wctrans_l(const char *charclass, locale_t locale);
#undef XLOCALE_WCTYPES
#else
_XLOCALE_INLINE int digittoint_l(int c, locale_t locale)
{ return __sbmaskrune_l((c), 0xFF, locale); }
_XLOCALE_INLINE int tolower_l(int c, locale_t locale)
{
int mb_sb_limit;
_RuneLocale *runes = __runes_for_locale(locale, &mb_sb_limit);
return (c < 0 || c >= mb_sb_limit) ? c :
runes->__maplower[c];
}
_XLOCALE_INLINE int toupper_l(int c, locale_t locale)
{
int mb_sb_limit;
_RuneLocale *runes = __runes_for_locale(locale, &mb_sb_limit);
return (c < 0 || c >= mb_sb_limit) ? c :
runes->__mapupper[c];
}
#endif

View File

@ -80,6 +80,7 @@ int isspecial(int);
#endif
__END_DECLS
#ifndef __cplusplus
#define isalnum(c) __sbistype((c), _CTYPE_A|_CTYPE_D)
#define isalpha(c) __sbistype((c), _CTYPE_A)
#define iscntrl(c) __sbistype((c), _CTYPE_C)
@ -93,6 +94,7 @@ __END_DECLS
#define isxdigit(c) __isctype((c), _CTYPE_X) /* ANSI -- locale independent */
#define tolower(c) __sbtolower(c)
#define toupper(c) __sbtoupper(c)
#endif /* !__cplusplus */
#if __XSI_VISIBLE
/*
@ -112,7 +114,7 @@ __END_DECLS
#define toascii(c) ((c) & 0x7F)
#endif
#if __ISO_C_VISIBLE >= 1999
#if __ISO_C_VISIBLE >= 1999 && !defined(__cplusplus)
#define isblank(c) __sbistype((c), _CTYPE_B)
#endif

View File

@ -79,4 +79,52 @@ struct lconv *localeconv(void);
char *setlocale(int, const char *);
__END_DECLS
#if __POSIX_VISIBLE >= 200809
#define LC_COLLATE_MASK (1<<0)
#define LC_CTYPE_MASK (1<<1)
#define LC_MESSAGES_MASK (1<<2)
#define LC_MONETARY_MASK (1<<3)
#define LC_NUMERIC_MASK (1<<4)
#define LC_TIME_MASK (1<<5)
#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \
LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
#define LC_GLOBAL_LOCALE ((locale_t)-1)
__BEGIN_DECLS
typedef struct _xlocale *locale_t;
/**
* Creates a new locale.
*/
locale_t newlocale(int mask, const char *locale, locale_t base);
/**
* Returns an identical duplicate of the passed locale. The returned locale
* must be freed with freelocale(). The returned locale will share components
* with the original.
*/
locale_t duplocale(locale_t base);
/*
* Free a locale_t. This is quite a poorly named function. It actually
* disclaims a reference to a locale_t, rather than freeing it.
*/
int freelocale(locale_t loc);
/*
* Returns the name of the locale for a particular component of a locale_t.
*/
const char *querylocale(int mask, locale_t loc);
/*
* Installs the specified locale_t as this thread's locale.
*/
locale_t uselocale(locale_t loc);
__END_DECLS
#endif /* __POSIX_VISIBLE >= 200809 */
#endif /* _LOCALE_H_ */

View File

@ -83,8 +83,14 @@ typedef struct {
} _RuneLocale;
#define _RUNE_MAGIC_1 "RuneMagi" /* Indicates version 0 of RuneLocale */
extern _RuneLocale _DefaultRuneLocale;
__BEGIN_DECLS
extern const _RuneLocale _DefaultRuneLocale;
__attribute__((deprecated))
extern _RuneLocale *_CurrentRuneLocale;
/* TODO: This is called quite a lot, so we should use a __thread variable when
* it's available. */
extern _RuneLocale *__getCurrentRuneLocale(void);
#define _CurrentRuneLocale (__getCurrentRuneLocale())
__END_DECLS
#endif /* !_RUNETYPE_H_ */

View File

@ -107,7 +107,7 @@ struct __sbuf {
* inline functions. To preserve ABI compat, these members must not
* be disturbed. These members are marked below with (*).
*/
typedef struct __sFILE {
struct __sFILE {
unsigned char *_p; /* (*) current position in (some) buffer */
int _r; /* (*) read space left for getc() */
int _w; /* (*) write space left for putc() */
@ -144,8 +144,11 @@ typedef struct __sFILE {
int _fl_count; /* recursive lock count */
int _orientation; /* orientation for fwide() */
__mbstate_t _mbstate; /* multibyte conversion state */
} FILE;
};
#ifndef _STDFILE_DECLARED
#define _STDFILE_DECLARED
typedef struct __sFILE FILE;
#endif
#ifndef _STDSTREAM_DECLARED
__BEGIN_DECLS
extern FILE *__stdinp;
@ -467,6 +470,7 @@ static __inline int __sputc(int _c, FILE *_p) {
__swbuf((int)(c), p) : \
(*(p)->_p = (c), (int)*(p)->_p++))
#endif
#ifndef __cplusplus
#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
#define __sferror(p) (((p)->_flags & __SERR) != 0)
@ -506,6 +510,7 @@ extern int __isthreaded;
#define getchar_unlocked() getc_unlocked(stdin)
#define putchar_unlocked(x) putc_unlocked(x, stdout)
#endif
#endif /* __cplusplus */
__END_DECLS
#endif /* !_STDIO_H_ */

View File

@ -71,10 +71,11 @@ typedef struct {
#define RAND_MAX 0x7fffffff
extern int __mb_cur_max;
#define MB_CUR_MAX __mb_cur_max
__BEGIN_DECLS
extern int __mb_cur_max;
extern int ___mb_cur_max(void);
#define MB_CUR_MAX (___mb_cur_max())
void abort(void) __dead2;
int abs(int) __pure2;
int atexit(void (*)(void));

View File

@ -97,20 +97,23 @@ typedef __wint_t wint_t;
#define WEOF ((wint_t)-1)
#endif
struct __sFILE;
#ifndef _STDFILE_DECLARED
#define _STDFILE_DECLARED
typedef struct __sFILE FILE;
#endif
struct tm;
__BEGIN_DECLS
wint_t btowc(int);
wint_t fgetwc(struct __sFILE *);
wint_t fgetwc(FILE *);
wchar_t *
fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict);
wint_t fputwc(wchar_t, struct __sFILE *);
int fputws(const wchar_t * __restrict, struct __sFILE * __restrict);
int fwide(struct __sFILE *, int);
int fwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
int fwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
wint_t getwc(struct __sFILE *);
fgetws(wchar_t * __restrict, int, FILE * __restrict);
wint_t fputwc(wchar_t, FILE *);
int fputws(const wchar_t * __restrict, FILE * __restrict);
int fwide(FILE *, int);
int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
wint_t getwc(FILE *);
wint_t getwchar(void);
size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
@ -118,13 +121,13 @@ size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
int mbsinit(const mbstate_t *);
size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
mbstate_t * __restrict);
wint_t putwc(wchar_t, struct __sFILE *);
wint_t putwc(wchar_t, FILE *);
wint_t putwchar(wchar_t);
int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
...);
int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
wint_t ungetwc(wint_t, struct __sFILE *);
int vfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict,
wint_t ungetwc(wint_t, FILE *);
int vfwprintf(FILE * __restrict, const wchar_t * __restrict,
__va_list);
int vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
__va_list);
@ -167,9 +170,9 @@ int wprintf(const wchar_t * __restrict, ...);
int wscanf(const wchar_t * __restrict, ...);
#ifndef _STDSTREAM_DECLARED
extern struct __sFILE *__stdinp;
extern struct __sFILE *__stdoutp;
extern struct __sFILE *__stderrp;
extern FILE *__stdinp;
extern FILE *__stdoutp;
extern FILE *__stderrp;
#define _STDSTREAM_DECLARED
#endif
@ -179,7 +182,7 @@ extern struct __sFILE *__stderrp;
#define putwchar(wc) fputwc(wc, __stdoutp)
#if __ISO_C_VISIBLE >= 1999
int vfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict,
int vfwscanf(FILE * __restrict, const wchar_t * __restrict,
__va_list);
int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
__va_list);
@ -217,7 +220,7 @@ size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
#endif
#if __BSD_VISIBLE
wchar_t *fgetwln(struct __sFILE * __restrict, size_t * __restrict);
wchar_t *fgetwln(FILE * __restrict, size_t * __restrict);
size_t wcslcat(wchar_t *, const wchar_t *, size_t);
size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
#endif

View File

@ -89,6 +89,7 @@ wint_t nextwctype(wint_t, wctype_t);
#endif
__END_DECLS
#ifndef __cplusplus
#define iswalnum(wc) __istype((wc), _CTYPE_A|_CTYPE_D)
#define iswalpha(wc) __istype((wc), _CTYPE_A)
#define iswblank(wc) __istype((wc), _CTYPE_B)
@ -113,6 +114,7 @@ __END_DECLS
#define iswphonogram(wc) __istype((wc), _CTYPE_Q)
#define iswrune(wc) __istype((wc), 0xFFFFFF00L)
#define iswspecial(wc) __istype((wc), _CTYPE_T)
#endif
#endif /* __BSD_VISIBLE */
#endif /* __cplusplus */
#endif /* _WCTYPE_H_ */

258
include/xlocale.h Normal file
View File

@ -0,0 +1,258 @@
/*-
* Copyright (c) 2011 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by David Chisnall under sponsorship from
* the FreeBSD Foundation.
*
* 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$
*/
#ifndef _XLOCALE_H_
#define _XLOCALE_H_
#include <locale.h>
__BEGIN_DECLS
/*
* Extended locale versions of the locale-aware functions from string.h.
*
* Include <string.h> before <xlocale.h> to expose these.
*/
#ifdef _STRING_H_
int strcoll_l(const char *, const char *, locale_t);
size_t strxfrm_l(char *, const char *, size_t, locale_t);
int strcasecmp_l(const char *, const char *, locale_t);
char *strcasestr_l(const char *, const char *, locale_t);
int strncasecmp_l(const char *, const char *, size_t, locale_t);
#endif
/*
* Extended locale versions of the locale-aware functions from inttypes.h.
*
* Include <inttypes.h> before <xlocale.h> to expose these.
*/
#ifdef _INTTYPES_H_
intmax_t
strtoimax_l(const char * __restrict, char ** __restrict, int, locale_t);
uintmax_t
strtoumax_l(const char * __restrict, char ** __restrict, int, locale_t);
intmax_t
wcstoimax_l(const wchar_t * __restrict, wchar_t ** __restrict, int , locale_t);
uintmax_t
wcstoumax_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
#endif
/*
* Extended locale versions of the locale-aware functions from monetary.h.
*
* Include <monetary.h> before <xlocale.h> to expose these.
*/
#ifdef _MONETARY_H_
ssize_t strfmon_l(char *, size_t, locale_t, const char *, ...)
# if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7
__attribute__((__format__ (__strfmon__, 4, 5)))
# endif
;
#endif
/*
* Extended locale versions of the locale-aware functions from stdlib.h.
*
* Include <stdlib.h> before <xlocale.h> to expose these.
*/
#ifdef _STDLIB_H_
double atof_l(const char *, locale_t);
int atoi_l(const char *, locale_t);
long atol_l(const char *, locale_t);
long long atoll_l(const char *, locale_t);
int mblen_l(const char *, size_t, locale_t);
size_t
mbstowcs_l(wchar_t * __restrict, const char * __restrict, size_t, locale_t);
int
mbtowc_l(wchar_t * __restrict, const char * __restrict, size_t, locale_t);
double strtod_l(const char *, char **, locale_t);
float strtof_l(const char *, char **, locale_t);
long strtol_l(const char *, char **, int, locale_t);
long double strtold_l(const char *, char **, locale_t);
long long strtoll_l(const char *, char **, int, locale_t);
unsigned long strtoul_l(const char *, char **, int, locale_t);
unsigned long long strtoull_l(const char *, char **, int, locale_t);
size_t
wcstombs_l(char * __restrict, const wchar_t * __restrict, size_t, locale_t);
int wctomb_l(char *, wchar_t, locale_t);
int ___mb_cur_max_l(locale_t);
#define MB_CUR_MAX_L(x) (___mb_cur_max_l(x))
#endif
/*
* Extended locale versions of the locale-aware functions from time.h.
*
* Include <time.h> before <xlocale.h> to expose these.
*/
#ifdef _TIME_H_
size_t
strftime_l(char * __restrict, size_t, const char * __restrict, const
struct tm * __restrict, locale_t)
# if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7
__attribute__((__format__ (__strftime__, 3, 0)))
# endif
;
char *
strptime_l(const char * __restrict, const char * __restrict,
struct tm * __restrict, locale_t);
#endif
#ifdef _LANGINFO_H_
char *nl_langinfo_l(nl_item, locale_t);
#endif
#ifdef _CTYPE_H_
#include <_xlocale_ctype.h>
#endif
#ifdef _WCTYPE_H_
#define XLOCALE_WCTYPES 1
#include <_xlocale_ctype.h>
#endif
#ifdef _STDIO_H_
int fprintf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
__printflike(3, 4);
int fscanf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
__scanflike(3, 4);
int printf_l(locale_t, const char * __restrict, ...) __printflike(2, 3);
int scanf_l(locale_t, const char * __restrict, ...) __scanflike(2, 3);
int sprintf_l(char * __restrict, locale_t, const char * __restrict, ...)
__printflike(3, 4);
int sscanf_l(const char * __restrict, locale_t, const char * __restrict, ...)
__scanflike(3, 4);
int vfprintf_l(FILE * __restrict, locale_t, const char * __restrict, __va_list)
__printflike(3, 0);
int vprintf_l(locale_t, const char * __restrict, __va_list) __printflike(2, 0);
int vsprintf_l(char * __restrict, locale_t, const char * __restrict, __va_list)
__printflike(3, 0);
int snprintf_l(char * __restrict, size_t, locale_t, const char * __restrict,
...) __printflike(4, 5);
int vfscanf_l(FILE * __restrict, locale_t, const char * __restrict, __va_list)
__scanflike(3, 0);
int vscanf_l(locale_t, const char * __restrict, __va_list) __scanflike(2, 0);
int vsnprintf_l(char * __restrict, size_t, locale_t, const char * __restrict,
va_list) __printflike(4, 0);
int vsscanf_l(const char * __restrict, locale_t, const char * __restrict,
va_list) __scanflike(3, 0);
int dprintf_l(int, locale_t, const char * __restrict, ...) __printflike(3, 4);
int vdprintf_l(int, locale_t, const char * __restrict, __va_list)
__printflike(3, 0);
int asprintf_l(char **, locale_t, const char *, ...) __printflike(3, 4);
int vasprintf_l(char **, locale_t, const char *, __va_list) __printflike(3, 0);
#endif
#ifdef _WCHAR_H_
wint_t btowc_l(int, locale_t);
wint_t fgetwc_l(FILE *, locale_t);
wchar_t *
fgetws_l(wchar_t * __restrict, int, FILE * __restrict, locale_t);
wint_t fputwc_l(wchar_t, FILE *, locale_t);
int
fputws_l(const wchar_t * __restrict, FILE * __restrict, locale_t);
int
fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
...);
int
fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
wint_t getwc_l(FILE *, locale_t);
wint_t getwchar_l(locale_t);
size_t
mbrlen_l(const char * __restrict, size_t, mbstate_t * __restrict, locale_t);
size_t
mbrtowc_l(wchar_t * __restrict, const char * __restrict, size_t,
mbstate_t * __restrict, locale_t);
int mbsinit_l(const mbstate_t *, locale_t);
size_t
mbsrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t,
mbstate_t * __restrict, locale_t);
wint_t putwc_l(wchar_t, FILE *, locale_t);
wint_t putwchar_l(wchar_t, locale_t);
int
swprintf_l(wchar_t * __restrict, size_t n, locale_t,
const wchar_t * __restrict, ...);
int
swscanf_l(const wchar_t * __restrict, locale_t, const wchar_t * __restrict,
...);
wint_t ungetwc_l(wint_t, FILE *, locale_t);
int
vfwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
__va_list);
int
vswprintf_l(wchar_t * __restrict, size_t n, locale_t,
const wchar_t * __restrict, __va_list);
int vwprintf_l(locale_t, const wchar_t * __restrict, __va_list);
size_t
wcrtomb_l(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t);
int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
size_t
wcsftime_l(wchar_t * __restrict, size_t, const wchar_t * __restrict,
const struct tm * __restrict, locale_t);
size_t
wcsrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t,
mbstate_t * __restrict, locale_t);
double wcstod_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
long
wcstol_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
unsigned long
wcstoul_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
int wcswidth_l(const wchar_t *, size_t, locale_t);
size_t
wcsxfrm_l(wchar_t * __restrict, const wchar_t * __restrict, size_t, locale_t);
int wctob_l(wint_t, locale_t);
int wcwidth_l(wchar_t, locale_t);
int wprintf_l(locale_t, const wchar_t * __restrict, ...);
int wscanf_l(locale_t, const wchar_t * __restrict, ...);
int
vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
__va_list);
int vswscanf_l(const wchar_t * __restrict, locale_t,
const wchar_t *__restrict, __va_list);
int vwscanf_l(locale_t, const wchar_t * __restrict, __va_list);
float wcstof_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
long double
wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
long long
wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
unsigned long long
wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t);
size_t
mbsnrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t, size_t,
mbstate_t * __restrict, locale_t);
int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
size_t
wcsnrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t, size_t,
mbstate_t * __restrict, locale_t);
#endif
struct lconv *localeconv_l(locale_t);
__END_DECLS
#endif

View File

@ -9,7 +9,7 @@ CFLAGS+=-I${LLVM_SRCS}/include -I${CLANG_SRCS}/include \
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS #-DNDEBUG
# Correct for gcc miscompilation when compiling on PPC with -O2
.if ${MACHINE_ARCH} == "powerpc"
.if ${MACHINE_CPUARCH} == "powerpc"
CFLAGS+= -O1
.endif

View File

@ -552,7 +552,7 @@
/* #undef LLVM_ETCDIR */
/* Has gcc/MSVC atomic intrinsics */
#define LLVM_HAS_ATOMICS 1
#define LLVM_HAS_ATOMICS 0
/* Host triple we were built on */
/* #undef LLVM_HOSTTRIPLE */

View File

@ -34,7 +34,7 @@
/* #undef LLVM_ETCDIR */
/* Has gcc/MSVC atomic intrinsics */
#define LLVM_HAS_ATOMICS 1
#define LLVM_HAS_ATOMICS 0
/* Host triple we were built on */
/* #undef LLVM_HOSTTRIPLE */

View File

@ -54,6 +54,7 @@ ENTRY(setjmp)
movq $1,%rdi /* SIG_BLOCK */
movq $0,%rsi /* (sigset_t*)set */
leaq 72(%rcx),%rdx /* 9,10; (sigset_t*)oset */
/* stack is 16-byte aligned */
call PIC_PLT(CNAME(_sigprocmask))
popq %rdi
movq %rdi,%rcx
@ -81,7 +82,9 @@ ENTRY(__longjmp)
movq $3,%rdi /* SIG_SETMASK */
leaq 72(%rdx),%rsi /* (sigset_t*)set */
movq $0,%rdx /* (sigset_t*)oset */
subq $0x8,%rsp /* make the stack 16-byte aligned */
call PIC_PLT(CNAME(_sigprocmask))
addq $0x8,%rsp
popq %rsi
popq %rdi /* jmpbuf */
movq %rdi,%rdx

View File

@ -62,6 +62,7 @@ ENTRY(sigsetjmp)
movq $1,%rdi /* SIG_BLOCK */
movq $0,%rsi /* (sigset_t*)set */
leaq 72(%rcx),%rdx /* 9,10 (sigset_t*)oset */
/* stack is 16-byte aligned */
call PIC_PLT(CNAME(_sigprocmask))
popq %rdi
2: movq %rdi,%rcx
@ -90,7 +91,9 @@ ENTRY(__siglongjmp)
movq $3,%rdi /* SIG_SETMASK */
leaq 72(%rdx),%rsi /* (sigset_t*)set */
movq $0,%rdx /* (sigset_t*)oset */
subq $0x8,%rsp /* make the stack 16-byte aligned */
call PIC_PLT(CNAME(_sigprocmask))
addq $0x8,%rsp
popq %rsi
popq %rdi /* jmpbuf */
2: movq %rdi,%rdx

View File

@ -2,6 +2,11 @@
* Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
* All rights reserved.
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -38,10 +43,10 @@ __FBSDID("$FreeBSD$");
#include "gdtoaimp.h"
long double
strtold(const char * __restrict s, char ** __restrict sp)
strtold_l(const char * __restrict s, char ** __restrict sp, locale_t locale)
{
long double result;
strtorQ(s, sp, FLT_ROUNDS, &result);
strtorQ_l(s, sp, FLT_ROUNDS, &result, locale);
return result;
}

View File

@ -2,6 +2,11 @@
* Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
* All rights reserved.
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -34,10 +39,11 @@
__FBSDID("$FreeBSD$");
#include "gdtoaimp.h"
#undef strtold_l
long double
strtold(const char * __restrict s, char ** __restrict sp)
strtold_l(const char * __restrict s, char ** __restrict sp, locale_t locale)
{
return strtod(s, sp);
return strtod_l(s, sp, locale);
}

View File

@ -2,6 +2,11 @@
* Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
* All rights reserved.
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -38,10 +43,11 @@ __FBSDID("$FreeBSD$");
#include "gdtoaimp.h"
long double
strtold(const char * __restrict s, char ** __restrict sp)
strtold_l(const char * __restrict s, char ** __restrict sp, locale_t locale)
{
long double result;
FIX_LOCALE(locale);
strtorx(s, sp, FLT_ROUNDS, &result);
strtorx_l(s, sp, FLT_ROUNDS, &result, locale);
return result;
}

View File

@ -1,3 +1,5 @@
/* $OpenBSD: arc4random.c,v 1.22 2010/12/22 08:23:42 otto Exp $ */
/*
* Copyright (c) 1996, David Mazieres <dm@uun.org>
* Copyright (c) 2008, Damien Miller <djm@openbsd.org>
@ -24,11 +26,6 @@
* which is a trade secret). The same algorithm is used as a stream
* cipher called "arcfour" in Tatu Ylonen's ssh package.
*
* Here the stream cipher has been modified always to include the time
* when initializing the state. That makes it impossible to
* regenerate the same random sequence twice, so this can't be used
* for encryption, but will generate good random numbers.
*
* RC4 is a registered trademark of RSA Laboratories.
*/
@ -36,16 +33,24 @@
__FBSDID("$FreeBSD$");
#include "namespace.h"
#include <sys/types.h>
#include <sys/time.h>
#include <stdlib.h>
#include <fcntl.h>
#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <pthread.h>
#include "libc_private.h"
#include "un-namespace.h"
#ifdef __GNUC__
#define inline __inline
#else /* !__GNUC__ */
#define inline
#endif /* !__GNUC__ */
struct arc4_stream {
u_int8_t i;
u_int8_t j;
@ -55,22 +60,22 @@ struct arc4_stream {
static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER;
#define RANDOMDEV "/dev/random"
#define KEYSIZE 128
#define THREAD_LOCK() \
#define KEYSIZE 128
#define _ARC4_LOCK() \
do { \
if (__isthreaded) \
_pthread_mutex_lock(&arc4random_mtx); \
} while (0)
#define THREAD_UNLOCK() \
#define _ARC4_UNLOCK() \
do { \
if (__isthreaded) \
_pthread_mutex_unlock(&arc4random_mtx); \
} while (0)
static struct arc4_stream rs;
static int rs_initialized;
static int rs_stired;
static struct arc4_stream rs;
static pid_t arc4_stir_pid;
static int arc4_count;
static inline u_int8_t arc4_getbyte(void);
@ -107,20 +112,24 @@ arc4_addrandom(u_char *dat, int datlen)
static void
arc4_stir(void)
{
int done, fd, n;
int done, fd, i;
struct {
struct timeval tv;
pid_t pid;
u_int8_t rnd[KEYSIZE];
pid_t pid;
u_char rnd[KEYSIZE];
} rdat;
if (!rs_initialized) {
arc4_init();
rs_initialized = 1;
}
fd = _open(RANDOMDEV, O_RDONLY, 0);
done = 0;
if (fd >= 0) {
if (_read(fd, &rdat, KEYSIZE) == KEYSIZE)
done = 1;
(void)_close(fd);
}
}
if (!done) {
(void)gettimeofday(&rdat.tv, NULL);
rdat.pid = getpid();
@ -130,17 +139,26 @@ arc4_stir(void)
arc4_addrandom((u_char *)&rdat, KEYSIZE);
/*
* Throw away the first N bytes of output, as suggested in the
* paper "Weaknesses in the Key Scheduling Algorithm of RC4"
* by Fluher, Mantin, and Shamir. N=1024 is based on
* suggestions in the paper "(Not So) Random Shuffles of RC4"
* by Ilya Mironov.
* Discard early keystream, as per recommendations in:
* "(Not So) Random Shuffles of RC4" by Ilya Mironov.
*/
for (n = 0; n < 1024; n++)
(void) arc4_getbyte();
for (i = 0; i < 1024; i++)
(void)arc4_getbyte();
arc4_count = 1600000;
}
static void
arc4_stir_if_needed(void)
{
pid_t pid = getpid();
if (arc4_count <= 0 || !rs_initialized || arc4_stir_pid != pid)
{
arc4_stir_pid = pid;
arc4_stir();
}
}
static inline u_int8_t
arc4_getbyte(void)
{
@ -152,7 +170,6 @@ arc4_getbyte(void)
sj = rs.s[rs.j];
rs.s[rs.i] = sj;
rs.s[rs.j] = si;
return (rs.s[(si + sj) & 0xff]);
}
@ -160,81 +177,55 @@ static inline u_int32_t
arc4_getword(void)
{
u_int32_t val;
val = arc4_getbyte() << 24;
val |= arc4_getbyte() << 16;
val |= arc4_getbyte() << 8;
val |= arc4_getbyte();
return (val);
}
static void
arc4_check_init(void)
{
if (!rs_initialized) {
arc4_init();
rs_initialized = 1;
}
}
static inline void
arc4_check_stir(void)
{
if (!rs_stired || arc4_count <= 0) {
arc4_stir();
rs_stired = 1;
}
return val;
}
void
arc4random_stir(void)
{
THREAD_LOCK();
arc4_check_init();
_ARC4_LOCK();
arc4_stir();
rs_stired = 1;
THREAD_UNLOCK();
_ARC4_UNLOCK();
}
void
arc4random_addrandom(u_char *dat, int datlen)
{
THREAD_LOCK();
arc4_check_init();
arc4_check_stir();
_ARC4_LOCK();
if (!rs_initialized)
arc4_stir();
arc4_addrandom(dat, datlen);
THREAD_UNLOCK();
_ARC4_UNLOCK();
}
u_int32_t
arc4random(void)
{
u_int32_t rnd;
THREAD_LOCK();
arc4_check_init();
arc4_check_stir();
rnd = arc4_getword();
u_int32_t val;
_ARC4_LOCK();
arc4_count -= 4;
THREAD_UNLOCK();
return (rnd);
arc4_stir_if_needed();
val = arc4_getword();
_ARC4_UNLOCK();
return val;
}
void
arc4random_buf(void *_buf, size_t n)
{
u_char *buf = (u_char *)_buf;
THREAD_LOCK();
arc4_check_init();
_ARC4_LOCK();
arc4_stir_if_needed();
while (n--) {
arc4_check_stir();
if (--arc4_count <= 0)
arc4_stir();
buf[n] = arc4_getbyte();
arc4_count--;
}
THREAD_UNLOCK();
_ARC4_UNLOCK();
}
/*
@ -253,7 +244,7 @@ arc4random_uniform(u_int32_t upper_bound)
u_int32_t r, min;
if (upper_bound < 2)
return (0);
return 0;
#if (ULONG_MAX > 0xffffffffUL)
min = 0x100000000UL % upper_bound;
@ -279,7 +270,7 @@ arc4random_uniform(u_int32_t upper_bound)
break;
}
return (r % upper_bound);
return r % upper_bound;
}
#if 0

View File

@ -5,6 +5,11 @@
* This code is derived from software contributed to Berkeley by
* Guido van Rossum.
*
* Copyright (c) 2011 The FreeBSD Foundation
* All rights reserved.
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@ -222,6 +227,8 @@ rangematch(pattern, test, flags, newp, patmbs)
wchar_t c, c2;
size_t pclen;
const char *origpat;
struct xlocale_collate *table =
(struct xlocale_collate*)__get_locale()->components[XLC_COLLATE];
/*
* A bracket expression starting with an unquoted circumflex
@ -276,10 +283,10 @@ rangematch(pattern, test, flags, newp, patmbs)
if (flags & FNM_CASEFOLD)
c2 = towlower(c2);
if (__collate_load_error ?
if (table->__collate_load_error ?
c <= test && test <= c2 :
__collate_range_cmp(c, test) <= 0
&& __collate_range_cmp(test, c2) <= 0
__collate_range_cmp(table, c, test) <= 0
&& __collate_range_cmp(table, test, c2) <= 0
)
ok = 1;
} else if (c == test)

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd February 19, 2011
.Dd October 27, 2011
.Dt GETUTXENT 3
.Os
.Sh NAME
@ -301,7 +301,6 @@ The value of
determines which databases are modified.
.Pp
Entries of type
.Dv BOOT_TIME ,
.Dv SHUTDOWN_TIME ,
.Dv OLD_TIME
and
@ -335,7 +334,7 @@ In addition, entries of type
.Dv BOOT_TIME
and
.Dv SHUTDOWN_TIME
will cause all entries in
will cause all existing entries in
.Pa /var/run/utx.active
to be discarded.
.Pp
@ -386,10 +385,10 @@ Otherwise, -1 is returned and the global variable
is set to indicate the error.
.Sh ERRORS
In addition to the error conditions described in
.Xr open 2 ,
.Xr fdopen 3 ,
.Xr fopen 3 ,
.Xr fseek 3 ,
.Xr open 3 ,
the
.Fn pututxline
function can generate the following errors:

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