summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2012-12-04 04:37:42 +0000
committerneel <neel@FreeBSD.org>2012-12-04 04:37:42 +0000
commitd8091074f2295a4be6817c9fe8802b9b0db9346d (patch)
tree6ef29583fd1f17922e7c5b7d49d2d96d8ff38ebb /lib
parentd45d8a8d668a9ee12073939bf775c404be8cf175 (diff)
parent6b76c5a1b878e8001537fb323cb0c88fca9dc2df (diff)
downloadFreeBSD-src-d8091074f2295a4be6817c9fe8802b9b0db9346d.zip
FreeBSD-src-d8091074f2295a4be6817c9fe8802b9b0db9346d.tar.gz
IFC @r243836
Diffstat (limited to 'lib')
-rw-r--r--lib/clang/Makefile3
-rw-r--r--lib/clang/clang.build.mk29
-rw-r--r--lib/clang/include/Makefile6
-rw-r--r--lib/clang/include/MipsGenAsmMatcher.inc2
-rw-r--r--lib/clang/include/MipsGenMCPseudoLowering.inc2
-rw-r--r--lib/clang/include/clang/AST/CommentCommandInfo.inc2
-rw-r--r--lib/clang/include/clang/AST/CommentHTMLTags.inc2
-rw-r--r--lib/clang/include/clang/AST/CommentHTMLTagsProperties.inc2
-rw-r--r--lib/clang/include/clang/Basic/Version.inc4
-rw-r--r--lib/clang/include/llvm/Config/config.h6
-rw-r--r--lib/clang/libclanganalysis/Makefile4
-rw-r--r--lib/clang/libclangast/Makefile3
-rw-r--r--lib/clang/libclangrewritecore/Makefile18
-rw-r--r--lib/clang/libclangrewritefrontend/Makefile (renamed from lib/clang/libclangrewrite/Makefile)14
-rw-r--r--lib/clang/libclangsema/Makefile3
-rw-r--r--lib/clang/libclangstaticanalyzercheckers/Makefile8
-rw-r--r--lib/clang/libclangstaticanalyzercore/Makefile7
-rw-r--r--lib/clang/libllvmanalysis/Makefile5
-rw-r--r--lib/clang/libllvmarmcodegen/Makefile1
-rw-r--r--lib/clang/libllvmcodegen/Makefile13
-rw-r--r--lib/clang/libllvmcore/Makefile3
-rw-r--r--lib/clang/libllvmdebuginfo/Makefile1
-rw-r--r--lib/clang/libllvminstrumentation/Makefile2
-rw-r--r--lib/clang/libllvmipo/Makefile1
-rw-r--r--lib/clang/libllvmmcjit/Makefile4
-rw-r--r--lib/clang/libllvmmipsasmparser/Makefile3
-rw-r--r--lib/clang/libllvmmipscodegen/Makefile1
-rw-r--r--lib/clang/libllvmmipsdesc/Makefile1
-rw-r--r--lib/clang/libllvmscalaropts/Makefile3
-rw-r--r--lib/clang/libllvmtablegen/Makefile1
-rw-r--r--lib/clang/libllvmtarget/Makefile6
-rw-r--r--lib/clang/libllvmtransformutils/Makefile7
-rw-r--r--lib/clang/libllvmvectorize/Makefile1
-rw-r--r--lib/clang/libllvmx86codegen/Makefile1
-rw-r--r--lib/libc/gen/glob.c113
-rw-r--r--lib/libc/net/sctp_sys_calls.c86
-rw-r--r--lib/libc/stdio/fdopen.c6
-rw-r--r--lib/libc/stdio/flags.c5
-rw-r--r--lib/libc/stdio/fopen.319
-rw-r--r--lib/libc/stdio/freopen.c5
-rw-r--r--lib/libc/stdio/getline.34
-rw-r--r--lib/libc/sys/getpeername.24
-rw-r--r--lib/libc/sys/getsockname.24
-rw-r--r--lib/libutil/gr_util.c3
44 files changed, 284 insertions, 134 deletions
diff --git a/lib/clang/Makefile b/lib/clang/Makefile
index dde515e..1d993cd 100644
--- a/lib/clang/Makefile
+++ b/lib/clang/Makefile
@@ -14,7 +14,8 @@ SUBDIR= libclanganalysis \
libclangfrontendtool \
libclanglex \
libclangparse \
- libclangrewrite \
+ libclangrewritecore \
+ libclangrewritefrontend \
libclangsema \
libclangserialization \
libclangstaticanalyzercheckers \
diff --git a/lib/clang/clang.build.mk b/lib/clang/clang.build.mk
index 40dc4ab..298a2eb 100644
--- a/lib/clang/clang.build.mk
+++ b/lib/clang/clang.build.mk
@@ -16,20 +16,9 @@ BUILD_ARCH?= ${MACHINE_ARCH}
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-unknown-freebsd10.0
BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/}-unknown-freebsd10.0
CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\" \
- -DLLVM_HOSTTRIPLE=\"${BUILD_TRIPLE}\"
-
-.ifndef LLVM_REQUIRES_EH
-CXXFLAGS+= -fno-exceptions
-.else
-# If the library or program requires EH, it also requires RTTI.
-LLVM_REQUIRES_RTTI=
-.endif
-
-.ifndef LLVM_REQUIRES_RTTI
-CXXFLAGS+= -fno-rtti
-.endif
-
-CFLAGS+= -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\"
+ -DLLVM_HOSTTRIPLE=\"${BUILD_TRIPLE}\" \
+ -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\"
+CXXFLAGS+= -fno-exceptions -fno-rtti
.PATH: ${LLVM_SRCS}/${SRCDIR}
@@ -114,6 +103,18 @@ AttrTemplateInstantiate.inc.h: ${CLANG_SRCS}/include/clang/Basic/Attr.td
-gen-clang-attr-template-instantiate -o ${.TARGET} \
-I ${CLANG_SRCS}/include ${.ALLSRC}
+CommentCommandInfo.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentCommands.td
+ ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
+ -gen-clang-comment-command-info -o ${.TARGET} ${.ALLSRC}
+
+CommentHTMLTags.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td
+ ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
+ -gen-clang-comment-html-tags -o ${.TARGET} ${.ALLSRC}
+
+CommentHTMLTagsProperties.inc.h: ${CLANG_SRCS}/include/clang/AST/CommentHTMLTags.td
+ ${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
+ -gen-clang-comment-html-tags-properties -o ${.TARGET} ${.ALLSRC}
+
CommentNodes.inc.h: ${CLANG_SRCS}/include/clang/Basic/CommentNodes.td
${CLANG_TBLGEN} -I ${CLANG_SRCS}/include/clang/AST ${TBLINC} \
-gen-clang-comment-nodes -o ${.TARGET} ${.ALLSRC}
diff --git a/lib/clang/include/Makefile b/lib/clang/include/Makefile
index 93d91c7..918c6df 100644
--- a/lib/clang/include/Makefile
+++ b/lib/clang/include/Makefile
@@ -4,7 +4,9 @@
INCSDIR=${INCLUDEDIR}/clang/3.2
-INCS= altivec.h \
+INCS= __wmmintrin_aes.h \
+ __wmmintrin_pclmul.h \
+ altivec.h \
ammintrin.h \
avx2intrin.h \
avxintrin.h \
@@ -12,6 +14,7 @@ INCS= altivec.h \
bmiintrin.h \
cpuid.h \
emmintrin.h \
+ f16cintrin.h \
fma4intrin.h \
fmaintrin.h \
immintrin.h \
@@ -23,6 +26,7 @@ INCS= altivec.h \
nmmintrin.h \
pmmintrin.h \
popcntintrin.h \
+ rtmintrin.h \
smmintrin.h \
tmmintrin.h \
wmmintrin.h \
diff --git a/lib/clang/include/MipsGenAsmMatcher.inc b/lib/clang/include/MipsGenAsmMatcher.inc
new file mode 100644
index 0000000..b9e2fd1
--- /dev/null
+++ b/lib/clang/include/MipsGenAsmMatcher.inc
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+#include "MipsGenAsmMatcher.inc.h"
diff --git a/lib/clang/include/MipsGenMCPseudoLowering.inc b/lib/clang/include/MipsGenMCPseudoLowering.inc
new file mode 100644
index 0000000..4e4cbbe
--- /dev/null
+++ b/lib/clang/include/MipsGenMCPseudoLowering.inc
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+#include "MipsGenMCPseudoLowering.inc.h"
diff --git a/lib/clang/include/clang/AST/CommentCommandInfo.inc b/lib/clang/include/clang/AST/CommentCommandInfo.inc
new file mode 100644
index 0000000..cd17190
--- /dev/null
+++ b/lib/clang/include/clang/AST/CommentCommandInfo.inc
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+#include "CommentCommandInfo.inc.h"
diff --git a/lib/clang/include/clang/AST/CommentHTMLTags.inc b/lib/clang/include/clang/AST/CommentHTMLTags.inc
new file mode 100644
index 0000000..0932f32
--- /dev/null
+++ b/lib/clang/include/clang/AST/CommentHTMLTags.inc
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+#include "CommentHTMLTags.inc.h"
diff --git a/lib/clang/include/clang/AST/CommentHTMLTagsProperties.inc b/lib/clang/include/clang/AST/CommentHTMLTagsProperties.inc
new file mode 100644
index 0000000..77af956
--- /dev/null
+++ b/lib/clang/include/clang/AST/CommentHTMLTagsProperties.inc
@@ -0,0 +1,2 @@
+/* $FreeBSD$ */
+#include "CommentHTMLTagsProperties.inc.h"
diff --git a/lib/clang/include/clang/Basic/Version.inc b/lib/clang/include/clang/Basic/Version.inc
index d04836e..d912900 100644
--- a/lib/clang/include/clang/Basic/Version.inc
+++ b/lib/clang/include/clang/Basic/Version.inc
@@ -5,6 +5,6 @@
#define CLANG_VERSION_MINOR 2
#define CLANG_VENDOR "FreeBSD "
-#define CLANG_VENDOR_SUFFIX " 20120817"
+#define CLANG_VENDOR_SUFFIX " 20121130"
-#define SVN_REVISION "162107"
+#define SVN_REVISION "168974"
diff --git a/lib/clang/include/llvm/Config/config.h b/lib/clang/include/llvm/Config/config.h
index 15d7e2d..1894727 100644
--- a/lib/clang/include/llvm/Config/config.h
+++ b/lib/clang/include/llvm/Config/config.h
@@ -8,6 +8,9 @@
/* Bug report URL. */
#define BUG_REPORT_URL "http://llvm.org/bugs/"
+/* Define if we have libxml2 */
+/* #undef CLANG_HAVE_LIBXML */
+
/* Relative directory for resource files */
#define CLANG_RESOURCE_DIR ""
@@ -17,6 +20,9 @@
/* Default <path> to all compiler invocations for --sysroot=<path>. */
/* #undef DEFAULT_SYSROOT */
+/* Define if you want backtraces on crash */
+#define ENABLE_BACKTRACES 1
+
/* Define if position independent code is enabled */
#define ENABLE_PIC 0
diff --git a/lib/clang/libclanganalysis/Makefile b/lib/clang/libclanganalysis/Makefile
index d96f5dc..61c45be 100644
--- a/lib/clang/libclanganalysis/Makefile
+++ b/lib/clang/libclanganalysis/Makefile
@@ -4,14 +4,16 @@ LIB= clanganalysis
SRCDIR= tools/clang/lib/Analysis
SRCS= AnalysisDeclContext.cpp \
- CallGraph.cpp \
+ BodyFarm.cpp \
CFG.cpp \
CFGReachabilityAnalysis.cpp \
CFGStmtMap.cpp \
+ CallGraph.cpp \
CocoaConventions.cpp \
Dominators.cpp \
FormatString.cpp \
LiveVariables.cpp \
+ ObjCNoReturn.cpp \
PostOrderCFGView.cpp \
PrintfFormatString.cpp \
ProgramPoint.cpp \
diff --git a/lib/clang/libclangast/Makefile b/lib/clang/libclangast/Makefile
index a80bc7e..0b851e6 100644
--- a/lib/clang/libclangast/Makefile
+++ b/lib/clang/libclangast/Makefile
@@ -63,6 +63,9 @@ SRCS= APValue.cpp \
TGHDRS= AttrImpl \
AttrList \
Attrs \
+ CommentCommandInfo \
+ CommentHTMLTags \
+ CommentHTMLTagsProperties \
CommentNodes \
DeclNodes \
DiagnosticASTKinds \
diff --git a/lib/clang/libclangrewritecore/Makefile b/lib/clang/libclangrewritecore/Makefile
new file mode 100644
index 0000000..3a628d0
--- /dev/null
+++ b/lib/clang/libclangrewritecore/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+LIB= clangrewritecore
+
+SRCDIR= tools/clang/lib/Rewrite/Core
+SRCS= DeltaTree.cpp \
+ HTMLRewrite.cpp \
+ RewriteRope.cpp \
+ Rewriter.cpp \
+ TokenRewriter.cpp
+
+TGHDRS= AttrList \
+ Attrs \
+ DeclNodes \
+ DiagnosticCommonKinds \
+ StmtNodes
+
+.include "../clang.lib.mk"
diff --git a/lib/clang/libclangrewrite/Makefile b/lib/clang/libclangrewritefrontend/Makefile
index e165b0b..35de008 100644
--- a/lib/clang/libclangrewrite/Makefile
+++ b/lib/clang/libclangrewritefrontend/Makefile
@@ -1,26 +1,20 @@
# $FreeBSD$
-LIB= clangrewrite
+LIB= clangrewritefrontend
-SRCDIR= tools/clang/lib/Rewrite
-SRCS= DeltaTree.cpp \
- FixItRewriter.cpp \
+SRCDIR= tools/clang/lib/Rewrite/Frontend
+SRCS= FixItRewriter.cpp \
FrontendActions.cpp \
HTMLPrint.cpp \
- HTMLRewrite.cpp \
InclusionRewriter.cpp \
RewriteMacros.cpp \
RewriteModernObjC.cpp \
RewriteObjC.cpp \
- RewriteRope.cpp \
- RewriteTest.cpp \
- Rewriter.cpp \
- TokenRewriter.cpp
+ RewriteTest.cpp
TGHDRS= AttrList \
AttrParsedAttrList \
Attrs \
- CommentNodes \
DeclNodes \
DiagnosticCommonKinds \
DiagnosticFrontendKinds \
diff --git a/lib/clang/libclangsema/Makefile b/lib/clang/libclangsema/Makefile
index 83a1c56..235fa13 100644
--- a/lib/clang/libclangsema/Makefile
+++ b/lib/clang/libclangsema/Makefile
@@ -10,7 +10,9 @@ SRCS= AnalysisBasedWarnings.cpp \
DelayedDiagnostic.cpp \
IdentifierResolver.cpp \
JumpDiagnostics.cpp \
+ MultiplexExternalSemaSource.cpp \
Scope.cpp \
+ ScopeInfo.cpp \
Sema.cpp \
SemaAccess.cpp \
SemaAttr.cpp \
@@ -36,6 +38,7 @@ SRCS= AnalysisBasedWarnings.cpp \
SemaOverload.cpp \
SemaPseudoObject.cpp \
SemaStmt.cpp \
+ SemaStmtAsm.cpp \
SemaStmtAttr.cpp \
SemaTemplate.cpp \
SemaTemplateDeduction.cpp \
diff --git a/lib/clang/libclangstaticanalyzercheckers/Makefile b/lib/clang/libclangstaticanalyzercheckers/Makefile
index 1ad97b2..96274d9 100644
--- a/lib/clang/libclangstaticanalyzercheckers/Makefile
+++ b/lib/clang/libclangstaticanalyzercheckers/Makefile
@@ -3,8 +3,7 @@
LIB= clangstaticanalyzercheckers
SRCDIR= tools/clang/lib/StaticAnalyzer/Checkers
-SRCS= AdjustedReturnValueChecker.cpp \
- AnalyzerStatsChecker.cpp \
+SRCS= AnalyzerStatsChecker.cpp \
ArrayBoundChecker.cpp \
ArrayBoundCheckerV2.cpp \
AttrNonNullChecker.cpp \
@@ -27,12 +26,14 @@ SRCS= AdjustedReturnValueChecker.cpp \
DeadStoresChecker.cpp \
DebugCheckers.cpp \
DereferenceChecker.cpp \
+ DirectIvarAssignment.cpp \
DivZeroChecker.cpp \
DynamicTypePropagation.cpp \
ExprInspectionChecker.cpp \
FixedAddressChecker.cpp \
GenericTaintChecker.cpp \
IdempotentOperationChecker.cpp \
+ IvarInvalidationChecker.cpp \
LLVMConventionsChecker.cpp \
MacOSKeychainAPIChecker.cpp \
MacOSXAPIChecker.cpp \
@@ -42,10 +43,10 @@ SRCS= AdjustedReturnValueChecker.cpp \
NSAutoreleasePoolChecker.cpp \
NSErrorChecker.cpp \
NoReturnFunctionChecker.cpp \
- OSAtomicChecker.cpp \
ObjCAtSyncChecker.cpp \
ObjCContainersASTChecker.cpp \
ObjCContainersChecker.cpp \
+ ObjCMissingSuperCallChecker.cpp \
ObjCSelfInitChecker.cpp \
ObjCUnusedIVarsChecker.cpp \
PointerArithChecker.cpp \
@@ -54,6 +55,7 @@ SRCS= AdjustedReturnValueChecker.cpp \
RetainCountChecker.cpp \
ReturnPointerRangeChecker.cpp \
ReturnUndefChecker.cpp \
+ SimpleStreamChecker.cpp \
StackAddrEscapeChecker.cpp \
StreamChecker.cpp \
TaintTesterChecker.cpp \
diff --git a/lib/clang/libclangstaticanalyzercore/Makefile b/lib/clang/libclangstaticanalyzercore/Makefile
index 75b3d66..82ff5a3 100644
--- a/lib/clang/libclangstaticanalyzercore/Makefile
+++ b/lib/clang/libclangstaticanalyzercore/Makefile
@@ -3,9 +3,9 @@
LIB= clangstaticanalyzercore
SRCDIR= tools/clang/lib/StaticAnalyzer/Core
-SRCS= AnalysisManager.cpp \
- APSIntType.cpp \
- BasicConstraintManager.cpp \
+SRCS= APSIntType.cpp \
+ AnalysisManager.cpp \
+ AnalyzerOptions.cpp \
BasicValueFactory.cpp \
BlockCounter.cpp \
BugReporter.cpp \
@@ -16,6 +16,7 @@ SRCS= AnalysisManager.cpp \
CheckerHelpers.cpp \
CheckerManager.cpp \
CheckerRegistry.cpp \
+ ConstraintManager.cpp \
CoreEngine.cpp \
Environment.cpp \
ExplodedGraph.cpp \
diff --git a/lib/clang/libllvmanalysis/Makefile b/lib/clang/libllvmanalysis/Makefile
index cb1e345..3c01352 100644
--- a/lib/clang/libllvmanalysis/Makefile
+++ b/lib/clang/libllvmanalysis/Makefile
@@ -18,7 +18,9 @@ SRCS= AliasAnalysis.cpp \
CaptureTracking.cpp \
CodeMetrics.cpp \
ConstantFolding.cpp \
+ CostModel.cpp \
DbgInfoPrinter.cpp \
+ DependenceAnalysis.cpp \
DomPrinter.cpp \
DominanceFrontier.cpp \
IVUsers.cpp \
@@ -32,7 +34,6 @@ SRCS= AliasAnalysis.cpp \
LibCallSemantics.cpp \
Lint.cpp \
Loads.cpp \
- LoopDependenceAnalysis.cpp \
LoopInfo.cpp \
LoopPass.cpp \
MemDepPrinter.cpp \
@@ -50,6 +51,8 @@ SRCS= AliasAnalysis.cpp \
ProfileInfoLoader.cpp \
ProfileInfoLoaderPass.cpp \
ProfileVerifierPass.cpp \
+ ProfileDataLoader.cpp \
+ ProfileDataLoaderPass.cpp \
RegionInfo.cpp \
RegionPass.cpp \
RegionPrinter.cpp \
diff --git a/lib/clang/libllvmarmcodegen/Makefile b/lib/clang/libllvmarmcodegen/Makefile
index b18f12c..6ae9251 100644
--- a/lib/clang/libllvmarmcodegen/Makefile
+++ b/lib/clang/libllvmarmcodegen/Makefile
@@ -9,7 +9,6 @@ SRCS= ARMAsmPrinter.cpp \
ARMCodeEmitter.cpp \
ARMConstantIslandPass.cpp \
ARMConstantPoolValue.cpp \
- ARMELFWriterInfo.cpp \
ARMExpandPseudoInsts.cpp \
ARMFastISel.cpp \
ARMFrameLowering.cpp \
diff --git a/lib/clang/libllvmcodegen/Makefile b/lib/clang/libllvmcodegen/Makefile
index a0db98f..8beb583 100644
--- a/lib/clang/libllvmcodegen/Makefile
+++ b/lib/clang/libllvmcodegen/Makefile
@@ -12,8 +12,8 @@ SRCS= AggressiveAntiDepBreaker.cpp \
CodeGen.cpp \
CodePlacementOpt.cpp \
CriticalAntiDepBreaker.cpp \
- DeadMachineInstructionElim.cpp \
DFAPacketizer.cpp \
+ DeadMachineInstructionElim.cpp \
DwarfEHPrepare.cpp \
EarlyIfConversion.cpp \
EdgeBundles.cpp \
@@ -35,19 +35,19 @@ SRCS= AggressiveAntiDepBreaker.cpp \
LiveInterval.cpp \
LiveIntervalAnalysis.cpp \
LiveIntervalUnion.cpp \
+ LiveRangeCalc.cpp \
+ LiveRangeEdit.cpp \
LiveRegMatrix.cpp \
LiveStackAnalysis.cpp \
LiveVariables.cpp \
- LiveRangeCalc.cpp \
- LiveRangeEdit.cpp \
LocalStackSlotAllocation.cpp \
MachineBasicBlock.cpp \
MachineBlockFrequencyInfo.cpp \
MachineBlockPlacement.cpp \
MachineBranchProbabilityInfo.cpp \
+ MachineCSE.cpp \
MachineCodeEmitter.cpp \
MachineCopyPropagation.cpp \
- MachineCSE.cpp \
MachineDominators.cpp \
MachineFunction.cpp \
MachineFunctionAnalysis.cpp \
@@ -61,6 +61,7 @@ SRCS= AggressiveAntiDepBreaker.cpp \
MachineModuleInfo.cpp \
MachineModuleInfoImpls.cpp \
MachinePassRegistry.cpp \
+ MachinePostDominators.cpp \
MachineRegisterInfo.cpp \
MachineSSAUpdater.cpp \
MachineScheduler.cpp \
@@ -94,9 +95,10 @@ SRCS= AggressiveAntiDepBreaker.cpp \
ShrinkWrapping.cpp \
SjLjEHPrepare.cpp \
SlotIndexes.cpp \
- Spiller.cpp \
SpillPlacement.cpp \
+ Spiller.cpp \
SplitKit.cpp \
+ StackColoring.cpp \
StackProtector.cpp \
StackSlotColoring.cpp \
StrongPHIElimination.cpp \
@@ -105,6 +107,7 @@ SRCS= AggressiveAntiDepBreaker.cpp \
TargetInstrInfoImpl.cpp \
TargetLoweringObjectFileImpl.cpp \
TargetOptionsImpl.cpp \
+ TargetSchedule.cpp \
TwoAddressInstructionPass.cpp \
UnreachableBlockElim.cpp \
VirtRegMap.cpp
diff --git a/lib/clang/libllvmcore/Makefile b/lib/clang/libllvmcore/Makefile
index 8de6731..5b597fe 100644
--- a/lib/clang/libllvmcore/Makefile
+++ b/lib/clang/libllvmcore/Makefile
@@ -11,10 +11,12 @@ SRCS= AsmWriter.cpp \
Constants.cpp \
Core.cpp \
DIBuilder.cpp \
+ DataLayout.cpp \
DebugInfo.cpp \
DebugLoc.cpp \
Dominators.cpp \
Function.cpp \
+ GCOV.cpp \
GVMaterializer.cpp \
Globals.cpp \
IRBuilder.cpp \
@@ -33,6 +35,7 @@ SRCS= AsmWriter.cpp \
PrintModulePass.cpp \
Type.cpp \
TypeFinder.cpp \
+ TargetTransformInfo.cpp \
Use.cpp \
User.cpp \
Value.cpp \
diff --git a/lib/clang/libllvmdebuginfo/Makefile b/lib/clang/libllvmdebuginfo/Makefile
index b724157..e12289b 100644
--- a/lib/clang/libllvmdebuginfo/Makefile
+++ b/lib/clang/libllvmdebuginfo/Makefile
@@ -12,6 +12,7 @@ SRCS= DIContext.cpp \
DWARFDebugAranges.cpp \
DWARFDebugInfoEntry.cpp \
DWARFDebugLine.cpp \
+ DWARFDebugRangeList.cpp \
DWARFFormValue.cpp
.include "../clang.lib.mk"
diff --git a/lib/clang/libllvminstrumentation/Makefile b/lib/clang/libllvminstrumentation/Makefile
index 8e7e7a2..ef09370 100644
--- a/lib/clang/libllvminstrumentation/Makefile
+++ b/lib/clang/libllvminstrumentation/Makefile
@@ -4,9 +4,9 @@ LIB= llvminstrumentation
SRCDIR= lib/Transforms/Instrumentation
SRCS= AddressSanitizer.cpp \
+ BlackList.cpp \
BoundsChecking.cpp \
EdgeProfiling.cpp \
- FunctionBlackList.cpp \
GCOVProfiling.cpp \
Instrumentation.cpp \
OptimalEdgeProfiling.cpp \
diff --git a/lib/clang/libllvmipo/Makefile b/lib/clang/libllvmipo/Makefile
index a493532..b1e9016 100644
--- a/lib/clang/libllvmipo/Makefile
+++ b/lib/clang/libllvmipo/Makefile
@@ -6,6 +6,7 @@ LIB= llvmipo
SRCDIR= lib/Transforms/IPO
SRCS= ArgumentPromotion.cpp \
+ BarrierNoopPass.cpp \
ConstantMerge.cpp \
DeadArgumentElimination.cpp \
ExtractGV.cpp \
diff --git a/lib/clang/libllvmmcjit/Makefile b/lib/clang/libllvmmcjit/Makefile
index 553186f..207fd81 100644
--- a/lib/clang/libllvmmcjit/Makefile
+++ b/lib/clang/libllvmmcjit/Makefile
@@ -7,8 +7,4 @@ LIB= llvmmcjit
SRCDIR= lib/ExecutionEngine/MCJIT
SRCS= MCJIT.cpp
-.if ${MK_CLANG_EXTRAS} != "no"
-SRCS+= MCJITMemoryManager.cpp
-.endif
-
.include "../clang.lib.mk"
diff --git a/lib/clang/libllvmmipsasmparser/Makefile b/lib/clang/libllvmmipsasmparser/Makefile
index dd95394..f5fb3c3 100644
--- a/lib/clang/libllvmmipsasmparser/Makefile
+++ b/lib/clang/libllvmmipsasmparser/Makefile
@@ -6,7 +6,8 @@ SRCDIR= lib/Target/Mips/AsmParser
INCDIR= lib/Target/Mips
SRCS= MipsAsmParser.cpp
-TGHDRS= MipsGenInstrInfo \
+TGHDRS= MipsGenAsmMatcher \
+ MipsGenInstrInfo \
MipsGenRegisterInfo \
MipsGenSubtargetInfo
diff --git a/lib/clang/libllvmmipscodegen/Makefile b/lib/clang/libllvmmipscodegen/Makefile
index ae7d2f6..c33d954 100644
--- a/lib/clang/libllvmmipscodegen/Makefile
+++ b/lib/clang/libllvmmipscodegen/Makefile
@@ -33,6 +33,7 @@ TGHDRS= Intrinsics \
MipsGenCodeEmitter \
MipsGenDAGISel \
MipsGenInstrInfo \
+ MipsGenMCPseudoLowering \
MipsGenRegisterInfo \
MipsGenSubtargetInfo
diff --git a/lib/clang/libllvmmipsdesc/Makefile b/lib/clang/libllvmmipsdesc/Makefile
index 5c17588..120b866 100644
--- a/lib/clang/libllvmmipsdesc/Makefile
+++ b/lib/clang/libllvmmipsdesc/Makefile
@@ -4,6 +4,7 @@ LIB= llvmmipsdesc
SRCDIR= lib/Target/Mips/MCTargetDesc
SRCS= MipsAsmBackend.cpp \
+ MipsDirectObjLower.cpp \
MipsELFObjectWriter.cpp \
MipsMCAsmInfo.cpp \
MipsMCCodeEmitter.cpp \
diff --git a/lib/clang/libllvmscalaropts/Makefile b/lib/clang/libllvmscalaropts/Makefile
index f89b0a2..87eaf23 100644
--- a/lib/clang/libllvmscalaropts/Makefile
+++ b/lib/clang/libllvmscalaropts/Makefile
@@ -20,6 +20,7 @@ SRCS= ADCE.cpp \
LICM.cpp \
LoopDeletion.cpp \
LoopIdiomRecognize.cpp \
+ LoopInstSimplify.cpp \
LoopRotation.cpp \
LoopStrengthReduce.cpp \
LoopUnrollPass.cpp \
@@ -30,6 +31,8 @@ SRCS= ADCE.cpp \
Reassociate.cpp \
Reg2Mem.cpp \
SCCP.cpp \
+ SROA.cpp \
+ Scalar.cpp \
ScalarReplAggregates.cpp \
SimplifyCFGPass.cpp \
SimplifyLibCalls.cpp \
diff --git a/lib/clang/libllvmtablegen/Makefile b/lib/clang/libllvmtablegen/Makefile
index 5ac6954..8dffad0 100644
--- a/lib/clang/libllvmtablegen/Makefile
+++ b/lib/clang/libllvmtablegen/Makefile
@@ -7,7 +7,6 @@ SRCS= Error.cpp \
Main.cpp \
Record.cpp \
StringMatcher.cpp \
- TableGenAction.cpp \
TableGenBackend.cpp \
TGLexer.cpp \
TGParser.cpp
diff --git a/lib/clang/libllvmtarget/Makefile b/lib/clang/libllvmtarget/Makefile
index eaad17e..b82377e 100644
--- a/lib/clang/libllvmtarget/Makefile
+++ b/lib/clang/libllvmtarget/Makefile
@@ -5,15 +5,15 @@ LIB= llvmtarget
SRCDIR= lib/Target
SRCS= Mangler.cpp \
Target.cpp \
- TargetData.cpp \
- TargetELFWriterInfo.cpp \
TargetInstrInfo.cpp \
TargetIntrinsicInfo.cpp \
TargetJITInfo.cpp \
TargetLibraryInfo.cpp \
TargetLoweringObjectFile.cpp \
TargetMachine.cpp \
+ TargetMachineC.cpp \
TargetRegisterInfo.cpp \
- TargetSubtargetInfo.cpp
+ TargetSubtargetInfo.cpp \
+ TargetTransformImpl.cpp
.include "../clang.lib.mk"
diff --git a/lib/clang/libllvmtransformutils/Makefile b/lib/clang/libllvmtransformutils/Makefile
index f8afaec..0ed2624 100644
--- a/lib/clang/libllvmtransformutils/Makefile
+++ b/lib/clang/libllvmtransformutils/Makefile
@@ -9,6 +9,7 @@ SRCS= AddrModeMatcher.cpp \
BasicBlockUtils.cpp \
BreakCriticalEdges.cpp \
BuildLibCalls.cpp \
+ BypassSlowDivision.cpp \
CloneFunction.cpp \
CloneModule.cpp \
CmpInstAnalysis.cpp \
@@ -16,6 +17,7 @@ SRCS= AddrModeMatcher.cpp \
DemoteRegToStack.cpp \
InlineFunction.cpp \
InstructionNamer.cpp \
+ IntegerDivision.cpp \
LCSSA.cpp \
Local.cpp \
LoopSimplify.cpp \
@@ -25,18 +27,19 @@ SRCS= AddrModeMatcher.cpp \
LowerInvoke.cpp \
LowerSwitch.cpp \
Mem2Reg.cpp \
+ MetaRenamer.cpp \
ModuleUtils.cpp \
PromoteMemoryToRegister.cpp \
SSAUpdater.cpp \
SimplifyCFG.cpp \
SimplifyIndVar.cpp \
SimplifyInstructions.cpp \
+ SimplifyLibCalls.cpp \
UnifyFunctionExitNodes.cpp \
ValueMapper.cpp
.if ${MK_CLANG_EXTRAS} != "no"
-SRCS+= SimplifyInstructions.cpp \
- Utils.cpp
+SRCS+= Utils.cpp
.endif
TGHDRS= Intrinsics
diff --git a/lib/clang/libllvmvectorize/Makefile b/lib/clang/libllvmvectorize/Makefile
index 61a37b5..444d672 100644
--- a/lib/clang/libllvmvectorize/Makefile
+++ b/lib/clang/libllvmvectorize/Makefile
@@ -4,6 +4,7 @@ LIB= llvmvectorize
SRCDIR= lib/Transforms/Vectorize
SRCS= BBVectorize.cpp \
+ LoopVectorize.cpp \
Vectorize.cpp
TGHDRS= Intrinsics
diff --git a/lib/clang/libllvmx86codegen/Makefile b/lib/clang/libllvmx86codegen/Makefile
index a61cad9..bcc7aa0 100644
--- a/lib/clang/libllvmx86codegen/Makefile
+++ b/lib/clang/libllvmx86codegen/Makefile
@@ -6,7 +6,6 @@ SRCDIR= lib/Target/X86
SRCS= X86AsmPrinter.cpp \
X86COFFMachineModuleInfo.cpp \
X86CodeEmitter.cpp \
- X86ELFWriterInfo.cpp \
X86FastISel.cpp \
X86FloatingPoint.cpp \
X86FrameLowering.cpp \
diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c
index 211b535..832dc8d 100644
--- a/lib/libc/gen/glob.c
+++ b/lib/libc/gen/glob.c
@@ -94,6 +94,25 @@ __FBSDID("$FreeBSD$");
#include "collate.h"
+/*
+ * glob(3) expansion limits. Stop the expansion if any of these limits
+ * is reached. This caps the runtime in the face of DoS attacks. See
+ * also CVE-2010-2632
+ */
+#define GLOB_LIMIT_BRACE 128 /* number of brace calls */
+#define GLOB_LIMIT_PATH 65536 /* number of path elements */
+#define GLOB_LIMIT_READDIR 16384 /* number of readdirs */
+#define GLOB_LIMIT_STAT 1024 /* number of stat system calls */
+#define GLOB_LIMIT_STRING ARG_MAX /* maximum total size for paths */
+
+struct glob_limit {
+ size_t l_brace_cnt;
+ size_t l_path_lim;
+ size_t l_readdir_cnt;
+ size_t l_stat_cnt;
+ size_t l_string_cnt;
+};
+
#define DOLLAR '$'
#define DOT '.'
#define EOS '\0'
@@ -153,15 +172,18 @@ static const Char *g_strchr(const Char *, wchar_t);
static Char *g_strcat(Char *, const Char *);
#endif
static int g_stat(Char *, struct stat *, glob_t *);
-static int glob0(const Char *, glob_t *, size_t *);
-static int glob1(Char *, glob_t *, size_t *);
-static int glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *);
-static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, size_t *);
-static int globextend(const Char *, glob_t *, size_t *);
-static const Char *
+static int glob0(const Char *, glob_t *, struct glob_limit *);
+static int glob1(Char *, glob_t *, struct glob_limit *);
+static int glob2(Char *, Char *, Char *, Char *, glob_t *,
+ struct glob_limit *);
+static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *,
+ struct glob_limit *);
+static int globextend(const Char *, glob_t *, struct glob_limit *);
+static const Char *
globtilde(const Char *, Char *, size_t, glob_t *);
-static int globexp1(const Char *, glob_t *, size_t *);
-static int globexp2(const Char *, const Char *, glob_t *, int *, size_t *);
+static int globexp1(const Char *, glob_t *, struct glob_limit *);
+static int globexp2(const Char *, const Char *, glob_t *, int *,
+ struct glob_limit *);
static int match(Char *, Char *, Char *);
#ifdef DEBUG
static void qprintf(const char *, Char *);
@@ -171,8 +193,8 @@ int
glob(const char * __restrict pattern, int flags,
int (*errfunc)(const char *, int), glob_t * __restrict pglob)
{
+ struct glob_limit limit = { 0, 0, 0, 0, 0 };
const char *patnext;
- size_t limit;
Char *bufnext, *bufend, patbuf[MAXPATHLEN], prot;
mbstate_t mbs;
wchar_t wc;
@@ -186,11 +208,10 @@ glob(const char * __restrict pattern, int flags,
pglob->gl_offs = 0;
}
if (flags & GLOB_LIMIT) {
- limit = pglob->gl_matchc;
- if (limit == 0)
- limit = ARG_MAX;
- } else
- limit = 0;
+ limit.l_path_lim = pglob->gl_matchc;
+ if (limit.l_path_lim == 0)
+ limit.l_path_lim = GLOB_LIMIT_PATH;
+ }
pglob->gl_flags = flags & ~GLOB_MAGCHAR;
pglob->gl_errfunc = errfunc;
pglob->gl_matchc = 0;
@@ -243,11 +264,17 @@ glob(const char * __restrict pattern, int flags,
* characters
*/
static int
-globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
+globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
{
const Char* ptr = pattern;
int rv;
+ if ((pglob->gl_flags & GLOB_LIMIT) &&
+ limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) {
+ errno = 0;
+ return (GLOB_NOSPACE);
+ }
+
/* Protect a single {}, for find(1), like csh */
if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
return glob0(pattern, pglob, limit);
@@ -266,7 +293,8 @@ globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
* If it fails then it tries to glob the rest of the pattern and returns.
*/
static int
-globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *limit)
+globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv,
+ struct glob_limit *limit)
{
int i;
Char *lm, *ls;
@@ -436,7 +464,7 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
* if things went well, nonzero if errors occurred.
*/
static int
-glob0(const Char *pattern, glob_t *pglob, size_t *limit)
+glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
{
const Char *qpatnext;
int err;
@@ -529,7 +557,7 @@ compare(const void *p, const void *q)
}
static int
-glob1(Char *pattern, glob_t *pglob, size_t *limit)
+glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit)
{
Char pathbuf[MAXPATHLEN];
@@ -547,7 +575,7 @@ glob1(Char *pattern, glob_t *pglob, size_t *limit)
*/
static int
glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
- glob_t *pglob, size_t *limit)
+ glob_t *pglob, struct glob_limit *limit)
{
struct stat sb;
Char *p, *q;
@@ -563,6 +591,15 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
if (g_lstat(pathbuf, &sb, pglob))
return (0);
+ if ((pglob->gl_flags & GLOB_LIMIT) &&
+ limit->l_stat_cnt++ >= GLOB_LIMIT_STAT) {
+ errno = 0;
+ if (pathend + 1 > pathend_last)
+ return (GLOB_ABORTED);
+ *pathend++ = SEP;
+ *pathend = EOS;
+ return (GLOB_NOSPACE);
+ }
if (((pglob->gl_flags & GLOB_MARK) &&
pathend[-1] != SEP) && (S_ISDIR(sb.st_mode)
|| (S_ISLNK(sb.st_mode) &&
@@ -606,7 +643,7 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
static int
glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
Char *pattern, Char *restpattern,
- glob_t *pglob, size_t *limit)
+ glob_t *pglob, struct glob_limit *limit)
{
struct dirent *dp;
DIR *dirp;
@@ -652,6 +689,19 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
size_t clen;
mbstate_t mbs;
+ if ((pglob->gl_flags & GLOB_LIMIT) &&
+ limit->l_readdir_cnt++ >= GLOB_LIMIT_READDIR) {
+ errno = 0;
+ if (pathend + 1 > pathend_last)
+ err = GLOB_ABORTED;
+ else {
+ *pathend++ = SEP;
+ *pathend = EOS;
+ err = GLOB_NOSPACE;
+ }
+ break;
+ }
+
/* Initial DOT must be matched literally. */
if (dp->d_name[0] == DOT && *pattern != DOT)
continue;
@@ -702,29 +752,24 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
* gl_pathv points to (gl_offs + gl_pathc + 1) items.
*/
static int
-globextend(const Char *path, glob_t *pglob, size_t *limit)
+globextend(const Char *path, glob_t *pglob, struct glob_limit *limit)
{
char **pathv;
size_t i, newsize, len;
char *copy;
const Char *p;
- if (*limit && pglob->gl_pathc > *limit) {
+ if ((pglob->gl_flags & GLOB_LIMIT) &&
+ pglob->gl_matchc > limit->l_path_lim) {
errno = 0;
return (GLOB_NOSPACE);
}
newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
- pathv = pglob->gl_pathv ?
- realloc((char *)pglob->gl_pathv, newsize) :
- malloc(newsize);
- if (pathv == NULL) {
- if (pglob->gl_pathv) {
- free(pglob->gl_pathv);
- pglob->gl_pathv = NULL;
- }
+ /* realloc(NULL, newsize) is equivalent to malloc(newsize). */
+ pathv = realloc((void *)pglob->gl_pathv, newsize);
+ if (pathv == NULL)
return (GLOB_NOSPACE);
- }
if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
/* first time around -- clear initial gl_offs items */
@@ -737,6 +782,12 @@ globextend(const Char *path, glob_t *pglob, size_t *limit)
for (p = path; *p++;)
continue;
len = MB_CUR_MAX * (size_t)(p - path); /* XXX overallocation */
+ limit->l_string_cnt += len;
+ if ((pglob->gl_flags & GLOB_LIMIT) &&
+ limit->l_string_cnt >= GLOB_LIMIT_STRING) {
+ errno = 0;
+ return (GLOB_NOSPACE);
+ }
if ((copy = malloc(len)) != NULL) {
if (g_Ctoc(path, copy, len)) {
free(copy);
diff --git a/lib/libc/net/sctp_sys_calls.c b/lib/libc/net/sctp_sys_calls.c
index 1e06f44..beedf94 100644
--- a/lib/libc/net/sctp_sys_calls.c
+++ b/lib/libc/net/sctp_sys_calls.c
@@ -188,30 +188,34 @@ sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt,
cpto = ((caddr_t)buf + sizeof(int));
/* validate all the addresses and get the size */
for (i = 0; i < addrcnt; i++) {
- if (at->sa_family == AF_INET) {
+ switch (at->sa_family) {
+ case AF_INET:
if (at->sa_len != sizeof(struct sockaddr_in)) {
errno = EINVAL;
return (-1);
}
- memcpy(cpto, at, at->sa_len);
- cpto = ((caddr_t)cpto + at->sa_len);
- len += at->sa_len;
- } else if (at->sa_family == AF_INET6) {
+ memcpy(cpto, at, sizeof(struct sockaddr_in));
+ cpto = ((caddr_t)cpto + sizeof(struct sockaddr_in));
+ len += sizeof(struct sockaddr_in);
+ at = (struct sockaddr *)((caddr_t)at + sizeof(struct sockaddr_in));
+ break;
+ case AF_INET6:
if (at->sa_len != sizeof(struct sockaddr_in6)) {
errno = EINVAL;
return (-1);
}
if (IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)at)->sin6_addr)) {
- len += sizeof(struct sockaddr_in);
in6_sin6_2_sin((struct sockaddr_in *)cpto, (struct sockaddr_in6 *)at);
cpto = ((caddr_t)cpto + sizeof(struct sockaddr_in));
len += sizeof(struct sockaddr_in);
} else {
- memcpy(cpto, at, at->sa_len);
- cpto = ((caddr_t)cpto + at->sa_len);
- len += at->sa_len;
+ memcpy(cpto, at, sizeof(struct sockaddr_in6));
+ cpto = ((caddr_t)cpto + sizeof(struct sockaddr_in6));
+ len += sizeof(struct sockaddr_in6);
}
- } else {
+ at = (struct sockaddr *)((caddr_t)at + sizeof(struct sockaddr_in6));
+ break;
+ default:
errno = EINVAL;
return (-1);
}
@@ -220,7 +224,6 @@ sctp_connectx(int sd, const struct sockaddr *addrs, int addrcnt,
errno = E2BIG;
return (-1);
}
- at = (struct sockaddr *)((caddr_t)at + at->sa_len);
cnt++;
}
/* do we have any? */
@@ -261,56 +264,57 @@ sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt, int flags)
errno = EINVAL;
return (-1);
}
- argsz = (sizeof(struct sockaddr_storage) +
- sizeof(struct sctp_getaddresses));
- gaddrs = (struct sctp_getaddresses *)calloc(1, argsz);
- if (gaddrs == NULL) {
- errno = ENOMEM;
- return (-1);
- }
/* First pre-screen the addresses */
sa = addrs;
for (i = 0; i < addrcnt; i++) {
- if (sa->sa_family == AF_INET) {
- if (sa->sa_len != sizeof(struct sockaddr_in))
- goto out_error;
+ switch (sa->sa_family) {
+ case AF_INET:
+ if (sa->sa_len != sizeof(struct sockaddr_in)) {
+ errno = EINVAL;
+ return (-1);
+ }
sin = (struct sockaddr_in *)sa;
if (sin->sin_port) {
/* non-zero port, check or save */
if (sport) {
/* Check against our port */
if (sport != sin->sin_port) {
- goto out_error;
+ errno = EINVAL;
+ return (-1);
}
} else {
/* save off the port */
sport = sin->sin_port;
}
}
- } else if (sa->sa_family == AF_INET6) {
- if (sa->sa_len != sizeof(struct sockaddr_in6))
- goto out_error;
+ break;
+ case AF_INET6:
+ if (sa->sa_len != sizeof(struct sockaddr_in6)) {
+ errno = EINVAL;
+ return (-1);
+ }
sin6 = (struct sockaddr_in6 *)sa;
if (sin6->sin6_port) {
/* non-zero port, check or save */
if (sport) {
/* Check against our port */
if (sport != sin6->sin6_port) {
- goto out_error;
+ errno = EINVAL;
+ return (-1);
}
} else {
/* save off the port */
sport = sin6->sin6_port;
}
}
- } else {
- /* invalid address family specified */
- goto out_error;
+ break;
+ default:
+ /* Invalid address family specified. */
+ errno = EINVAL;
+ return (-1);
}
-
sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len);
}
- sa = addrs;
/*
* Now if there was a port mentioned, assure that the first address
* has that port to make sure it fails or succeeds correctly.
@@ -319,20 +323,14 @@ sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt, int flags)
sin = (struct sockaddr_in *)sa;
sin->sin_port = sport;
}
+ argsz = sizeof(struct sctp_getaddresses) +
+ sizeof(struct sockaddr_storage);
+ if ((gaddrs = (struct sctp_getaddresses *)malloc(argsz)) == NULL) {
+ errno = ENOMEM;
+ return (-1);
+ }
+ sa = addrs;
for (i = 0; i < addrcnt; i++) {
- if (sa->sa_family == AF_INET) {
- if (sa->sa_len != sizeof(struct sockaddr_in))
- goto out_error;
- } else if (sa->sa_family == AF_INET6) {
- if (sa->sa_len != sizeof(struct sockaddr_in6))
- goto out_error;
- } else {
- /* invalid address family specified */
- out_error:
- free(gaddrs);
- errno = EINVAL;
- return (-1);
- }
memset(gaddrs, 0, argsz);
gaddrs->sget_assoc_id = 0;
memcpy(gaddrs->addr, sa, sa->sa_len);
diff --git a/lib/libc/stdio/fdopen.c b/lib/libc/stdio/fdopen.c
index 26e2cd7..8fc90a4 100644
--- a/lib/libc/stdio/fdopen.c
+++ b/lib/libc/stdio/fdopen.c
@@ -80,6 +80,12 @@ fdopen(fd, mode)
if ((fp = __sfp()) == NULL)
return (NULL);
+
+ if ((oflags & O_CLOEXEC) && _fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
+ fp->_flags = 0;
+ return (NULL);
+ }
+
fp->_flags = flags;
/*
* If opened for appending, but underlying descriptor does not have
diff --git a/lib/libc/stdio/flags.c b/lib/libc/stdio/flags.c
index 0b6b075..e445fed 100644
--- a/lib/libc/stdio/flags.c
+++ b/lib/libc/stdio/flags.c
@@ -97,6 +97,7 @@ __sflags(mode, optr)
/* 'x' means exclusive (fail if the file exists) */
if (*mode == 'x') {
+ mode++;
if (m == O_RDONLY) {
errno = EINVAL;
return (0);
@@ -104,6 +105,10 @@ __sflags(mode, optr)
o |= O_EXCL;
}
+ /* set close-on-exec */
+ if (*mode == 'e')
+ o |= O_CLOEXEC;
+
*optr = m | o;
return (ret);
}
diff --git a/lib/libc/stdio/fopen.3 b/lib/libc/stdio/fopen.3
index 08438e7..da89ed4 100644
--- a/lib/libc/stdio/fopen.3
+++ b/lib/libc/stdio/fopen.3
@@ -32,7 +32,7 @@
.\" @(#)fopen.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd October 17, 2011
+.Dd November 30, 2012
.Dt FOPEN 3
.Os
.Sh NAME
@@ -97,6 +97,14 @@ or
causes the
.Fn fopen
call to fail if the file already exists.
+An optional
+.Dq Li e
+following the above
+causes the
+.Fn fopen
+call to set the
+.Dv FD_CLOEXEC
+flag on the underlying file descriptor.
.Pp
The
.Fa mode
@@ -144,6 +152,11 @@ of the stream must be compatible with the mode of the file descriptor.
The
.Dq Li x
mode option is ignored.
+If the
+.Dq Li e
+mode option is present, the
+.Dv FD_CLOEXEC
+flag is set, otherwise it remains unchanged.
When the stream is closed via
.Xr fclose 3 ,
.Fa fildes
@@ -277,3 +290,7 @@ The
function
conforms to
.St -p1003.1-88 .
+The
+.Dq Li e
+mode option does not conform to any standard
+but is also supported by glibc.
diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c
index be7bc8a..8d1ec91 100644
--- a/lib/libc/stdio/freopen.c
+++ b/lib/libc/stdio/freopen.c
@@ -118,6 +118,8 @@ freopen(file, mode, fp)
(void) ftruncate(fp->_file, (off_t)0);
if (!(oflags & O_APPEND))
(void) _sseek(fp, (fpos_t)0, SEEK_SET);
+ if (oflags & O_CLOEXEC)
+ (void) _fcntl(fp->_file, F_SETFD, FD_CLOEXEC);
f = fp->_file;
isopen = 0;
wantfd = -1;
@@ -194,7 +196,8 @@ finish:
* assume stderr is always fd STDERR_FILENO, even if being freopen'd.
*/
if (wantfd >= 0) {
- if (_dup2(f, wantfd) >= 0) {
+ if ((oflags & O_CLOEXEC ? _fcntl(f, F_DUP2FD_CLOEXEC, wantfd) :
+ _dup2(f, wantfd)) >= 0) {
(void)_close(f);
f = wantfd;
} else
diff --git a/lib/libc/stdio/getline.3 b/lib/libc/stdio/getline.3
index 6061bfc..2161999 100644
--- a/lib/libc/stdio/getline.3
+++ b/lib/libc/stdio/getline.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 30, 2010
+.Dd November 30, 2012
.Dt GETLINE 3
.Os
.Sh NAME
@@ -76,7 +76,7 @@ The
.Fn getdelim
and
.Fn getline
-functions return the number of characters written, excluding the
+functions return the number of characters stored in the buffer, excluding the
terminating
.Dv NUL
character.
diff --git a/lib/libc/sys/getpeername.2 b/lib/libc/sys/getpeername.2
index 9037119..255c7a0 100644
--- a/lib/libc/sys/getpeername.2
+++ b/lib/libc/sys/getpeername.2
@@ -67,6 +67,10 @@ The argument
is not a valid descriptor.
.It Bq Er ECONNRESET
The connection has been reset by the peer.
+.It Bq Er EINVAL
+The value of the
+.Fa namelen
+argument is not valid.
.It Bq Er ENOTSOCK
The argument
.Fa s
diff --git a/lib/libc/sys/getsockname.2 b/lib/libc/sys/getsockname.2
index f1537c7..1de0257 100644
--- a/lib/libc/sys/getsockname.2
+++ b/lib/libc/sys/getsockname.2
@@ -66,6 +66,10 @@ The argument
is not a valid descriptor.
.It Bq Er ECONNRESET
The connection has been reset by the peer.
+.It Bq Er EINVAL
+The value of the
+.Fa namelen
+argument is not valid.
.It Bq Er ENOTSOCK
The argument
.Fa s
diff --git a/lib/libutil/gr_util.c b/lib/libutil/gr_util.c
index 6d96d5e..be34395 100644
--- a/lib/libutil/gr_util.c
+++ b/lib/libutil/gr_util.c
@@ -318,6 +318,9 @@ gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr)
int
gr_mkdb(void)
{
+ if (chmod(tempname, 0644) != 0)
+ return (-1);
+
return (rename(tempname, group_file));
}
OpenPOWER on IntegriCloud