svn commit: r251242 - in head/usr.sbin/bsdconfig: console mouse networking/share password/share share share/media startup startup/share usermgmt/share

2013-06-01 Thread Devin Teske
Author: dteske
Date: Sun Jun  2 05:45:25 2013
New Revision: 251242
URL: http://svnweb.freebsd.org/changeset/base/251242

Log:
  Similar to r251236, improve the portion of dialog(1) API in dialog.subr
  responsible for retrieving stored input (for the --inputbox and --password
  widgets).
  
  When we (Ron McDowell and I) developed the first version of bsdconfig, it
  used temporary files to store responses from dialog(1). That hasn't been
  true for a very long time, so the need to always execute some clean-up
  function is long-deprecated. The function that used to perform these clean-
  up routines for these widgets was f_dialog_inputstr().
  
  We really don't need f_dialog_inputstr() for its originally designed purpose
  as all dialog invocations no longer require temporary files.
  
  Just as in r251236, redesign f_dialog_inputstr() in the following four ways:
  
  1. Rename f_dialog_inputstr() to f_dialog_inputstr_fetch()
  2. Introduce the new first-argument of $var_to_set to reduce forking
  3. Create a corresponding f_dialog_inputstr_store() to abstract storage
  4. Offload the sanitization to a new function, f_dialog_line_sanitize()
  
  It should be noted that f_dialog_line_sanitize() -- unlike its cousin from
  SVN r251236, f_dialog_data_sanitize() -- trims leading/trailing whitespace
  from the user's input. This helps prevent errors and common mistakes caused
  by the fact that the new cdialog implementation allows the right-arrow
  cursor key to go beyond the last byte of realtime input (adding whitespace
  at the end of the typed value).
  
  While we're centralizing the sanitization, let's rewrite f_dialog_input()
  while we're here to likewise reduce forking. The f_dialog_input() function
  now expects the first argument of $var_to_set instead of producing results
  on standard-out.
  
  These changes greatly improve readability and also improve performance.

Modified:
  head/usr.sbin/bsdconfig/console/saver
  head/usr.sbin/bsdconfig/mouse/flags
  head/usr.sbin/bsdconfig/networking/share/hostname.subr
  head/usr.sbin/bsdconfig/networking/share/ipaddr.subr
  head/usr.sbin/bsdconfig/networking/share/media.subr
  head/usr.sbin/bsdconfig/networking/share/netmask.subr
  head/usr.sbin/bsdconfig/networking/share/resolv.subr
  head/usr.sbin/bsdconfig/networking/share/routing.subr
  head/usr.sbin/bsdconfig/password/share/password.subr
  head/usr.sbin/bsdconfig/share/dialog.subr
  head/usr.sbin/bsdconfig/share/media/tcpip.subr
  head/usr.sbin/bsdconfig/share/mustberoot.subr
  head/usr.sbin/bsdconfig/share/variable.subr
  head/usr.sbin/bsdconfig/startup/misc
  head/usr.sbin/bsdconfig/startup/share/rcconf.subr
  head/usr.sbin/bsdconfig/startup/share/rcedit.subr
  head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
  head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr

Modified: head/usr.sbin/bsdconfig/console/saver
==
--- head/usr.sbin/bsdconfig/console/saver   Sun Jun  2 04:30:03 2013
(r251241)
+++ head/usr.sbin/bsdconfig/console/saver   Sun Jun  2 05:45:25 2013
(r251242)
@@ -183,9 +183,9 @@ while :; do
break ;;
"$msg_timeout") # Set the screen saver timeout interval
f_dialog_title "$msg_value_required"
-   blanktime=$( f_dialog_input "$msg_enter_timeout_period" \
-   "$( f_sysrc_get blanktime )"
-  ) && f_sysrc_set blanktime "$blanktime"
+   f_dialog_input blanktime "$msg_enter_timeout_period" \
+  "$( f_sysrc_get blanktime )" &&
+   f_sysrc_set blanktime "$blanktime"
f_dialog_title_restore
;;
esac

Modified: head/usr.sbin/bsdconfig/mouse/flags
==
--- head/usr.sbin/bsdconfig/mouse/flags Sun Jun  2 04:30:03 2013
(r251241)
+++ head/usr.sbin/bsdconfig/mouse/flags Sun Jun  2 05:45:25 2013
(r251242)
@@ -79,9 +79,8 @@ flags=$( f_sysrc_get moused_flags )
 # Prompt the user with the current value
 #
 f_dialog_title "$msg_value_required"
-flags=$( f_dialog_input "$msg_please_specify_the_mouse_daemon_flags" \
-"$flags"
-   ) || f_die
+f_dialog_input flags "$msg_please_specify_the_mouse_daemon_flags" \
+   "$flags" || f_die
 f_dialog_title_restore
 
 #

Modified: head/usr.sbin/bsdconfig/networking/share/hostname.subr
==
--- head/usr.sbin/bsdconfig/networking/share/hostname.subr  Sun Jun  2 
04:30:03 2013(r251241)
+++ head/usr.sbin/bsdconfig/networking/share/hostname.subr  Sun Jun  2 
05:45:25 2013(r251242)
@@ -108,9 +108,8 @@ f_dialog_input_hostname()
# Loop until the user provides taint-free input.
#
while :; do
-   hostname=$( 

svn commit: r251241 - head/tools/regression/lib/msun

2013-06-01 Thread David Schultz
Author: das
Date: Sun Jun  2 04:30:03 2013
New Revision: 251241
URL: http://svnweb.freebsd.org/changeset/base/251241

Log:
  Factor out some common code from the libm tests. This is a bit messy
  because different tests have different ideas about what it means to be
  "close enough" to the right answer, depending on the properties of the
  function being tested.  In the process, I fixed some warnings and
  added a few more 'volatile' hacks, which are sufficient to make all
  the tests pass at -O2 with clang.

Added:
  head/tools/regression/lib/msun/test-utils.h   (contents, props changed)
Modified:
  head/tools/regression/lib/msun/Makefile
  head/tools/regression/lib/msun/test-cexp.c
  head/tools/regression/lib/msun/test-conj.c
  head/tools/regression/lib/msun/test-csqrt.c
  head/tools/regression/lib/msun/test-ctrig.c
  head/tools/regression/lib/msun/test-exponential.c
  head/tools/regression/lib/msun/test-fma.c
  head/tools/regression/lib/msun/test-fmaxmin.c
  head/tools/regression/lib/msun/test-invctrig.c
  head/tools/regression/lib/msun/test-invtrig.c
  head/tools/regression/lib/msun/test-logarithm.c
  head/tools/regression/lib/msun/test-nearbyint.c
  head/tools/regression/lib/msun/test-next.c
  head/tools/regression/lib/msun/test-trig.c

Modified: head/tools/regression/lib/msun/Makefile
==
--- head/tools/regression/lib/msun/Makefile Sun Jun  2 01:10:49 2013
(r251240)
+++ head/tools/regression/lib/msun/Makefile Sun Jun  2 04:30:03 2013
(r251241)
@@ -5,7 +5,7 @@ TESTS=  test-cexp test-conj test-csqrt te
test-fmaxmin test-ilogb test-invtrig test-invctrig \
test-logarithm test-lrint \
test-lround test-nan test-nearbyint test-next test-rem test-trig
-CFLAGS+= -O0 -lm
+CFLAGS+= -O0 -lm -Wno-unknown-pragmas
 
 .PHONY: tests
 tests: ${TESTS}

Modified: head/tools/regression/lib/msun/test-cexp.c
==
--- head/tools/regression/lib/msun/test-cexp.c  Sun Jun  2 01:10:49 2013
(r251240)
+++ head/tools/regression/lib/msun/test-cexp.c  Sun Jun  2 04:30:03 2013
(r251241)
@@ -38,11 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#defineALL_STD_EXCEPT  (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \
-FE_OVERFLOW | FE_UNDERFLOW)
-#defineFLT_ULP()   ldexpl(1.0, 1 - FLT_MANT_DIG)
-#defineDBL_ULP()   ldexpl(1.0, 1 - DBL_MANT_DIG)
-#defineLDBL_ULP()  ldexpl(1.0, 1 - LDBL_MANT_DIG)
+#include "test-utils.h"
 
 #defineN(i)(sizeof(i) / sizeof((i)[0]))
 
@@ -50,23 +46,6 @@ __FBSDID("$FreeBSD$");
 #pragmaSTDC CX_LIMITED_RANGE   OFF
 
 /*
- * XXX gcc implements complex multiplication incorrectly. In
- * particular, it implements it as if the CX_LIMITED_RANGE pragma
- * were ON. Consequently, we need this function to form numbers
- * such as x + INFINITY * I, since gcc evalutes INFINITY * I as
- * NaN + INFINITY * I.
- */
-static inline long double complex
-cpackl(long double x, long double y)
-{
-   long double complex z;
-
-   __real__ z = x;
-   __imag__ z = y;
-   return (z);
-}
-
-/*
  * Test that a function returns the correct value and sets the
  * exception flags correctly. The exceptmask specifies which
  * exceptions we should check. We need to be lenient for several
@@ -83,14 +62,15 @@ cpackl(long double x, long double y)
 #definetest(func, z, result, exceptmask, excepts, checksign)   do {
\
volatile long double complex _d = z;\
assert(feclearexcept(FE_ALL_EXCEPT) == 0);  \
-   assert(cfpequal((func)(_d), (result), (checksign)));\
-   assert(((func), fetestexcept(exceptmask) == (excepts)));\
+   assert(cfpequal_cs((func)(_d), (result), (checksign))); \
+   assert(((void)(func), fetestexcept(exceptmask) == (excepts)));  \
 } while (0)
 
 /* Test within a given tolerance. */
 #definetest_tol(func, z, result, tol)  do {
\
volatile long double complex _d = z;\
-   assert(cfpequal_tol((func)(_d), (result), (tol)));  \
+   assert(cfpequal_tol((func)(_d), (result), (tol),\
+   FPE_ABS_ZERO | CS_BOTH));   \
 } while (0)
 
 /* Test all the functions that compute cexp(x). */
@@ -112,67 +92,6 @@ cpackl(long double x, long double y)
 static const float finites[] =
 { -42.0e20, -1.0, -1.0e-10, -0.0, 0.0, 1.0e-10, 1.0, 42.0e20 };
 
-/*
- * Determine whether x and y are equal, with two special rules:
- * +0.0 != -0.0
- *  NaN == NaN
- * If checksign is 0, we compare the absolute values instead.
- */
-static int
-fpequal(long double x, long double y, int checksign)
-{
-   if (isnan(x) || isnan(y))
-   return (1);
-   if (checksign)

svn commit: r251240 - head/usr.sbin/newsyslog

2013-06-01 Thread Mark Johnston
Author: markj
Date: Sun Jun  2 01:10:49 2013
New Revision: 251240
URL: http://svnweb.freebsd.org/changeset/base/251240

Log:
  We want to stat the archived log file rather than the logfile itself.
  
  PR:   bin/179122
  Submitted by: Oliver Fromme 
  MFC after:3 days

Modified:
  head/usr.sbin/newsyslog/newsyslog.c

Modified: head/usr.sbin/newsyslog/newsyslog.c
==
--- head/usr.sbin/newsyslog/newsyslog.c Sun Jun  2 01:07:38 2013
(r251239)
+++ head/usr.sbin/newsyslog/newsyslog.c Sun Jun  2 01:10:49 2013
(r251240)
@@ -2326,7 +2326,7 @@ mtime_old_timelog(const char *file)
if (validate_old_timelog(dir_fd, dp, logfname, &tm) == 0)
continue;
 
-   if (fstatat(dir_fd, logfname, &sb, AT_SYMLINK_NOFOLLOW) == -1) {
+   if (fstatat(dir_fd, dp->d_name, &sb, AT_SYMLINK_NOFOLLOW) == 
-1) {
warn("Cannot stat '%s'", file);
continue;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r251239 - head/tools/test/dtrace

2013-06-01 Thread Mark Johnston
Author: markj
Date: Sun Jun  2 01:07:38 2013
New Revision: 251239
URL: http://svnweb.freebsd.org/changeset/base/251239

Log:
  This test is working now, so remove it from NOTWORK.

Modified:
  head/tools/test/dtrace/Makefile

Modified: head/tools/test/dtrace/Makefile
==
--- head/tools/test/dtrace/Makefile Sun Jun  2 01:05:36 2013
(r251238)
+++ head/tools/test/dtrace/Makefile Sun Jun  2 01:07:38 2013
(r251239)
@@ -159,7 +159,6 @@ NOTWORK+= \
${TESTSRCDIR}/tst/common/sched/tst.enqueue.d\
${TESTSRCDIR}/tst/common/sched/tst.oncpu.d  \
${TESTSRCDIR}/tst/common/sched/tst.stackdepth.d \
-   ${TESTSRCDIR}/tst/common/sdt/tst.sdtargs.d  \
${TESTSRCDIR}/tst/common/usdt/argmap.d  \
${TESTSRCDIR}/tst/common/usdt/args.d\
${TESTSRCDIR}/tst/common/usdt/forker.d  \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r251238 - in head/sys/cddl/dev: dtrace/amd64 sdt

2013-06-01 Thread Mark Johnston
Author: markj
Date: Sun Jun  2 01:05:36 2013
New Revision: 251238
URL: http://svnweb.freebsd.org/changeset/base/251238

Log:
  SDT probes can directly pass up to five arguments as arguments to
  dtrace_probe(). Arguments beyond these five must be obtained in an
  architecture-specific way; this can be done through the getargval provider
  method, and through dtrace_getarg() if getargval isn't overridden.
  
  This change fixes two off-by-one bugs in the way these arguments are fetched
  in FreeBSD's DTrace implementation. First, the SDT provider must set the
  aframes parameter to 1 when creating a probe. The aframes parameter controls
  the number of frames that dtrace_getarg() will step over in order to find
  the frame containing the extra arguments. On FreeBSD, dtrace_getarg() is
  called in SDT probe context via
  
  dtrace_probe()->dtrace_dif_emulate()->dtrace_dif_variable->dtrace_getarg()
  
  so aframes must be 3 since the arguments are in dtrace_probe()'s frame; it
  was previously being called with a value of 2 instead. illumos uses a
  different aframes value for SDT probes, but this is because illumos SDT
  probes fire by triggering the #UD fault handler rather than calling
  dtrace_probe() directly.
  
  The second bug has to do with the way arguments are grabbed out
  dtrace_probe()'s frame on amd64. The code currently jumps over the first
  stack argument and retrieves the rest of them using a pointer into the
  stack. This works on i386 because all of dtrace_probe()'s arguments will be
  on the stack and the first argument is the probe ID, which should be
  ignored. However, it is incorrect to ignore the first stack argument on
  amd64, so we correct the pointer used to access the arguments.
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c
  head/sys/cddl/dev/sdt/sdt.c

Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c
==
--- head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Sun Jun  2 00:33:36 2013
(r251237)
+++ head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Sun Jun  2 01:05:36 2013
(r251238)
@@ -398,7 +398,7 @@ dtrace_getarg(int arg, int aframes)
}
 
arg -= (inreg + 1);
-   stack = (uintptr_t *)&fp[1];
+   stack = (uintptr_t *)fp + 2;
 
 load:
DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);

Modified: head/sys/cddl/dev/sdt/sdt.c
==
--- head/sys/cddl/dev/sdt/sdt.c Sun Jun  2 00:33:36 2013(r251237)
+++ head/sys/cddl/dev/sdt/sdt.c Sun Jun  2 01:05:36 2013(r251238)
@@ -134,7 +134,7 @@ sdt_probe_callback(struct sdt_probe *pro
return (0);
 
(void) dtrace_probe_create(prov->id, probe->mod, probe->func,
-   probe->name, 0, probe);
+   probe->name, 1, probe);
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r251237 - in head: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt sys/cddl/dev/dtrace sys/modules/dtrace/dtrace_test

2013-06-01 Thread Mark Johnston
Author: markj
Date: Sun Jun  2 00:33:36 2013
New Revision: 251237
URL: http://svnweb.freebsd.org/changeset/base/251237

Log:
  Port the SDT test now that it's possible to create SDT probes that take
  seven arguments.
  
  The original test uses Solaris' uadmin system call to trigger the test
  probe; this change adds a sysctl to the dtrace_test module and gets the test
  program to trigger the test probe via the sysctl handler.
  
  The test is currently failing on amd64 because of some bugs in the way that
  probe arguments beyond the first five are obtained - these bugs will be
  fixed in a separate change.

Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d
  head/sys/cddl/dev/dtrace/dtrace_test.c
  head/sys/modules/dtrace/dtrace_test/Makefile

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c
==
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c  
Sat Jun  1 23:58:44 2013(r251236)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c  
Sun Jun  2 00:33:36 2013(r251237)
@@ -26,26 +26,24 @@
 
 #pragma ident  "%Z%%M% %I% %E% SMI"
 
+#include 
+#include 
+
+#include 
 #include 
-#ifndef __FreeBSD__
-#include 
-#endif
 
 int
 main(int argc, char **argv)
 {
-#ifdef __FreeBSD__
-   return (1);
-#else
+   int val = 1;
+
while (1) {
-   if (uadmin(A_SDTTEST, 0, 0) < 0) {
-   perror("uadmin");
-   return (1);
-   }
+   if (sysctlbyname("debug.dtracetest.sdttest", NULL, NULL, &val,
+   sizeof(val)))
+   err(1, "sysctlbyname");
 
sleep(1);
}
 
return (0);
-#endif
 }

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d
==
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d  
Sat Jun  1 23:58:44 2013(r251236)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d  
Sun Jun  2 00:33:36 2013(r251237)
@@ -43,7 +43,7 @@ ERROR
exit(1);
 }
 
-sdt:::test
+test:::sdttest
 /arg0 != 1 || arg1 != 2 || arg2 != 3 || arg3 != 4 || arg4 != 5 || arg5 != 6 ||
 arg6 != 7/
 {
@@ -54,7 +54,7 @@ sdt:::test
exit(1);
 }
 
-sdt:::test
+test:::sdttest
 {
exit(0);
 }

Modified: head/sys/cddl/dev/dtrace/dtrace_test.c
==
--- head/sys/cddl/dev/dtrace/dtrace_test.c  Sat Jun  1 23:58:44 2013
(r251236)
+++ head/sys/cddl/dev/dtrace/dtrace_test.c  Sun Jun  2 00:33:36 2013
(r251237)
@@ -25,15 +25,25 @@
  * $FreeBSD$
  *
  */
+#include "opt_kdtrace.h"
 
 #include 
 #include 
 #include 
+#include 
+
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
+SDT_PROVIDER_DEFINE(test);
+
+SDT_PROBE_DEFINE7(test, , , sdttest, sdttest, "int", "int", "int", "int", 
"int",
+"int", "int");
+
 /*
  * These are variables that the DTrace test suite references in the
  * Solaris kernel. We define them here so that the tests function 
@@ -45,6 +55,33 @@ typedef struct vnode vnode_t;
 vnode_t dummy;
 vnode_t *rootvp = &dummy;
 
+/*
+ * Test SDT probes with more than 5 arguments. On amd64, such probes require
+ * special handling since only the first 5 arguments will be passed to
+ * dtrace_probe() in registers; the rest must be fetched off the stack.
+ */
+static int
+dtrace_test_sdttest(SYSCTL_HANDLER_ARGS)
+{
+   int val, error;
+
+   val = 0;
+   error = sysctl_handle_int(oidp, &val, 0, req);
+   if (error || req->newptr == NULL)
+   return (error);
+   else if (val == 0)
+   return (0);
+
+   SDT_PROBE7(test, , , sdttest, 1, 2, 3, 4, 5, 6, 7);
+
+   return (error);
+}
+
+static SYSCTL_NODE(_debug, OID_AUTO, dtracetest, CTLFLAG_RD, 0, "");
+
+SYSCTL_PROC(_debug_dtracetest, OID_AUTO, sdttest, CTLTYPE_INT | CTLFLAG_RW,
+NULL, 0, dtrace_test_sdttest, "I", "Trigger the SDT test probe");
+
 static int
 dtrace_test_modevent(module_t mod, int type, void *data)
 {

Modified: head/sys/modules/dtrace/dtrace_test/Makefile
==
--- head/sys/modules/dtrace/dtrace_test/MakefileSat Jun  1 23:58:44 
2013(r251236)
+++ head/sys/modules/dtrace/dtrace_test/MakefileSun Jun  2 00:33:36 
2013(r251237)
@@ -5,8 +5,9 @@
 KMOD=  dtrace_test
 SRCS=  dtrace_test.c
 
+SRCS+= opt_kdtrace.h
 SRCS+= vnode_if.h
-   
+
 CFLAGS+=   -I${.CURDIR}/../../..
 
 CFLAGS+=   -D_KERNEL
___
s

svn commit: r251236 - in head/usr.sbin/bsdconfig: . console mouse networking networking/share security share share/media share/packages startup startup/share timezone usermgmt usermgmt/share

2013-06-01 Thread Devin Teske
Author: dteske
Date: Sat Jun  1 23:58:44 2013
New Revision: 251236
URL: http://svnweb.freebsd.org/changeset/base/251236

Log:
  Improve portion of the dialog(1) API in dialog.subr responsible for
  retrieving stored data (for the --menu, --calendar, --timebox, --checklist,
  and --radiolist widgets).
  
  When we (Ron McDowell and I) developed the first version of bsdconfig, it
  used temporary files to store responses from dialog(1). That hasn't been
  true for some very long time, so the need to always store the return status
  of dialog(1) and then call some function to clean-up is long-deprecated. The
  function that used to do the clean-up was f_dialog_menutag().
  
  We really don't need f_dialog_menutag() for its originally designed purpose,
  as all dialog invocations (even when in a sub-shell) do not use temporary
  files anymore.
  
  However, we do need to keep f_dialog_menutag() around because it still fills
  the need of being able to abstract the procedure for fetching stored data
  provided by functions that display the aforementioned widgets.
  
  In re-designing f_dialog_menutag(), four important changes are made:
  
  1. Rename f_dialog_menutag() to f_dialog_menutag_fetch()
  2. Introduce the new first-argument of $var_to_set to reduce number of forks
  3. Create a corresponding f_dialog_menutag_store() to abstract the storage
  4. Offload the sanitization to a new function, f_dialog_data_sanitize()
  
  NOTE: That last one is important. Not all functions need to store their data
  for later fetching, meanwhile every invocation of dialog should be sanitized
  (as we learned early-on in the i18n-effort -- underlying libraries will spit
  warnings to stderr for bad values of $LANG and since dialog outputs its
  responses to stderr, we need to sanitize every response of these warnings).
  
  These changes greatly improve readbaility and also improve performance by
  reducing unnecessary forking.

Modified:
  head/usr.sbin/bsdconfig/bsdconfig
  head/usr.sbin/bsdconfig/console/console
  head/usr.sbin/bsdconfig/console/font
  head/usr.sbin/bsdconfig/console/keymap
  head/usr.sbin/bsdconfig/console/repeat
  head/usr.sbin/bsdconfig/console/saver
  head/usr.sbin/bsdconfig/console/screenmap
  head/usr.sbin/bsdconfig/console/ttys
  head/usr.sbin/bsdconfig/mouse/mouse
  head/usr.sbin/bsdconfig/mouse/port
  head/usr.sbin/bsdconfig/mouse/type
  head/usr.sbin/bsdconfig/networking/devices
  head/usr.sbin/bsdconfig/networking/networking
  head/usr.sbin/bsdconfig/networking/share/device.subr
  head/usr.sbin/bsdconfig/networking/share/media.subr
  head/usr.sbin/bsdconfig/networking/share/resolv.subr
  head/usr.sbin/bsdconfig/security/kern_securelevel
  head/usr.sbin/bsdconfig/security/security
  head/usr.sbin/bsdconfig/share/device.subr
  head/usr.sbin/bsdconfig/share/dialog.subr
  head/usr.sbin/bsdconfig/share/media/any.subr
  head/usr.sbin/bsdconfig/share/media/ftp.subr
  head/usr.sbin/bsdconfig/share/media/options.subr
  head/usr.sbin/bsdconfig/share/media/tcpip.subr
  head/usr.sbin/bsdconfig/share/mustberoot.subr
  head/usr.sbin/bsdconfig/share/packages/packages.subr
  head/usr.sbin/bsdconfig/startup/misc
  head/usr.sbin/bsdconfig/startup/rcadd
  head/usr.sbin/bsdconfig/startup/rcconf
  head/usr.sbin/bsdconfig/startup/rcdelete
  head/usr.sbin/bsdconfig/startup/rcvar
  head/usr.sbin/bsdconfig/startup/share/rcconf.subr
  head/usr.sbin/bsdconfig/startup/startup
  head/usr.sbin/bsdconfig/timezone/timezone
  head/usr.sbin/bsdconfig/usermgmt/groupdel
  head/usr.sbin/bsdconfig/usermgmt/groupedit
  head/usr.sbin/bsdconfig/usermgmt/groupinput
  head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
  head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
  head/usr.sbin/bsdconfig/usermgmt/userdel
  head/usr.sbin/bsdconfig/usermgmt/useredit
  head/usr.sbin/bsdconfig/usermgmt/userinput
  head/usr.sbin/bsdconfig/usermgmt/usermgmt

Modified: head/usr.sbin/bsdconfig/bsdconfig
==
--- head/usr.sbin/bsdconfig/bsdconfig   Sat Jun  1 22:53:11 2013
(r251235)
+++ head/usr.sbin/bsdconfig/bsdconfig   Sat Jun  1 23:58:44 2013
(r251236)
@@ -187,8 +187,8 @@ dialog_menu_main()
  \"\" \
  $menu_list
 
-   local dialog_menu
-   dialog_menu=$( eval $DIALOG \
+   local menu_choice
+   menu_choice=$( eval $DIALOG \
--clear \
--title \"\$title\" \
--backtitle \"\$btitle\"\
@@ -205,10 +205,11 @@ dialog_menu_main()
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
)
local retval=$?
-   setvar DIALOG_MENU_$$ "$dialog_menu"
+   f_dialog_data_sanitize menu_choice
+   f_dialog_menutag_store "$menu_choice"
 
# Only update default-item on success
-   [ $retval -eq 0 ] && setvar DEFAULTITEM_$$ "$

svn commit: r251233 - head/usr.sbin/bsdconfig/timezone

2013-06-01 Thread Devin Teske
Author: dteske
Date: Sat Jun  1 22:12:53 2013
New Revision: 251233
URL: http://svnweb.freebsd.org/changeset/base/251233

Log:
  Fix a typo introduced by r251190.

Modified:
  head/usr.sbin/bsdconfig/timezone/timezone

Modified: head/usr.sbin/bsdconfig/timezone/timezone
==
--- head/usr.sbin/bsdconfig/timezone/timezone   Sat Jun  1 21:29:53 2013
(r251232)
+++ head/usr.sbin/bsdconfig/timezone/timezone   Sat Jun  1 22:12:53 2013
(r251233)
@@ -89,7 +89,7 @@ dialog_menu_main()
\"\$title\"  \
\"\$btitle\" \
\"\$prompt\" \
-   \"\$\"   \
+   \"\" \
$continent_menu_list
 
local dialog_menu
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r251232 - head/usr.sbin/bsdconfig/share/packages

2013-06-01 Thread Devin Teske
Author: dteske
Date: Sat Jun  1 21:29:53 2013
New Revision: 251232
URL: http://svnweb.freebsd.org/changeset/base/251232

Log:
  Fix a regression in the packages module introduced by recent r251190.
  I somehow neglected this module in merging that API change.

Modified:
  head/usr.sbin/bsdconfig/share/packages/packages.subr

Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr
==
--- head/usr.sbin/bsdconfig/share/packages/packages.subrSat Jun  1 
21:28:43 2013(r251231)
+++ head/usr.sbin/bsdconfig/share/packages/packages.subrSat Jun  1 
21:29:53 2013(r251232)
@@ -297,13 +297,13 @@ f_package_menu_categories()
$category_list
" # End-Quote
 
-   local size dialog_menu
-   size=$( eval f_dialog_menu_with_help_size \
-   \"\$DIALOG_TITLE\" \
-   \"\$DIALOG_BACKTITLE\" \
-   \"\$prompt\"   \
-   \"\$hline\"\
-   $menu_list )
+   local height width rows dialog_menu
+   eval f_dialog_menu_with_help_size height width rows \
+ \"\$DIALOG_TITLE\" \
+ \"\$DIALOG_BACKTITLE\" \
+ \"\$prompt\"   \
+ \"\$hline\"\
+ $menu_list
dialog_menu=$( eval $DIALOG \
--title \"\$DIALOG_TITLE\" \
--backtitle \"\$DIALOG_BACKTITLE\" \
@@ -312,7 +312,8 @@ f_package_menu_categories()
--default-item \"\$defaultitem\"   \
--ok-label \"$msg_select\" \
--cancel-label \"$msg_cancel\" \
-   --menu \"\$prompt\" $size  \
+   --menu \"\$prompt\"\
+   $height $width $rows   \
$menu_list \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
)
@@ -455,17 +456,15 @@ f_package_menu_select()
  "$page" "$npages" )"
 
local hline="$hline_arrows_tab_punc_enter"
-   local size isize dialog_menu item
-   size=$( eval f_dialog_menu${SHOW_DESC:+_with_help}_size \
-   \"\$DIALOG_TITLE\" \
-   \"\$DIALOG_BACKTITLE\" \
-   \"\$prompt\"   \
-   \"\$hline\"\
-   $menu_list )
-   isize=$( f_dialog_infobox_size \
-   "$DIALOG_TITLE" \
-   "$DIALOG_BACKTITLE" \
-   "$msg_processing_selection" )
+   local mheight mwidth mrows
+   f_dialog_menu${SHOW_DESC:+_with_help}_size mheight mwidth mrows \
+   \"\$DIALOG_TITLE\" \"\$DIALOG_BACKTITLE\" \
+   \"\$prompt\" \"\$hline\" $menu_list
+   local iheight iwidth
+   f_dialog_infobox_size iheight iwidth \
+   "$DIALOG_TITLE" "$DIALOG_BACKTITLE" \
+   "$msg_processing_selection"
+   local dialog_menu item
dialog_menu=$( eval $DIALOG \
--title \"\$DIALOG_TITLE\" \
--backtitle \"\$DIALOG_BACKTITLE\" \
@@ -475,11 +474,13 @@ f_package_menu_select()
--cancel-label \"$msg_back\"   \
${SHOW_DESC:+--item-help}  \
--default-item \"\$defaultitem\"   \
-   --menu \"\$prompt\" $size  \
+   --menu \"\$prompt\"\
+   $mheight $mwidth $mrows\
$menu_list \
--and-widget   \
${USE_XDIALOG:+--no-buttons}   \
-   --infobox \"\$msg_processing_selection\" $isize \
+   --infobox \"\$msg_processing_selection\" \
+   $iheight $iwidth   \
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
)
local retval=$?
@@ -504,7 +505,7 @@ f_package_menu_select()
 #
 f_package_menu_deselect()
 {
-   local package="$1" prompt menu_list size dialog_menu
+   local package="$1" prompt menu_list dialog_menu
prompt=$( printf "$msg_what_would_you_like_to_do_with" "$package" )
local hline="$hline_alnum_arrows_punc_tab_enter"
menu_list="
@@ -512,19 +513,23 @@ f_package_menu_deselect()
'R $msg_reinstall' '$msg_reinstall_desc'
'U $msg_uninstall' '$msg_uninstall_desc'
" # End-Quote
-   size=$( eval f_dialog_menu_size \
-   \"\$DIALOG_TITLE\" \
- 

svn commit: r251230 - in head: include sys/sys

2013-06-01 Thread Ed Schouten
Author: ed
Date: Sat Jun  1 21:02:26 2013
New Revision: 251230
URL: http://svnweb.freebsd.org/changeset/base/251230

Log:
  Move  into sys/sys/.
  
  This will allow us to use C11 atomics in kernelspace, although it will
  need to be included as .

Added:
  head/sys/sys/stdatomic.h
 - copied unchanged from r251216, head/include/stdatomic.h
Deleted:
  head/include/stdatomic.h
Modified:
  head/include/Makefile

Modified: head/include/Makefile
==
--- head/include/Makefile   Sat Jun  1 20:32:34 2013(r251229)
+++ head/include/Makefile   Sat Jun  1 21:02:26 2013(r251230)
@@ -19,7 +19,7 @@ INCS= a.out.h ar.h assert.h bitstring.h 
printf.h proc_service.h pthread.h \
pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \
res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \
-   signal.h spawn.h stab.h stdalign.h stdatomic.h stdbool.h stddef.h \
+   signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \
stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \
strings.h sysexits.h tar.h termios.h tgmath.h \
time.h timeconv.h timers.h ttyent.h \
@@ -33,8 +33,8 @@ MHDRS=float.h floatingpoint.h stdarg.h
 
 PHDRS= sched.h _semaphore.h
 
-LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
-   ucontext.h
+LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
+   syslog.h ucontext.h
 
 LDIRS= bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
netipsec ${_netipx} netnatm \

Copied: head/sys/sys/stdatomic.h (from r251216, head/include/stdatomic.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/sys/stdatomic.hSat Jun  1 21:02:26 2013(r251230, copy 
of r251216, head/include/stdatomic.h)
@@ -0,0 +1,325 @@
+/*-
+ * Copyright (c) 2011 Ed Schouten 
+ *David Chisnall 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _STDATOMIC_H_
+#define_STDATOMIC_H_
+
+#include 
+#include 
+
+#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
+#define__CLANG_ATOMICS
+#elif __GNUC_PREREQ__(4, 7)
+#define__GNUC_ATOMICS
+#elif !defined(__GNUC__)
+#error "stdatomic.h does not support your compiler"
+#endif
+
+#if !defined(__CLANG_ATOMICS)
+#define_Atomic(T)  struct { volatile T __val; }
+#endif
+
+/*
+ * 7.17.2 Initialization.
+ */
+
+#if defined(__CLANG_ATOMICS)
+#defineATOMIC_VAR_INIT(value)  (value)
+#defineatomic_init(obj, value) __c11_atomic_init(obj, value)
+#else
+#defineATOMIC_VAR_INIT(value)  { .__val = (value) }
+#defineatomic_init(obj, value) ((void)((obj)->__val = (value)))
+#endif
+
+/*
+ * Clang and recent GCC both provide predefined macros for the memory
+ * orderings.  If we are using a compiler that doesn't define them, use the
+ * clang values - these will be ignored in the fallback path.
+ */
+
+#ifndef __ATOMIC_RELAXED
+#define __ATOMIC_RELAXED   0
+#endif
+#ifndef __ATOMIC_CONSUME
+#define __ATOMIC_CONSUME   1
+#endif
+#ifndef __ATOMIC_ACQUIRE
+#define __ATOMIC_ACQUIRE   2
+#endif
+#ifndef __ATOMIC_RELEASE
+#define __ATOMIC_RELEASE   3
+#endif
+#ifndef __ATOMIC_ACQ_REL
+#define __ATOMIC_ACQ_REL   4
+#endif
+#ifndef __ATOMIC_SEQ_CST
+#define __ATOMIC_SEQ_CST   5
+#endif
+
+/*
+ * 7.17.3 Order and consistency.
+ *
+ * The memory_order_* constants that denote the bar

svn commit: r251229 - head/sys/vm

2013-06-01 Thread Alan Cox
Author: alc
Date: Sat Jun  1 20:32:34 2013
New Revision: 251229
URL: http://svnweb.freebsd.org/changeset/base/251229

Log:
  Now that access to the page's "act_count" field is synchronized by the page
  lock instead of the object lock, there is no reason for vm_page_activate()
  to assert that the object is locked for either read or write access.
  (The "VPO_UNMANAGED" flag never changes after page allocation.)
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Sat Jun  1 19:07:03 2013(r251228)
+++ head/sys/vm/vm_page.c   Sat Jun  1 20:32:34 2013(r251229)
@@ -1837,7 +1837,6 @@ vm_page_activate(vm_page_t m)
int queue;
 
vm_page_lock_assert(m, MA_OWNED);
-   VM_OBJECT_ASSERT_WLOCKED(m->object);
if ((queue = m->queue) != PQ_ACTIVE) {
if (m->wire_count == 0 && (m->oflags & VPO_UNMANAGED) == 0) {
if (m->act_count < ACT_INIT)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r251227 - head/contrib/binutils/bfd

2013-06-01 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Jun  1 18:03:01 2013
New Revision: 251227
URL: http://svnweb.freebsd.org/changeset/base/251227

Log:
  Revert: Use time_t instead of long for archive timestamps.
  
  Back out for now: this breaks the i386 build and requires some revision.

Modified:
  head/contrib/binutils/bfd/archive.c
  head/contrib/binutils/bfd/bfd-in2.h
  head/contrib/binutils/bfd/bfdio.c
  head/contrib/binutils/bfd/coff-rs6000.c
  head/contrib/binutils/bfd/ecoff.c
  head/contrib/binutils/bfd/libbfd-in.h
  head/contrib/binutils/bfd/libbfd.h

Modified: head/contrib/binutils/bfd/archive.c
==
--- head/contrib/binutils/bfd/archive.c Sat Jun  1 15:02:15 2013
(r251226)
+++ head/contrib/binutils/bfd/archive.c Sat Jun  1 18:03:01 2013
(r251227)
@@ -1390,8 +1390,8 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, c
   /* ar headers are space padded, not null padded!  */
   memset (hdr, ' ', sizeof (struct ar_hdr));
 
-  _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12lld",
-(long long)status.st_mtime);
+  _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12ld",
+status.st_mtime);
 #ifdef HPUX_LARGE_AR_IDS
   /* HP has a very "special" way to handle UID/GID's with numeric values
  > 9.  */
@@ -1458,11 +1458,6 @@ bfd_generic_stat_arch_elt (bfd *abfd, st
   if (aloser == hdr->arelt)\
 return -1;
 
-#define fooll(arelt, stelt, size)  \
-  buf->stelt = strtoll (hdr->arelt, &aloser, size);\
-  if (aloser == hdr->arelt)\
-return -1;
-
   /* Some platforms support special notations for large IDs.  */
 #ifdef HPUX_LARGE_AR_IDS
 # define foo2(arelt, stelt, size)  \
@@ -1489,7 +1484,7 @@ bfd_generic_stat_arch_elt (bfd *abfd, st
 # define foo2(arelt, stelt, size) foo (arelt, stelt, size)
 #endif
 
-  fooll (ar_date, st_mtime, 10);
+  foo (ar_date, st_mtime, 10);
   foo2 (ar_uid, st_uid, 10);
   foo2 (ar_gid, st_gid, 10);
   foo (ar_mode, st_mode, 8);

Modified: head/contrib/binutils/bfd/bfd-in2.h
==
--- head/contrib/binutils/bfd/bfd-in2.h Sat Jun  1 15:02:15 2013
(r251226)
+++ head/contrib/binutils/bfd/bfd-in2.h Sat Jun  1 18:03:01 2013
(r251227)
@@ -38,7 +38,6 @@ extern "C" {
 
 #include "ansidecl.h"
 #include "symcat.h"
-#include   /* time_t */
 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
 #ifndef SABER
 /* This hack is to avoid a problem with some strict ANSI C preprocessors.
@@ -1142,7 +1141,7 @@ bfd_boolean bfd_fill_in_gnu_debuglink_se
 
 
 /* Extracted from bfdio.c.  */
-time_t bfd_get_mtime (bfd *abfd);
+long bfd_get_mtime (bfd *abfd);
 
 file_ptr bfd_get_size (bfd *abfd);
 

Modified: head/contrib/binutils/bfd/bfdio.c
==
--- head/contrib/binutils/bfd/bfdio.c   Sat Jun  1 15:02:15 2013
(r251226)
+++ head/contrib/binutils/bfd/bfdio.c   Sat Jun  1 18:03:01 2013
(r251227)
@@ -377,7 +377,7 @@ FUNCTION
bfd_get_mtime
 
 SYNOPSIS
-   time_t bfd_get_mtime (bfd *abfd);
+   long bfd_get_mtime (bfd *abfd);
 
 DESCRIPTION
Return the file modification time (as read from the file system, or
@@ -385,7 +385,7 @@ DESCRIPTION
 
 */
 
-time_t
+long
 bfd_get_mtime (bfd *abfd)
 {
   struct stat buf;

Modified: head/contrib/binutils/bfd/coff-rs6000.c
==
--- head/contrib/binutils/bfd/coff-rs6000.c Sat Jun  1 15:02:15 2013
(r251226)
+++ head/contrib/binutils/bfd/coff-rs6000.c Sat Jun  1 18:03:01 2013
(r251227)
@@ -1548,7 +1548,7 @@ _bfd_xcoff_stat_arch_elt (abfd, s)
 {
   struct xcoff_ar_hdr *hdrp = arch_xhdr (abfd);
 
-  s->st_mtime = strtoll (hdrp->date, (char **) NULL, 10);
+  s->st_mtime = strtol (hdrp->date, (char **) NULL, 10);
   s->st_uid = strtol (hdrp->uid, (char **) NULL, 10);
   s->st_gid = strtol (hdrp->gid, (char **) NULL, 10);
   s->st_mode = strtol (hdrp->mode, (char **) NULL, 8);
@@ -1558,7 +1558,7 @@ _bfd_xcoff_stat_arch_elt (abfd, s)
 {
   struct xcoff_ar_hdr_big *hdrp = arch_xhdr_big (abfd);
 
-  s->st_mtime = strtoll (hdrp->date, (char **) NULL, 10);
+  s->st_mtime = strtol (hdrp->date, (char **) NULL, 10);
   s->st_uid = strtol (hdrp->uid, (char **) NULL, 10);
   s->st_gid = strtol (hdrp->gid, (char **) NULL, 10);
   s->st_mode = strtol (hdrp->mode, (char **) NULL, 8);
@@ -1678,7 +1678,6 @@ xcoff_write_armap_old (abfd, elength, ma
 static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1];
 #define FMT20  "%-20lld"
 #define FMT12  "%-12d"
-#define FMT12_LL  "%-12lld"
 #define FMT12_OCTAL  "%-12o"
 #define FMT4  "%-4d"
 #define PRINT20(d, v) \
@@ -1689,10 +1688,6 @@ static 

Re: svn commit: r251225 - head/contrib/binutils/bfd

2013-06-01 Thread Pedro Giffuni

On 01.06.2013 12:39, Peter Wemm wrote:

FYI, this broke i386 builds.  Please fix it.

/scratch/src/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/bfdio.c:389:1:
error: conflicting types for 'bfd_get_mtime'
bfd_get_mtime (bfd *abfd)
^
/scratch/src/gnu/usr.bin/binutils/libbfd/bfd.h:1150:6: note: previous
declaration is here
long bfd_get_mtime (bfd *abfd);
  ^
1 error generated.




Sorry.. will fix now ...

Pedro.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r251225 - head/contrib/binutils/bfd

2013-06-01 Thread Peter Wemm
FYI, this broke i386 builds.  Please fix it.

/scratch/src/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/bfdio.c:389:1:
error: conflicting types for 'bfd_get_mtime'
bfd_get_mtime (bfd *abfd)
^
/scratch/src/gnu/usr.bin/binutils/libbfd/bfd.h:1150:6: note: previous
declaration is here
long bfd_get_mtime (bfd *abfd);
 ^
1 error generated.


On Sat, Jun 1, 2013 at 7:16 AM, Pedro F. Giffuni  wrote:
> Author: pfg
> Date: Sat Jun  1 14:16:51 2013
> New Revision: 251225
> URL: http://svnweb.freebsd.org/changeset/base/251225
>
> Log:
>   BFD: Use time_t instead of long for archive timestamps.
>
>   This basically follows the suggestion in the binutils code and is more
>   in line with what BSD ar(1) does.
>
>   Obtained from:OpenBSD
>   MFC after:2 weeks.
>
> Modified:
>   head/contrib/binutils/bfd/archive.c
>   head/contrib/binutils/bfd/bfd-in2.h
>   head/contrib/binutils/bfd/bfdio.c
>   head/contrib/binutils/bfd/coff-rs6000.c
>   head/contrib/binutils/bfd/ecoff.c
>   head/contrib/binutils/bfd/libbfd-in.h
>   head/contrib/binutils/bfd/libbfd.h
>
> Modified: head/contrib/binutils/bfd/archive.c
> ==
> --- head/contrib/binutils/bfd/archive.c Sat Jun  1 13:10:24 2013
> (r251224)
> +++ head/contrib/binutils/bfd/archive.c Sat Jun  1 14:16:51 2013
> (r251225)
> @@ -1390,8 +1390,8 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, c
>/* ar headers are space padded, not null padded!  */
>memset (hdr, ' ', sizeof (struct ar_hdr));
>
> -  _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12ld",
> -status.st_mtime);
> +  _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12lld",
> +(long long)status.st_mtime);
>  #ifdef HPUX_LARGE_AR_IDS
>/* HP has a very "special" way to handle UID/GID's with numeric values
>   > 9.  */
> @@ -1458,6 +1458,11 @@ bfd_generic_stat_arch_elt (bfd *abfd, st
>if (aloser == hdr->arelt)\
>  return -1;
>
> +#define fooll(arelt, stelt, size)  \
> +  buf->stelt = strtoll (hdr->arelt, &aloser, size);\
> +  if (aloser == hdr->arelt)\
> +return -1;
> +
>/* Some platforms support special notations for large IDs.  */
>  #ifdef HPUX_LARGE_AR_IDS
>  # define foo2(arelt, stelt, size)  \
> @@ -1484,7 +1489,7 @@ bfd_generic_stat_arch_elt (bfd *abfd, st
>  # define foo2(arelt, stelt, size) foo (arelt, stelt, size)
>  #endif
>
> -  foo (ar_date, st_mtime, 10);
> +  fooll (ar_date, st_mtime, 10);
>foo2 (ar_uid, st_uid, 10);
>foo2 (ar_gid, st_gid, 10);
>foo (ar_mode, st_mode, 8);
>
> Modified: head/contrib/binutils/bfd/bfd-in2.h
> ==
> --- head/contrib/binutils/bfd/bfd-in2.h Sat Jun  1 13:10:24 2013
> (r251224)
> +++ head/contrib/binutils/bfd/bfd-in2.h Sat Jun  1 14:16:51 2013
> (r251225)
> @@ -38,6 +38,7 @@ extern "C" {
>
>  #include "ansidecl.h"
>  #include "symcat.h"
> +#include   /* time_t */
>  #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
>  #ifndef SABER
>  /* This hack is to avoid a problem with some strict ANSI C preprocessors.
> @@ -1141,7 +1142,7 @@ bfd_boolean bfd_fill_in_gnu_debuglink_se
>
>
>  /* Extracted from bfdio.c.  */
> -long bfd_get_mtime (bfd *abfd);
> +time_t bfd_get_mtime (bfd *abfd);
>
>  file_ptr bfd_get_size (bfd *abfd);
>
>
> Modified: head/contrib/binutils/bfd/bfdio.c
> ==
> --- head/contrib/binutils/bfd/bfdio.c   Sat Jun  1 13:10:24 2013
> (r251224)
> +++ head/contrib/binutils/bfd/bfdio.c   Sat Jun  1 14:16:51 2013
> (r251225)
> @@ -377,7 +377,7 @@ FUNCTION
> bfd_get_mtime
>
>  SYNOPSIS
> -   long bfd_get_mtime (bfd *abfd);
> +   time_t bfd_get_mtime (bfd *abfd);
>
>  DESCRIPTION
> Return the file modification time (as read from the file system, or
> @@ -385,7 +385,7 @@ DESCRIPTION
>
>  */
>
> -long
> +time_t
>  bfd_get_mtime (bfd *abfd)
>  {
>struct stat buf;
>
> Modified: head/contrib/binutils/bfd/coff-rs6000.c
> ==
> --- head/contrib/binutils/bfd/coff-rs6000.c Sat Jun  1 13:10:24 2013  
>   (r251224)
> +++ head/contrib/binutils/bfd/coff-rs6000.c Sat Jun  1 14:16:51 2013  
>   (r251225)
> @@ -1548,7 +1548,7 @@ _bfd_xcoff_stat_arch_elt (abfd, s)
>  {
>struct xcoff_ar_hdr *hdrp = arch_xhdr (abfd);
>
> -  s->st_mtime = strtol (hdrp->date, (char **) NULL, 10);
> +  s->st_mtime = strtoll (hdrp->date, (char **) NULL, 10);
>s->st_uid = strtol (hdrp->uid, (char **) NULL, 10);
>s->st_gid = strtol (hdrp->gid, (char **) NULL, 10);
>s->st_mode = strtol (hdrp->mode, (char **) NULL, 8);
> @@ -1558,7

svn commit: r251225 - head/contrib/binutils/bfd

2013-06-01 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Jun  1 14:16:51 2013
New Revision: 251225
URL: http://svnweb.freebsd.org/changeset/base/251225

Log:
  BFD: Use time_t instead of long for archive timestamps.
  
  This basically follows the suggestion in the binutils code and is more
  in line with what BSD ar(1) does.
  
  Obtained from:OpenBSD
  MFC after:2 weeks.

Modified:
  head/contrib/binutils/bfd/archive.c
  head/contrib/binutils/bfd/bfd-in2.h
  head/contrib/binutils/bfd/bfdio.c
  head/contrib/binutils/bfd/coff-rs6000.c
  head/contrib/binutils/bfd/ecoff.c
  head/contrib/binutils/bfd/libbfd-in.h
  head/contrib/binutils/bfd/libbfd.h

Modified: head/contrib/binutils/bfd/archive.c
==
--- head/contrib/binutils/bfd/archive.c Sat Jun  1 13:10:24 2013
(r251224)
+++ head/contrib/binutils/bfd/archive.c Sat Jun  1 14:16:51 2013
(r251225)
@@ -1390,8 +1390,8 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, c
   /* ar headers are space padded, not null padded!  */
   memset (hdr, ' ', sizeof (struct ar_hdr));
 
-  _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12ld",
-status.st_mtime);
+  _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12lld",
+(long long)status.st_mtime);
 #ifdef HPUX_LARGE_AR_IDS
   /* HP has a very "special" way to handle UID/GID's with numeric values
  > 9.  */
@@ -1458,6 +1458,11 @@ bfd_generic_stat_arch_elt (bfd *abfd, st
   if (aloser == hdr->arelt)\
 return -1;
 
+#define fooll(arelt, stelt, size)  \
+  buf->stelt = strtoll (hdr->arelt, &aloser, size);\
+  if (aloser == hdr->arelt)\
+return -1;
+
   /* Some platforms support special notations for large IDs.  */
 #ifdef HPUX_LARGE_AR_IDS
 # define foo2(arelt, stelt, size)  \
@@ -1484,7 +1489,7 @@ bfd_generic_stat_arch_elt (bfd *abfd, st
 # define foo2(arelt, stelt, size) foo (arelt, stelt, size)
 #endif
 
-  foo (ar_date, st_mtime, 10);
+  fooll (ar_date, st_mtime, 10);
   foo2 (ar_uid, st_uid, 10);
   foo2 (ar_gid, st_gid, 10);
   foo (ar_mode, st_mode, 8);

Modified: head/contrib/binutils/bfd/bfd-in2.h
==
--- head/contrib/binutils/bfd/bfd-in2.h Sat Jun  1 13:10:24 2013
(r251224)
+++ head/contrib/binutils/bfd/bfd-in2.h Sat Jun  1 14:16:51 2013
(r251225)
@@ -38,6 +38,7 @@ extern "C" {
 
 #include "ansidecl.h"
 #include "symcat.h"
+#include   /* time_t */
 #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
 #ifndef SABER
 /* This hack is to avoid a problem with some strict ANSI C preprocessors.
@@ -1141,7 +1142,7 @@ bfd_boolean bfd_fill_in_gnu_debuglink_se
 
 
 /* Extracted from bfdio.c.  */
-long bfd_get_mtime (bfd *abfd);
+time_t bfd_get_mtime (bfd *abfd);
 
 file_ptr bfd_get_size (bfd *abfd);
 

Modified: head/contrib/binutils/bfd/bfdio.c
==
--- head/contrib/binutils/bfd/bfdio.c   Sat Jun  1 13:10:24 2013
(r251224)
+++ head/contrib/binutils/bfd/bfdio.c   Sat Jun  1 14:16:51 2013
(r251225)
@@ -377,7 +377,7 @@ FUNCTION
bfd_get_mtime
 
 SYNOPSIS
-   long bfd_get_mtime (bfd *abfd);
+   time_t bfd_get_mtime (bfd *abfd);
 
 DESCRIPTION
Return the file modification time (as read from the file system, or
@@ -385,7 +385,7 @@ DESCRIPTION
 
 */
 
-long
+time_t
 bfd_get_mtime (bfd *abfd)
 {
   struct stat buf;

Modified: head/contrib/binutils/bfd/coff-rs6000.c
==
--- head/contrib/binutils/bfd/coff-rs6000.c Sat Jun  1 13:10:24 2013
(r251224)
+++ head/contrib/binutils/bfd/coff-rs6000.c Sat Jun  1 14:16:51 2013
(r251225)
@@ -1548,7 +1548,7 @@ _bfd_xcoff_stat_arch_elt (abfd, s)
 {
   struct xcoff_ar_hdr *hdrp = arch_xhdr (abfd);
 
-  s->st_mtime = strtol (hdrp->date, (char **) NULL, 10);
+  s->st_mtime = strtoll (hdrp->date, (char **) NULL, 10);
   s->st_uid = strtol (hdrp->uid, (char **) NULL, 10);
   s->st_gid = strtol (hdrp->gid, (char **) NULL, 10);
   s->st_mode = strtol (hdrp->mode, (char **) NULL, 8);
@@ -1558,7 +1558,7 @@ _bfd_xcoff_stat_arch_elt (abfd, s)
 {
   struct xcoff_ar_hdr_big *hdrp = arch_xhdr_big (abfd);
 
-  s->st_mtime = strtol (hdrp->date, (char **) NULL, 10);
+  s->st_mtime = strtoll (hdrp->date, (char **) NULL, 10);
   s->st_uid = strtol (hdrp->uid, (char **) NULL, 10);
   s->st_gid = strtol (hdrp->gid, (char **) NULL, 10);
   s->st_mode = strtol (hdrp->mode, (char **) NULL, 8);
@@ -1678,6 +1678,7 @@ xcoff_write_armap_old (abfd, elength, ma
 static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1];
 #define FMT20  "%-20lld"
 #define FMT12  "%-12d"
+#define FMT12_LL  "%-12lld"
 #define FMT12_O

svn commit: r251223 - head/sys/boot/pc98/libpc98

2013-06-01 Thread Takahashi Yoshihiro
Author: nyan
Date: Sat Jun  1 12:27:48 2013
New Revision: 251223
URL: http://svnweb.freebsd.org/changeset/base/251223

Log:
  MFi386: revision 245848
  
Always update the hw.uart.console hint.

Modified:
  head/sys/boot/pc98/libpc98/comconsole.c

Modified: head/sys/boot/pc98/libpc98/comconsole.c
==
--- head/sys/boot/pc98/libpc98/comconsole.c Sat Jun  1 12:21:59 2013
(r251222)
+++ head/sys/boot/pc98/libpc98/comconsole.c Sat Jun  1 12:27:48 2013
(r251223)
@@ -50,7 +50,6 @@ static intcomc_init(int arg);
 static voidcomc_putchar(int c);
 static int comc_getchar(void);
 static int comc_getspeed(void);
-static voidset_hw_console_hint(void);
 static int comc_ischar(void);
 static int comc_parseint(const char *string);
 static uint32_t comc_parse_pcidev(const char *string);
@@ -202,27 +201,14 @@ comc_port_set(struct env_var *ev, int fl
 }
 
 if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 &&
-   comc_port != port) {
+   comc_port != port)
comc_setup(comc_curspeed, port);
-   set_hw_console_hint();
-}
 
 env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
 
 return (CMD_OK);
 }
 
-static void
-set_hw_console_hint(void)
-{
-   char intbuf[64];
-
-   unsetenv("hw.uart.console");
-   sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed);
-   env_setenv("hw.uart.console", EV_VOLATILE, intbuf,
-   env_noset, env_nounset);
-}
-
 /*
  * Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10.
  * Output: bar[24:16] bus[15:8] dev[7:3] func[2:0]
@@ -288,7 +274,6 @@ comc_pcidev_handle(uint32_t locator)
   comc_port_set, env_nounset);
 
comc_setup(comc_curspeed, port);
-   set_hw_console_hint();
comc_locator = locator;
 
return (CMD_OK);
@@ -318,8 +303,10 @@ static void
 comc_setup(int speed, int port)
 {
 static int TRY_COUNT = 100;
+char intbuf[64];
 int tries;
 
+unsetenv("hw.uart.console");
 comc_curspeed = speed;
 comc_port = port;
 
@@ -334,9 +321,11 @@ comc_setup(int speed, int port)
 inb(comc_port + com_data);
 while (inb(comc_port + com_lsr) & LSR_RXRDY && ++tries < TRY_COUNT);
 
-if (tries < TRY_COUNT)
+if (tries < TRY_COUNT) {
comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT);
-else
+   sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed);
+   env_setenv("hw.uart.console", EV_VOLATILE, intbuf, NULL, NULL);
+} else
comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r251222 - head/sys/pc98/pc98

2013-06-01 Thread Takahashi Yoshihiro
Author: nyan
Date: Sat Jun  1 12:21:59 2013
New Revision: 251222
URL: http://svnweb.freebsd.org/changeset/base/251222

Log:
  MFi386: revision 251039
  
Use slightly more idiomatic expression to get the address of array.

Modified:
  head/sys/pc98/pc98/machdep.c

Modified: head/sys/pc98/pc98/machdep.c
==
--- head/sys/pc98/pc98/machdep.cSat Jun  1 11:42:47 2013
(r251221)
+++ head/sys/pc98/pc98/machdep.cSat Jun  1 12:21:59 2013
(r251222)
@@ -2789,7 +2789,7 @@ get_fpcontext(struct thread *td, mcontex
bzero(mcp->mc_fpstate, sizeof(mcp->mc_fpstate));
 #else
mcp->mc_ownedfp = npxgetregs(td);
-   bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate,
+   bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate[0],
sizeof(mcp->mc_fpstate));
mcp->mc_fpformat = npxformat();
 #endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r251221 - head/sys/kern

2013-06-01 Thread Marius Strobl
Author: marius
Date: Sat Jun  1 11:42:47 2013
New Revision: 251221
URL: http://svnweb.freebsd.org/changeset/base/251221

Log:
  Move an assertion to the right spot; only bus_dmamap_load_mbuf(9)
  requires a pkthdr being present but that's not the case for either
  _bus_dmamap_load_mbuf_sg() or bus_dmamap_load_mbuf_sg(9).
  
  Reported by:  sbruno
  MFC after:1 week

Modified:
  head/sys/kern/subr_bus_dma.c

Modified: head/sys/kern/subr_bus_dma.c
==
--- head/sys/kern/subr_bus_dma.cSat Jun  1 11:31:09 2013
(r251220)
+++ head/sys/kern/subr_bus_dma.cSat Jun  1 11:42:47 2013
(r251221)
@@ -104,8 +104,6 @@ _bus_dmamap_load_mbuf_sg(bus_dma_tag_t d
struct mbuf *m;
int error;
 
-   M_ASSERTPKTHDR(m0);
-
error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
if (m->m_len > 0) {
@@ -323,6 +321,8 @@ bus_dmamap_load_mbuf(bus_dma_tag_t dmat,
bus_dma_segment_t *segs;
int nsegs, error;
 
+   M_ASSERTPKTHDR(m0);
+
flags |= BUS_DMA_NOWAIT;
nsegs = -1;
error = _bus_dmamap_load_mbuf_sg(dmat, map, m0, NULL, &nsegs, flags);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r251220 - head/sys/sys

2013-06-01 Thread John Baldwin
Author: jhb
Date: Sat Jun  1 11:31:09 2013
New Revision: 251220
URL: http://svnweb.freebsd.org/changeset/base/251220

Log:
  Remove an unused macro we originally got from BSD/OS.

Modified:
  head/sys/sys/mutex.h

Modified: head/sys/sys/mutex.h
==
--- head/sys/sys/mutex.hSat Jun  1 11:14:35 2013(r251219)
+++ head/sys/sys/mutex.hSat Jun  1 11:31:09 2013(r251220)
@@ -426,12 +426,6 @@ do {   
\
}
 #endif
 
-#defineUGAR(rval) do { 
\
-   int _val = (rval);  \
-   mtx_unlock(&Giant); \
-   return (_val);  \
-} while (0)
-
 struct mtx_args {
void*ma_mtx;
const char  *ma_desc;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r251198 - head/sys/compat/freebsd32

2013-06-01 Thread John Baldwin
On Friday, May 31, 2013 05:43:18 PM David E. O'Brien wrote:
> Author: obrien
> Date: Fri May 31 21:43:17 2013
> New Revision: 251198
> URL: http://svnweb.freebsd.org/changeset/base/251198
> 
> Log:
>   Add a "kern.features" MIB for 32bit support under a 64bit kernel.

I suggest calling it 'compat_freebsd32' to match the kernel option name.
We've already decided that compat_freebsd32 does not actually mean
compatiblity with FreeBSD 32.x in terms of our kernel option naming.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r251216 - head/contrib/llvm/tools/clang/lib/CodeGen

2013-06-01 Thread Ed Schouten
Author: ed
Date: Sat Jun  1 08:07:09 2013
New Revision: 251216
URL: http://svnweb.freebsd.org/changeset/base/251216

Log:
  Pull in r183033 and r183036 from LLVM trunk:
  
Add support for optimized (non-generic) atomic libcalls.
  
For integer types of sizes 1, 2, 4 and 8, libcompiler-rt (and libgcc)
provide atomic functions that pass parameters by value and return
results directly.
  
libgcc and libcompiler-rt only provide optimized libcalls for
__atomic_fetch_*, as generic libcalls on non-integer types would make
little sense. This means that we can finally make __atomic_fetch_*
work
on architectures for which we don't provide these operations as
builtins
(e.g. ARM).
  
This should fix the dreaded "cannot compile this atomic library call
yet" error that would pop up once every while.
  
  This should make it possible for me to get C11 atomics working on all of
  our platforms.

Modified:
  head/contrib/llvm/tools/clang/lib/CodeGen/CGAtomic.cpp

Modified: head/contrib/llvm/tools/clang/lib/CodeGen/CGAtomic.cpp
==
--- head/contrib/llvm/tools/clang/lib/CodeGen/CGAtomic.cpp  Sat Jun  1 
04:07:56 2013(r251215)
+++ head/contrib/llvm/tools/clang/lib/CodeGen/CGAtomic.cpp  Sat Jun  1 
08:07:09 2013(r251216)
@@ -15,6 +15,7 @@
 #include "CGCall.h"
 #include "CodeGenModule.h"
 #include "clang/AST/ASTContext.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Intrinsics.h"
 #include "llvm/IR/Operator.h"
@@ -317,6 +318,21 @@ EmitValToTemp(CodeGenFunction &CGF, Expr
   return DeclPtr;
 }
 
+static void
+AddDirectArgument(CodeGenFunction &CGF, CallArgList &Args,
+  bool UseOptimizedLibcall, llvm::Value *Val, QualType ValTy) {
+  if (UseOptimizedLibcall) {
+// Load value and pass it to the function directly.
+unsigned Align = CGF.getContext().getTypeAlignInChars(ValTy).getQuantity();
+Val = CGF.EmitLoadOfScalar(Val, false, Align, ValTy);
+Args.add(RValue::get(Val), ValTy);
+  } else {
+// Non-optimized functions always take a reference.
+Args.add(RValue::get(CGF.EmitCastToVoidPtr(Val)),
+ CGF.getContext().VoidPtrTy);
+  }
+}
+
 RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E, llvm::Value *Dest) {
   QualType AtomicTy = E->getPtr()->getType()->getPointeeType();
   QualType MemTy = AtomicTy;
@@ -424,76 +440,137 @@ RValue CodeGenFunction::EmitAtomicExpr(A
 
   // Use a library call.  See: http://gcc.gnu.org/wiki/Atomic/GCCMM/LIbrary .
   if (UseLibcall) {
+bool UseOptimizedLibcall = false;
+switch (E->getOp()) {
+case AtomicExpr::AO__c11_atomic_fetch_add:
+case AtomicExpr::AO__atomic_fetch_add:
+case AtomicExpr::AO__c11_atomic_fetch_and:
+case AtomicExpr::AO__atomic_fetch_and:
+case AtomicExpr::AO__c11_atomic_fetch_or:
+case AtomicExpr::AO__atomic_fetch_or:
+case AtomicExpr::AO__c11_atomic_fetch_sub:
+case AtomicExpr::AO__atomic_fetch_sub:
+case AtomicExpr::AO__c11_atomic_fetch_xor:
+case AtomicExpr::AO__atomic_fetch_xor:
+  // For these, only library calls for certain sizes exist.
+  UseOptimizedLibcall = true;
+  break;
+default:
+  // Only use optimized library calls for sizes for which they exist.
+  if (Size == 1 || Size == 2 || Size == 4 || Size == 8)
+UseOptimizedLibcall = true;
+  break;
+}
 
-SmallVector Params;
 CallArgList Args;
-// Size is always the first parameter
-Args.add(RValue::get(llvm::ConstantInt::get(SizeTy, Size)),
- getContext().getSizeType());
-// Atomic address is always the second parameter
+if (!UseOptimizedLibcall) {
+  // For non-optimized library calls, the size is the first parameter
+  Args.add(RValue::get(llvm::ConstantInt::get(SizeTy, Size)),
+   getContext().getSizeType());
+}
+// Atomic address is the first or second parameter
 Args.add(RValue::get(EmitCastToVoidPtr(Ptr)),
  getContext().VoidPtrTy);
 
-const char* LibCallName;
-QualType RetTy = getContext().VoidTy;
+std::string LibCallName;
+QualType RetTy;
+bool HaveRetTy = false;
 switch (E->getOp()) {
 // There is only one libcall for compare an exchange, because there is no
 // optimisation benefit possible from a libcall version of a weak compare
 // and exchange.
-// bool __atomic_compare_exchange(size_t size, void *obj, void *expected,
+// bool __atomic_compare_exchange(size_t size, void *mem, void *expected,
 //void *desired, int success, int failure)
+// bool __atomic_compare_exchange_N(T *mem, T *expected, T desired,
+//  int success, int failure)
 case AtomicExpr::AO__c11_atomic_compare_exchange_weak:
 case AtomicExpr::AO__c11_atomic_compare_exchange_strong:
 case AtomicExpr::AO