Re: svn commit: r287217 - head/usr.sbin/syslogd

2015-08-29 Thread Bruce Evans

On Fri, 28 Aug 2015, Joerg Sonnenberger wrote:


On Fri, Aug 28, 2015 at 10:17:56PM +1000, Bruce Evans wrote:

-static voiddie(int);
+static voiddie(int) __dead2;


Since the function is static, it is very easy for the compiler to see
that it doesn't return.


But the compiler can't tell if it is the *intention* that the function
never returns. The warning behavior exists because that can easily
change with macros etc.


The compiler should trust the programmer to write correct functions.


Even gcc-4.2.1 does this by default, since
-O implies -funit-at-a-time for gcc-4.2.1.  For clang, there is no way
to prevent this (except possibly -O0) since, since -fno-unit-at-a-time
is broken in clang.


It is not broken. It is loadly ignored as unsupported. The very
existance of the option in GCC has always been a concession to broken
and badly written code, including of course GCC's own CRT.


Unsupported == incompatible == broken.

My use of this option can probably be reduced to -fno-toplevel-reorder,
but that is even more broken in clang (it and -ftoplevel-reorder are
"unknown arguments", while -fno-unit-at-a-time is an "unsupported
optimization", and -funit-at-a-time works).

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


svn commit: r287300 - head/lib/libc/gen

2015-08-29 Thread Konstantin Belousov
Author: kib
Date: Sun Aug 30 04:46:44 2015
New Revision: 287300
URL: https://svnweb.freebsd.org/changeset/base/287300

Log:
  Fix a mistake in r287292.  Despite correctly stating intent in the
  comment above, POSIX_SPAWN_SETSIGMASK and POSIX_SPAWN_SETSIGDEF
  handlers used libthr interposed functions instead of syscalls.
  
  Noted by: jilles
  Sponsored by: The FreeBSD Foundation
  MFC after:6 days

Modified:
  head/lib/libc/gen/posix_spawn.c

Modified: head/lib/libc/gen/posix_spawn.c
==
--- head/lib/libc/gen/posix_spawn.c Sun Aug 30 01:39:59 2015
(r287299)
+++ head/lib/libc/gen/posix_spawn.c Sun Aug 30 04:46:44 2015
(r287300)
@@ -123,13 +123,13 @@ process_spawnattr(const posix_spawnattr_
 * Use unwrapped syscall, libthr is in undefined state after vfork().
 */
if (sa->sa_flags & POSIX_SPAWN_SETSIGMASK) {
-   __libc_sigprocmask(SIG_SETMASK, &sa->sa_sigmask, NULL);
+   __sys_sigprocmask(SIG_SETMASK, &sa->sa_sigmask, NULL);
}
 
if (sa->sa_flags & POSIX_SPAWN_SETSIGDEF) {
for (i = 1; i <= _SIG_MAXSIG; i++) {
if (sigismember(&sa->sa_sigdefault, i))
-   if (__libc_sigaction(i, &sigact, NULL) != 0)
+   if (__sys_sigaction(i, &sigact, NULL) != 0)
return (errno);
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287299 - head/sys/boot/efi/loader/arch/amd64

2015-08-29 Thread Marcel Moolenaar
Author: marcel
Date: Sun Aug 30 01:39:59 2015
New Revision: 287299
URL: https://svnweb.freebsd.org/changeset/base/287299

Log:
  Add a gop command to help diagnose VT efifb problems. The gop
  command has the following sub-commands:
list- list all possible modes (paged)
get - return the current mode
set   - set the current mode to 

Modified:
  head/sys/boot/efi/loader/arch/amd64/framebuffer.c

Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c
==
--- head/sys/boot/efi/loader/arch/amd64/framebuffer.c   Sat Aug 29 20:41:09 
2015(r287298)
+++ head/sys/boot/efi/loader/arch/amd64/framebuffer.c   Sun Aug 30 01:39:59 
2015(r287299)
@@ -29,6 +29,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
 
 #include 
@@ -83,3 +84,97 @@ efi_find_framebuffer(struct efi_fb *efif
}
return (0);
 }
+
+COMMAND_SET(gop, "gop", "graphics output protocol", command_gop);
+
+static void
+command_gop_display(u_int mode, EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info)
+{
+
+   printf("mode %u: %ux%u, stride=%u, color=", mode,
+   info->HorizontalResolution, info->VerticalResolution,
+   info->PixelsPerScanLine);
+   switch (info->PixelFormat) {
+   case PixelRedGreenBlueReserved8BitPerColor:
+   printf("32-bit (RGB)");
+   break;
+   case PixelBlueGreenRedReserved8BitPerColor:
+   printf("32-bit (BGR)");
+   break;
+   case PixelBitMask:
+   printf("mask (R=%x, G=%x, B=%x, X=%x)",
+   info->PixelInformation.RedMask,
+   info->PixelInformation.GreenMask,
+   info->PixelInformation.BlueMask,
+   info->PixelInformation.ReservedMask);
+   break;
+   case PixelBltOnly:
+   printf("unsupported (blt only)");
+   break;
+   default:
+   printf("unsupported (unknown)");
+   break;
+   }
+}
+
+static int
+command_gop(int argc, char *argv[])
+{
+   EFI_GRAPHICS_OUTPUT *gop;
+   EFI_STATUS status;
+   u_int mode;
+
+   status = BS->LocateProtocol(&gop_guid, NULL, (VOID **)&gop);
+   if (EFI_ERROR(status)) {
+   sprintf(command_errbuf, "%s: Graphics Output Protocol not "
+   "present (error=%lu)", argv[0], status & ~EFI_ERROR_MASK);
+   return (CMD_ERROR);
+   }
+
+   if (argc == 1)
+   goto usage;
+
+   if (!strcmp(argv[1], "set")) {
+   char *cp;
+
+   if (argc != 3)
+   goto usage;
+   mode = strtol(argv[2], &cp, 0);
+   if (cp[0] != '\0') {
+   sprintf(command_errbuf, "mode is an integer");
+   return (CMD_ERROR);
+   }
+   status = gop->SetMode(gop, mode);
+   if (EFI_ERROR(status)) {
+   sprintf(command_errbuf, "%s: Unable to set mode to "
+   "%u (error=%lu)", argv[0], mode,
+   status & ~EFI_ERROR_MASK);
+   return (CMD_ERROR);
+   }
+   } else if (!strcmp(argv[1], "get")) {
+   command_gop_display(gop->Mode->Mode, gop->Mode->Info);
+   printf("\nframe buffer: address=%jx, size=%lx\n",
+   (uintmax_t)gop->Mode->FrameBufferBase,
+   gop->Mode->FrameBufferSize);
+   } else if (!strcmp(argv[1], "list")) {
+   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
+   UINTN infosz;
+
+   pager_open();
+   for (mode = 0; mode < gop->Mode->MaxMode; mode++) {
+   status = gop->QueryMode(gop, mode, &infosz, &info);
+   if (EFI_ERROR(status))
+   continue;
+   command_gop_display(mode, info);
+   if (pager_output("\n"))
+   break;
+   }
+   pager_close();
+   }
+   return (CMD_OK);
+
+ usage:
+   sprintf(command_errbuf, "usage: %s [list | get | set ]",
+   argv[0]);
+   return (CMD_ERROR);
+}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287298 - stable/10/lib/libc/gen

2015-08-29 Thread Jilles Tjoelker
Author: jilles
Date: Sat Aug 29 20:41:09 2015
New Revision: 287298
URL: https://svnweb.freebsd.org/changeset/base/287298

Log:
  MFC r279084,280713: setmode(): Use sysctl kern.proc.umask instead of umask()
  if possible.
  
  The kern.proc.umask. sysctl allows querying the umask without
  temporarily modifying it.
  
  r280713 is the actual change, while r279084 is a whitespace change.

Modified:
  stable/10/lib/libc/gen/setmode.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/gen/setmode.c
==
--- stable/10/lib/libc/gen/setmode.cSat Aug 29 19:47:20 2015
(r287297)
+++ stable/10/lib/libc/gen/setmode.cSat Aug 29 20:41:09 2015
(r287298)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include "namespace.h"
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -68,6 +69,7 @@ typedef struct bitcmd {
 #defineCMD2_OBITS  0x08
 #defineCMD2_UBITS  0x10
 
+static mode_t   getumask(void);
 static BITCMD  *addcmd(BITCMD *, mode_t, mode_t, mode_t, mode_t);
 static void compress_mode(BITCMD *);
 #ifdef SETMODE_DEBUG
@@ -169,7 +171,6 @@ setmode(const char *p)
int serrno;
char op, *ep;
BITCMD *set, *saveset, *endset;
-   sigset_t sigset, sigoset;
mode_t mask, perm, permXbits, who;
long perml;
int equalopdone;
@@ -182,15 +183,9 @@ setmode(const char *p)
 
/*
 * Get a copy of the mask for the permissions that are mask relative.
-* Flip the bits, we want what's not set.  Since it's possible that
-* the caller is opening files inside a signal handler, protect them
-* as best we can.
+* Flip the bits, we want what's not set.
 */
-   sigfillset(&sigset);
-(void)_sigprocmask(SIG_BLOCK, &sigset, &sigoset);
-   (void)umask(mask = umask(0));
-   mask = ~mask;
-(void)_sigprocmask(SIG_SETMASK, &sigoset, NULL);
+   mask = ~getumask();
 
setlen = SET_LEN + 2;
 
@@ -346,6 +341,35 @@ out:
return NULL;
 }
 
+static mode_t
+getumask(void)
+{
+   sigset_t sigset, sigoset;
+   size_t len;
+   mode_t mask;
+   u_short smask;
+
+   /*
+* First try requesting the umask without temporarily modifying it.
+* Note that this does not work if the sysctl
+* security.bsd.unprivileged_proc_debug is set to 0.
+*/
+   len = sizeof(smask);
+   if (sysctl((int[4]){ CTL_KERN, KERN_PROC, KERN_PROC_UMASK, getpid() },
+   4, &smask, &len, NULL, 0) == 0)
+   return (smask);
+
+   /*
+* Since it's possible that the caller is opening files inside a signal
+* handler, protect them as best we can.
+*/
+   sigfillset(&sigset);
+   (void)_sigprocmask(SIG_BLOCK, &sigset, &sigoset);
+   (void)umask(mask = umask(0));
+   (void)_sigprocmask(SIG_SETMASK, &sigoset, NULL);
+   return (mask);
+}
+
 static BITCMD *
 addcmd(BITCMD *set, mode_t op, mode_t who, mode_t oparg, mode_t mask)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287297 - in head/tools: regression/lib/msun regression/p1003_1b tools/ath/athaggrstats tools/ath/athdebug tools/ath/athrd tools/ath/athstats tools/ath/common tools/crypto tools/cxgbeto...

2015-08-29 Thread Craig Rodrigues
Author: rodrigc
Date: Sat Aug 29 19:47:20 2015
New Revision: 287297
URL: https://svnweb.freebsd.org/changeset/base/287297

Log:
  - Replace N(a)/N(i)/N(T)/LEN(a)/ARRAY_SIZE(a) with nitems()
  - Add missing  for err() and  for sysctlbyname()
  - NULL -> 0 for 5th parameter of sysctlbyname()
  
  Submitted by: Andriy Voskoboinyk 
  Differential Revision: https://reviews.freebsd.org/D3442

Modified:
  head/tools/regression/lib/msun/test-cexp.c
  head/tools/regression/lib/msun/test-csqrt.c
  head/tools/regression/lib/msun/test-invtrig.c
  head/tools/regression/lib/msun/test-trig.c
  head/tools/regression/p1003_1b/main.c
  head/tools/tools/ath/athaggrstats/athaggrstats.c
  head/tools/tools/ath/athaggrstats/main.c
  head/tools/tools/ath/athdebug/athdebug.c
  head/tools/tools/ath/athrd/athrd.c
  head/tools/tools/ath/athstats/athstats.c
  head/tools/tools/ath/athstats/main.c
  head/tools/tools/ath/common/ah_osdep.h
  head/tools/tools/ath/common/dumpregs_5210.c
  head/tools/tools/ath/common/dumpregs_5211.c
  head/tools/tools/ath/common/dumpregs_5212.c
  head/tools/tools/ath/common/dumpregs_5416.c
  head/tools/tools/crypto/cryptostats.c
  head/tools/tools/crypto/cryptotest.c
  head/tools/tools/crypto/hifnstats.c
  head/tools/tools/crypto/ipsecstats.c
  head/tools/tools/crypto/safestats.c
  head/tools/tools/crypto/ubsecstats.c
  head/tools/tools/cxgbetool/cxgbetool.c
  head/tools/tools/mwl/mwldebug/mwldebug.c
  head/tools/tools/mwl/mwlstats/mwlstats.c
  head/tools/tools/net80211/wlanstats/main.c
  head/tools/tools/net80211/wlanstats/wlanstats.c
  head/tools/tools/net80211/wlantxtime/wlantxtime.c
  head/tools/tools/npe/npestats/main.c
  head/tools/tools/npe/npestats/npestats.c

Modified: head/tools/regression/lib/msun/test-cexp.c
==
--- head/tools/regression/lib/msun/test-cexp.c  Sat Aug 29 19:41:47 2015
(r287296)
+++ head/tools/regression/lib/msun/test-cexp.c  Sat Aug 29 19:47:20 2015
(r287297)
@@ -31,6 +31,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 #include 
 #include 
 #include 
@@ -40,8 +42,6 @@ __FBSDID("$FreeBSD$");
 
 #include "test-utils.h"
 
-#defineN(i)(sizeof(i) / sizeof((i)[0]))
-
 #pragma STDC FENV_ACCESS   ON
 #pragmaSTDC CX_LIMITED_RANGE   OFF
 
@@ -116,7 +116,7 @@ test_nan()
 
/* cexp(x + NaNi) = NaN + NaNi and optionally raises invalid */
/* cexp(NaN + yi) = NaN + NaNi and optionally raises invalid (|y|>0) */
-   for (i = 0; i < N(finites); i++) {
+   for (i = 0; i < nitems(finites); i++) {
printf("# Run %d..\n", i);
testall(CMPLXL(finites[i], NAN), CMPLXL(NAN, NAN),
ALL_STD_EXCEPT & ~FE_INVALID, 0, 0);
@@ -148,7 +148,7 @@ test_inf(void)
int i;
 
/* cexp(x + inf i) = NaN + NaNi and raises invalid */
-   for (i = 0; i < N(finites); i++) {
+   for (i = 0; i < nitems(finites); i++) {
printf("# Run %d..\n", i);
testall(CMPLXL(finites[i], INFINITY), CMPLXL(NAN, NAN),
ALL_STD_EXCEPT, FE_INVALID, 1);
@@ -189,7 +189,7 @@ test_reals(void)
 {
int i;
 
-   for (i = 0; i < N(finites); i++) {
+   for (i = 0; i < nitems(finites); i++) {
/* XXX could check exceptions more meticulously */
printf("# Run %d..\n", i);
test(cexp, CMPLXL(finites[i], 0.0),
@@ -212,7 +212,7 @@ test_imaginaries(void)
 {
int i;
 
-   for (i = 0; i < N(finites); i++) {
+   for (i = 0; i < nitems(finites); i++) {
printf("# Run %d..\n", i);
test(cexp, CMPLXL(0.0, finites[i]),
 CMPLXL(cos(finites[i]), sin(finites[i])),
@@ -244,7 +244,7 @@ test_small(void)
double x, y;
int i;
 
-   for (i = 0; i < N(tests); i += 4) {
+   for (i = 0; i < nitems(tests); i += 4) {
printf("# Run %d..\n", i);
a = tests[i];
b = tests[i + 1];

Modified: head/tools/regression/lib/msun/test-csqrt.c
==
--- head/tools/regression/lib/msun/test-csqrt.c Sat Aug 29 19:41:47 2015
(r287296)
+++ head/tools/regression/lib/msun/test-csqrt.c Sat Aug 29 19:47:20 2015
(r287297)
@@ -31,6 +31,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 #include 
 #include 
 #include 
@@ -39,8 +41,6 @@ __FBSDID("$FreeBSD$");
 
 #include "test-utils.h"
 
-#defineN(i)(sizeof(i) / sizeof((i)[0]))
-
 /*
  * This is a test hook that can point to csqrtl(), _csqrt(), or to _csqrtf().
  * The latter two convert to float or double, respectively, and test csqrtf()
@@ -127,8 +127,8 @@ test_finite()
double x, y;
int i, j;
 
-   for (i = 0; i < N(tests); i += 4) {
-   for (j = 0; j < N(mults); j++) {
+   for (i = 0; i < nitems(tests); i += 4) {
+   for (j = 0; j < nitems(mul

svn commit: r287296 - head/bin/sh

2015-08-29 Thread Jilles Tjoelker
Author: jilles
Date: Sat Aug 29 19:41:47 2015
New Revision: 287296
URL: https://svnweb.freebsd.org/changeset/base/287296

Log:
  sh: Add set -o nolog.
  
  POSIX requires this to prevent entering function definitions in history but
  this implementation does nothing except retain the option's value. In ksh88,
  function definitions were usually entered in the history file, even when
  they came from ~/.profile and the $ENV file, to allow displaying their
  definitions.
  
  This is also the first option that does not have a letter.

Modified:
  head/bin/sh/expand.c
  head/bin/sh/options.c
  head/bin/sh/options.h
  head/bin/sh/sh.1

Modified: head/bin/sh/expand.c
==
--- head/bin/sh/expand.cSat Aug 29 18:37:09 2015(r287295)
+++ head/bin/sh/expand.cSat Aug 29 19:41:47 2015(r287296)
@@ -886,7 +886,7 @@ varvalue(const char *name, int quoted, i
num = backgndpidval();
break;
case '-':
-   for (i = 0 ; i < NOPTS ; i++) {
+   for (i = 0 ; i < NSHORTOPTS ; i++) {
if (optlist[i].val)
STPUTC(optlist[i].letter, expdest);
}

Modified: head/bin/sh/options.c
==
--- head/bin/sh/options.c   Sat Aug 29 18:37:09 2015(r287295)
+++ head/bin/sh/options.c   Sat Aug 29 19:41:47 2015(r287296)
@@ -302,7 +302,7 @@ setoption(int flag, int val)
 {
int i;
 
-   for (i = 0; i < NOPTS; i++)
+   for (i = 0; i < NSHORTOPTS; i++)
if (optlist[i].letter == flag) {
setoptionbyindex(i, val);
return;

Modified: head/bin/sh/options.h
==
--- head/bin/sh/options.h   Sat Aug 29 18:37:09 2015(r287295)
+++ head/bin/sh/options.h   Sat Aug 29 19:41:47 2015(r287296)
@@ -64,8 +64,10 @@ struct shparam {
 #defineTflag optlist[16].val
 #definePflag optlist[17].val
 #definehflag optlist[18].val
+#definenologflag optlist[19].val
 
-#define NOPTS  19
+#define NSHORTOPTS 19
+#define NOPTS  20
 
 struct optent {
const char *name;
@@ -95,6 +97,7 @@ struct optent optlist[NOPTS] = {
{ "trapsasync", 'T',0 },
{ "physical",   'P',0 },
{ "trackall",   'h',0 },
+   { "nolog",  '\0',   0 },
 };
 #endif
 

Modified: head/bin/sh/sh.1
==
--- head/bin/sh/sh.1Sat Aug 29 18:37:09 2015(r287295)
+++ head/bin/sh/sh.1Sat Aug 29 19:41:47 2015(r287296)
@@ -32,7 +32,7 @@
 .\"from: @(#)sh.1  8.6 (Berkeley) 5/4/95
 .\" $FreeBSD$
 .\"
-.Dd July 11, 2015
+.Dd August 29, 2015
 .Dt SH 1
 .Os
 .Sh NAME
@@ -343,6 +343,11 @@ Write each command
 variable subjected to parameter expansion and arithmetic expansion)
 to standard error before it is executed.
 Useful for debugging.
+.It nolog
+Another do-nothing option for
+.Tn POSIX
+compliance.
+It only has a long name.
 .El
 .Pp
 The
@@ -1173,7 +1178,9 @@ The only special parameter that can be m
 .Ql - .
 Making
 .Ql -
-local causes any shell options that are
+local causes any shell options
+(including those that only have long names)
+that are
 changed via the
 .Ic set
 command inside the function to be
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287295 - in head/sys/dev/usb: . serial

2015-08-29 Thread Gavin Atkinson
Author: gavin
Date: Sat Aug 29 18:37:09 2015
New Revision: 287295
URL: https://svnweb.freebsd.org/changeset/base/287295

Log:
  Support the ZTE MF112 HSUPA 3G USB stick.
  
  MFC after:1 week

Modified:
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/u3g.c
==
--- head/sys/dev/usb/serial/u3g.c   Sat Aug 29 17:26:29 2015
(r287294)
+++ head/sys/dev/usb/serial/u3g.c   Sat Aug 29 18:37:09 2015
(r287295)
@@ -477,6 +477,7 @@ static const STRUCT_USB_HOST_ID u3g_devs
U3G_DEV(QUALCOMMINC, E2003, 0),
U3G_DEV(QUALCOMMINC, K3772_Z, 0),
U3G_DEV(QUALCOMMINC, K3772_Z_INIT, U3GINIT_SCSIEJECT),
+   U3G_DEV(QUALCOMMINC, MF112, U3GINIT_ZTESTOR),
U3G_DEV(QUALCOMMINC, MF195E, 0),
U3G_DEV(QUALCOMMINC, MF195E_INIT, U3GINIT_SCSIEJECT),
U3G_DEV(QUALCOMMINC, MF626, 0),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsSat Aug 29 17:26:29 2015(r287294)
+++ head/sys/dev/usb/usbdevsSat Aug 29 18:37:09 2015(r287295)
@@ -3683,6 +3683,7 @@ product QUALCOMMINC E0076 0x0076  3G mode
 product QUALCOMMINC E0078  0x0078  3G modem
 product QUALCOMMINC E0082  0x0082  3G modem
 product QUALCOMMINC E0086  0x0086  3G modem
+product QUALCOMMINC MF112  0x0103  3G modem
 product QUALCOMMINC SURFSTICK  0x0117  1&1 Surf Stick
 product QUALCOMMINC K3772_Z_INIT   0x1179  K3772-Z Initial
 product QUALCOMMINC K3772_Z0x1181  K3772-Z
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287294 - head/sys/netinet

2015-08-29 Thread Michael Tuexen
Author: tuexen
Date: Sat Aug 29 17:26:29 2015
New Revision: 287294
URL: https://svnweb.freebsd.org/changeset/base/287294

Log:
  Use 5 times RTO.Max as the default for the shutdown guard timer
  as required by RFC 4960. The sysctl variable can be used to
  overwrite this.
  
  Discussed with:   rrs
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_sysctl.h
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_constants.h
==
--- head/sys/netinet/sctp_constants.h   Sat Aug 29 15:33:31 2015
(r287293)
+++ head/sys/netinet/sctp_constants.h   Sat Aug 29 17:26:29 2015
(r287294)
@@ -612,10 +612,6 @@ __FBSDID("$FreeBSD$");
 /* 30 seconds + RTO (in ms) */
 #define SCTP_HB_DEFAULT_MSEC   3
 
-/* Max time I will wait for Shutdown to complete */
-#define SCTP_DEF_MAX_SHUTDOWN_SEC 180
-
-
 /*
  * This is how long a secret lives, NOT how long a cookie lives how many
  * ticks the current secret will live.

Modified: head/sys/netinet/sctp_sysctl.h
==
--- head/sys/netinet/sctp_sysctl.h  Sat Aug 29 15:33:31 2015
(r287293)
+++ head/sys/netinet/sctp_sysctl.h  Sat Aug 29 17:26:29 2015
(r287294)
@@ -291,10 +291,10 @@ struct sctp_sysctl {
 #define SCTPCTL_PMTU_RAISE_TIME_DEFAULTSCTP_DEF_PMTU_RAISE_SEC
 
 /* shutdown_guard_time: Default shutdown guard timer in seconds */
-#define SCTPCTL_SHUTDOWN_GUARD_TIME_DESC   "Default shutdown guard timer 
in seconds"
+#define SCTPCTL_SHUTDOWN_GUARD_TIME_DESC   "Shutdown guard timer in 
seconds (0 means 5 times RTO.Max)"
 #define SCTPCTL_SHUTDOWN_GUARD_TIME_MIN0
 #define SCTPCTL_SHUTDOWN_GUARD_TIME_MAX0x
-#define SCTPCTL_SHUTDOWN_GUARD_TIME_DEFAULTSCTP_DEF_MAX_SHUTDOWN_SEC
+#define SCTPCTL_SHUTDOWN_GUARD_TIME_DEFAULT0
 
 /* secret_lifetime: Default secret lifetime in seconds */
 #define SCTPCTL_SECRET_LIFETIME_DESC   "Default secret lifetime in seconds"

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Sat Aug 29 15:33:31 2015(r287293)
+++ head/sys/netinet/sctputil.c Sat Aug 29 17:26:29 2015(r287294)
@@ -2123,7 +2123,11 @@ sctp_timer_start(int t_type, struct sctp
if (stcb == NULL) {
return;
}
-   to_ticks = 
inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_MAXSHUTDOWN];
+   if (inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_MAXSHUTDOWN] == 
0) {
+   to_ticks = 5 * MSEC_TO_TICKS(stcb->asoc.maxrto);
+   } else {
+   to_ticks = 
inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_MAXSHUTDOWN];
+   }
tmr = &stcb->asoc.shut_guard_timer;
break;
case SCTP_TIMER_TYPE_STRRESET:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287293 - head/sys/cam/ctl

2015-08-29 Thread Alexander Motin
Author: mav
Date: Sat Aug 29 15:33:31 2015
New Revision: 287293
URL: https://svnweb.freebsd.org/changeset/base/287293

Log:
  Remove 600 bytes of port_priv from struct ctl_io_hdr.
  
  This field used only for camtgt frontend, and once it any way preallocates
  all requests, let it preallocate this memory too, not bothering core code.

Modified:
  head/sys/cam/ctl/ctl_io.h
  head/sys/cam/ctl/scsi_ctl.c

Modified: head/sys/cam/ctl/ctl_io.h
==
--- head/sys/cam/ctl/ctl_io.h   Sat Aug 29 14:25:01 2015(r287292)
+++ head/sys/cam/ctl/ctl_io.h   Sat Aug 29 15:33:31 2015(r287293)
@@ -173,35 +173,11 @@ union ctl_priv {
 #defineCTL_PRIV_MODEPAGE   1   /* Modepage info for config 
write */
 #defineCTL_PRIV_BACKEND2   /* Reserved for block, RAIDCore 
*/
 #defineCTL_PRIV_BACKEND_LUN3   /* Backend LUN pointer */
-#defineCTL_PRIV_FRONTEND   4   /* LSI driver, ioctl front end 
*/
-#defineCTL_PRIV_USER   5   /* Userland use */
+#defineCTL_PRIV_FRONTEND   4   /* Frontend storage */
+#defineCTL_PRIV_FRONTEND2  5   /* Another frontend storage */
 
 #define CTL_INVALID_PORTNAME 0xFF
 #define CTL_UNMAPPED_IID 0xFF
-/*
- * XXX KDM this size is for the port_priv variable in struct ctl_io_hdr
- * below.  This should be defined in terms of the size of struct
- * ctlfe_lun_cmd_info at the moment:
- * struct ctlfe_lun_cmd_info {
- * int cur_transfer_index;
- * ctlfe_cmd_flags flags;
- * bus_dma_segment_t cam_sglist[32];
- * };
- *
- * This isn't really the way I'd prefer to do it, but it does make some
- * sense, AS LONG AS we can guarantee that there will always only be one
- * outstanding DMA request per ctl_io.  If that assumption isn't valid,
- * then we've got problems.
- *
- * At some point it may be nice switch CTL over to using CCBs for
- * everything.  At that point we can probably use the ATIO/CTIO model, so
- * that multiple simultaneous DMAs per command will just work.
- *
- * Also note that the current size, 600, is appropriate for 64-bit
- * architectures, but is overkill for 32-bit architectures.  Need a way to
- * figure out the size at compile time, or just get rid of this altogether.
- */
-#defineCTL_PORT_PRIV_SIZE  600
 
 struct ctl_sg_entry {
void*addr;
@@ -268,7 +244,6 @@ struct ctl_io_hdr {
union ctl_io  *serializing_sc;
void  *pool;/* I/O pool */
union ctl_privctl_private[CTL_NUM_PRIV];/* CTL private area */
-   uint8_t   port_priv[CTL_PORT_PRIV_SIZE];/* PORT private area*/
struct ctl_sg_entry remote_sglist[CTL_NUM_SG_ENTRIES];
struct ctl_sg_entry remote_dma_sglist[CTL_NUM_SG_ENTRIES];
struct ctl_sg_entry local_sglist[CTL_NUM_SG_ENTRIES];

Modified: head/sys/cam/ctl/scsi_ctl.c
==
--- head/sys/cam/ctl/scsi_ctl.c Sat Aug 29 14:25:01 2015(r287292)
+++ head/sys/cam/ctl/scsi_ctl.c Sat Aug 29 15:33:31 2015(r287293)
@@ -119,11 +119,7 @@ typedef enum {
CTLFE_CMD_PIECEWISE = 0x01
 } ctlfe_cmd_flags;
 
-/*
- * The size limit of this structure is CTL_PORT_PRIV_SIZE, from ctl_io.h.
- * Currently that is 600 bytes.
- */
-struct ctlfe_lun_cmd_info {
+struct ctlfe_cmd_info {
int cur_transfer_index;
size_t cur_transfer_off;
ctlfe_cmd_flags flags;
@@ -135,7 +131,6 @@ struct ctlfe_lun_cmd_info {
 #define CTLFE_MAX_SEGS 32
bus_dma_segment_t cam_sglist[CTLFE_MAX_SEGS];
 };
-CTASSERT(sizeof(struct ctlfe_lun_cmd_info) <= CTL_PORT_PRIV_SIZE);
 
 /*
  * When we register the adapter/bus, request that this many ctl_ios be
@@ -533,6 +528,7 @@ ctlferegister(struct cam_periph *periph,
for (i = 0; i < CTLFE_ATIO_PER_LUN; i++) {
union ccb *new_ccb;
union ctl_io *new_io;
+   struct ctlfe_cmd_info *cmd_info;
 
new_ccb = (union ccb *)malloc(sizeof(*new_ccb), M_CTLFE,
  M_ZERO|M_NOWAIT);
@@ -546,6 +542,15 @@ ctlferegister(struct cam_periph *periph,
status = CAM_RESRC_UNAVAIL;
break;
}
+   cmd_info = malloc(sizeof(*cmd_info), M_CTLFE,
+   M_ZERO | M_NOWAIT);
+   if (cmd_info == NULL) {
+   ctl_free_io(new_io);
+   free(new_ccb, M_CTLFE);
+   status = CAM_RESRC_UNAVAIL;
+   break;
+   }
+   new_io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr = cmd_info;
softc->atios_alloced++;
new_ccb->ccb_h.io_ptr = new_io;
 
@@ -556,6 +561,7 @@ ctlferegister(struct cam_periph *periph,
xpt_action(new_ccb);
status = new_cc

svn commit: r287292 - in head/lib/libc: amd64/gen compat-43 db/btree db/hash gen i386/gen include net stdio stdlib sys

2015-08-29 Thread Konstantin Belousov
Author: kib
Date: Sat Aug 29 14:25:01 2015
New Revision: 287292
URL: https://svnweb.freebsd.org/changeset/base/287292

Log:
  Switch libc from using _sig{procmask,action,suspend} symbols, which
  are aliases for the syscall stubs and are plt-interposed, to the
  libc-private aliases of internally interposed sigprocmask() etc.
  
  Since e.g. _sigaction is not interposed by libthr, calling signal()
  removes thr_sighandler() from the handler slot etc.  The result was
  breaking signal semantic and rtld locking.
  
  The added __libc_sigprocmask and other symbols are hidden, they are
  not exported and cannot be called through PLT.  The setjmp/longjmp
  functions for x86 were changed to use direct calls, and since
  PIC_PROLOGUE only needed for functional PLT indirection on i386, it is
  removed as well.
  
  The PowerPC bug of calling the syscall directly in the setjmp/longjmp
  implementation is kept as is.
  
  Reported by:  Pete French 
  Tested by:Michiel Boland 
  Reviewed by:  jilles (previous version)
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/lib/libc/amd64/gen/setjmp.S
  head/lib/libc/amd64/gen/sigsetjmp.S
  head/lib/libc/compat-43/sigcompat.c
  head/lib/libc/db/btree/bt_open.c
  head/lib/libc/db/hash/hash_page.c
  head/lib/libc/gen/daemon.c
  head/lib/libc/gen/posix_spawn.c
  head/lib/libc/gen/readpassphrase.c
  head/lib/libc/gen/setmode.c
  head/lib/libc/gen/siginterrupt.c
  head/lib/libc/gen/signal.c
  head/lib/libc/gen/wordexp.c
  head/lib/libc/i386/gen/setjmp.S
  head/lib/libc/i386/gen/sigsetjmp.S
  head/lib/libc/include/libc_private.h
  head/lib/libc/net/rcmd.c
  head/lib/libc/stdio/tmpfile.c
  head/lib/libc/stdlib/abort.c
  head/lib/libc/stdlib/system.c
  head/lib/libc/sys/sigaction.c
  head/lib/libc/sys/sigprocmask.c
  head/lib/libc/sys/sigsuspend.c

Modified: head/lib/libc/amd64/gen/setjmp.S
==
--- head/lib/libc/amd64/gen/setjmp.SSat Aug 29 13:44:27 2015
(r287291)
+++ head/lib/libc/amd64/gen/setjmp.SSat Aug 29 14:25:01 2015
(r287292)
@@ -55,7 +55,7 @@ ENTRY(setjmp)
movq$0,%rsi /* (sigset_t*)set  */
leaq72(%rcx),%rdx   /* 9,10; (sigset_t*)oset */
/* stack is 16-byte aligned */
-   callPIC_PLT(CNAME(_sigprocmask))
+   call__libc_sigprocmask
popq%rdi
movq%rdi,%rcx
movq0(%rsp),%rdx/* retval */
@@ -82,7 +82,7 @@ ENTRY(__longjmp)
leaq72(%rdx),%rsi   /* (sigset_t*)set  */
movq$0,%rdx /* (sigset_t*)oset */
subq$0x8,%rsp   /* make the stack 16-byte aligned */
-   callPIC_PLT(CNAME(_sigprocmask))
+   call__libc_sigprocmask
addq$0x8,%rsp
popq%rsi
popq%rdi/* jmpbuf */

Modified: head/lib/libc/amd64/gen/sigsetjmp.S
==
--- head/lib/libc/amd64/gen/sigsetjmp.S Sat Aug 29 13:44:27 2015
(r287291)
+++ head/lib/libc/amd64/gen/sigsetjmp.S Sat Aug 29 14:25:01 2015
(r287292)
@@ -63,7 +63,7 @@ ENTRY(sigsetjmp)
movq$0,%rsi /* (sigset_t*)set  */
leaq72(%rcx),%rdx   /* 9,10 (sigset_t*)oset */
/* stack is 16-byte aligned */
-   callPIC_PLT(CNAME(_sigprocmask))
+   call__libc_sigprocmask
popq%rdi
 2: movq%rdi,%rcx
movq0(%rsp),%rdx/* retval */
@@ -91,7 +91,7 @@ ENTRY(__siglongjmp)
leaq72(%rdx),%rsi   /* (sigset_t*)set  */
movq$0,%rdx /* (sigset_t*)oset */
subq$0x8,%rsp   /* make the stack 16-byte aligned */
-   callPIC_PLT(CNAME(_sigprocmask))
+   call__libc_sigprocmask
addq$0x8,%rsp
popq%rsi
popq%rdi/* jmpbuf */

Modified: head/lib/libc/compat-43/sigcompat.c
==
--- head/lib/libc/compat-43/sigcompat.c Sat Aug 29 13:44:27 2015
(r287291)
+++ head/lib/libc/compat-43/sigcompat.c Sat Aug 29 14:25:01 2015
(r287292)
@@ -59,7 +59,7 @@ sigvec(signo, sv, osv)
} else
sap = NULL;
osap = osv != NULL ? &osa : NULL;
-   ret = _sigaction(signo, sap, osap);
+   ret = __libc_sigaction(signo, sap, osap);
if (ret == 0 && osv != NULL) {
osv->sv_handler = osa.sa_handler;
osv->sv_flags = osa.sa_flags ^ SV_INTERRUPT;
@@ -77,7 +77,7 @@ sigsetmask(mask)
 
sigemptyset(&set);
set.__bits[0] = mask;
-   n = _sigprocmask(SIG_SETMASK, &set, &oset);
+   n = __libc_sigprocmask(SIG_SETMASK, &set, &oset);
if (n)
return (n);
return (oset.__bits[0]);
@@ -92,7 +92,7 @@ sigblock(mask)
 
 

svn commit: r287289 - in head/sys/cam: ata scsi

2015-08-29 Thread Alexander Motin
Author: mav
Date: Sat Aug 29 11:21:20 2015
New Revision: 287289
URL: https://svnweb.freebsd.org/changeset/base/287289

Log:
  Attach pass driver to LUNs is OFFLINE state.
  
  Previously such LUNs were silently ignored.  But while they indeed unable
  to process most of SCSI commands, some, like RTPG, they still can.
  
  MFC after:1 month

Modified:
  head/sys/cam/ata/ata_xpt.c
  head/sys/cam/scsi/scsi_cd.c
  head/sys/cam/scsi/scsi_ch.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/cam/scsi/scsi_pt.c
  head/sys/cam/scsi/scsi_sa.c
  head/sys/cam/scsi/scsi_xpt.c

Modified: head/sys/cam/ata/ata_xpt.c
==
--- head/sys/cam/ata/ata_xpt.c  Sat Aug 29 11:15:58 2015(r287288)
+++ head/sys/cam/ata/ata_xpt.c  Sat Aug 29 11:21:20 2015(r287289)
@@ -1090,7 +1090,8 @@ notsata:
 
periph_qual = SID_QUAL(inq_buf);
 
-   if (periph_qual != SID_QUAL_LU_CONNECTED)
+   if (periph_qual != SID_QUAL_LU_CONNECTED &&
+   periph_qual != SID_QUAL_LU_OFFLINE)
break;
 
/*

Modified: head/sys/cam/scsi/scsi_cd.c
==
--- head/sys/cam/scsi/scsi_cd.c Sat Aug 29 11:15:58 2015(r287288)
+++ head/sys/cam/scsi/scsi_cd.c Sat Aug 29 11:21:20 2015(r287289)
@@ -389,7 +389,8 @@ cdasync(void *callback_arg, u_int32_t co
 
if (cgd->protocol != PROTO_SCSI)
break;
-
+   if (SID_QUAL(&cgd->inq_data) != SID_QUAL_LU_CONNECTED)
+   break;
if (SID_TYPE(&cgd->inq_data) != T_CDROM
&& SID_TYPE(&cgd->inq_data) != T_WORM)
break;

Modified: head/sys/cam/scsi/scsi_ch.c
==
--- head/sys/cam/scsi/scsi_ch.c Sat Aug 29 11:15:58 2015(r287288)
+++ head/sys/cam/scsi/scsi_ch.c Sat Aug 29 11:21:20 2015(r287289)
@@ -337,7 +337,8 @@ chasync(void *callback_arg, u_int32_t co
 
if (cgd->protocol != PROTO_SCSI)
break;
-
+   if (SID_QUAL(&cgd->inq_data) != SID_QUAL_LU_CONNECTED)
+   break;
if (SID_TYPE(&cgd->inq_data)!= T_CHANGER)
break;
 

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Sat Aug 29 11:15:58 2015(r287288)
+++ head/sys/cam/scsi/scsi_da.c Sat Aug 29 11:21:20 2015(r287289)
@@ -1663,7 +1663,8 @@ daasync(void *callback_arg, u_int32_t co
 
if (cgd->protocol != PROTO_SCSI)
break;
-
+   if (SID_QUAL(&cgd->inq_data) != SID_QUAL_LU_CONNECTED)
+   break;
if (SID_TYPE(&cgd->inq_data) != T_DIRECT
&& SID_TYPE(&cgd->inq_data) != T_RBC
&& SID_TYPE(&cgd->inq_data) != T_OPTICAL)

Modified: head/sys/cam/scsi/scsi_pt.c
==
--- head/sys/cam/scsi/scsi_pt.c Sat Aug 29 11:15:58 2015(r287288)
+++ head/sys/cam/scsi/scsi_pt.c Sat Aug 29 11:21:20 2015(r287289)
@@ -366,7 +366,8 @@ ptasync(void *callback_arg, u_int32_t co
 
if (cgd->protocol != PROTO_SCSI)
break;
-
+   if (SID_QUAL(&cgd->inq_data) != SID_QUAL_LU_CONNECTED)
+   break;
if (SID_TYPE(&cgd->inq_data) != T_PROCESSOR)
break;
 

Modified: head/sys/cam/scsi/scsi_sa.c
==
--- head/sys/cam/scsi/scsi_sa.c Sat Aug 29 11:15:58 2015(r287288)
+++ head/sys/cam/scsi/scsi_sa.c Sat Aug 29 11:21:20 2015(r287289)
@@ -2255,7 +2255,8 @@ saasync(void *callback_arg, u_int32_t co
 
if (cgd->protocol != PROTO_SCSI)
break;
-
+   if (SID_QUAL(&cgd->inq_data) != SID_QUAL_LU_CONNECTED)
+   break;
if (SID_TYPE(&cgd->inq_data) != T_SEQUENTIAL)
break;
 

Modified: head/sys/cam/scsi/scsi_xpt.c
==
--- head/sys/cam/scsi/scsi_xpt.cSat Aug 29 11:15:58 2015
(r287288)
+++ head/sys/cam/scsi/scsi_xpt.cSat Aug 29 11:21:20 2015
(r287289)
@@ -1123,6 +1123,7 @@ probedone(struct cam_periph *periph, uni
 {
probe_softc *softc;
struct cam_path *path;
+   struct scsi_inquiry_data *inq_buf;
u_int32_t  priority;
 
CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("probedone\n"));
@@ -1162,7 +1163,6 @@ out:
case PROBE_FULL_INQUIRY:
{
if (cam_ccb_status(done_ccb) == CAM_REQ_C

svn commit: r287288 - stable/9/sys/dev/sound/midi

2015-08-29 Thread Tai-hwa Liang
Author: avatar
Date: Sat Aug 29 11:15:58 2015
New Revision: 287288
URL: https://svnweb.freebsd.org/changeset/base/287288

Log:
  MFC r286886: Fixing typo as well as improving readability of a few comments.

Modified:
  stable/9/sys/dev/sound/midi/midi.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/sound/midi/midi.c
==
--- stable/9/sys/dev/sound/midi/midi.c  Sat Aug 29 11:15:54 2015
(r287287)
+++ stable/9/sys/dev/sound/midi/midi.c  Sat Aug 29 11:15:58 2015
(r287288)
@@ -86,7 +86,7 @@ enum midi_states {
 };
 
 /*
- * The MPU interface current has init() uninit() inqsize(( outqsize()
+ * The MPU interface current has init() uninit() inqsize() outqsize()
  * callback() : fiddle with the tx|rx status.
  */
 
@@ -160,10 +160,15 @@ DEFINE_CLASS(midisynth, midisynth_method
 /*
  * Module Exports & Interface
  *
- * struct midi_chan *midi_init(MPU_CLASS cls, int unit, int chan) int
- * midi_uninit(struct snd_midi *) 0 == no error EBUSY or other error int
- * Midi_in(struct midi_chan *, char *buf, int count) int Midi_out(struct
- * midi_chan *, char *buf, int count)
+ * struct midi_chan *midi_init(MPU_CLASS cls, int unit, int chan,
+ * void *cookie)
+ * int midi_uninit(struct snd_midi *)
+ *
+ * 0 == no error
+ * EBUSY or other error
+ *
+ * int midi_in(struct snd_midi *, char *buf, int count)
+ * int midi_out(struct snd_midi *, char *buf, int count)
  *
  * midi_{in,out} return actual size transfered
  *
@@ -388,7 +393,7 @@ err0:   mtx_unlock(&midistat_lock);
 
 /*
  * midi_uninit does not call MIDI_UNINIT, as since this is the implementors
- * entry point. midi_unint if fact, does not send any methods. A call to
+ * entry point. midi_uninit if fact, does not send any methods. A call to
  * midi_uninit is a defacto promise that you won't manipulate ch anymore
  *
  */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287287 - stable/10/sys/gnu/fs/reiserfs

2015-08-29 Thread Tai-hwa Liang
Author: avatar
Date: Sat Aug 29 11:15:54 2015
New Revision: 287287
URL: https://svnweb.freebsd.org/changeset/base/287287

Log:
  MFC r286888: Using consistent coding style to deal with error inside the loop.

Modified:
  stable/10/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
==
--- stable/10/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Sat Aug 29 10:53:53 
2015(r287286)
+++ stable/10/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Sat Aug 29 11:15:54 
2015(r287287)
@@ -960,8 +960,8 @@ uint32_t find_hash_out(struct reiserfs_m
key.on_disk_key.k_objectid, key.on_disk_key.k_dir_id);
retval = search_by_entry_key(sbi, &key, &path, &de);
if (retval == IO_ERROR) {
-   pathrelse(&path);
-   return (UNSET_HASH);
+   hash = UNSET_HASH;
+   break;
}
if (retval == NAME_NOT_FOUND)
de.de_entry_num--;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287286 - stable/10/sys/cam/ata

2015-08-29 Thread Alexander Motin
Author: mav
Date: Sat Aug 29 10:53:53 2015
New Revision: 287286
URL: https://svnweb.freebsd.org/changeset/base/287286

Log:
  MFC r287025: Remove some code duplication by using biofinish().

Modified:
  stable/10/sys/cam/ata/ata_da.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ata/ata_da.c
==
--- stable/10/sys/cam/ata/ata_da.c  Sat Aug 29 10:52:16 2015
(r287285)
+++ stable/10/sys/cam/ata/ata_da.c  Sat Aug 29 10:53:53 2015
(r287286)
@@ -1535,9 +1535,7 @@ adastart(struct cam_periph *periph, unio
} else {
/* This can happen if DMA was disabled. */
bioq_remove(&softc->trim_queue, bp);
-   bp->bio_error = EOPNOTSUPP;
-   bp->bio_flags |= BIO_ERROR;
-   biodone(bp);
+   biofinish(bp, NULL, EOPNOTSUPP);
xpt_release_ccb(start_ccb);
adaschedule(periph);
return;
@@ -1602,9 +1600,7 @@ adastart(struct cam_periph *periph, unio
}
}
if (fail) {
-   bp->bio_error = EIO;
-   bp->bio_flags |= BIO_ERROR;
-   biodone(bp);
+   biofinish(bp, NULL, EIO);
xpt_release_ccb(start_ccb);
adaschedule(periph);
return;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287285 - stable/10/sys/dev/ata

2015-08-29 Thread Alexander Motin
Author: mav
Date: Sat Aug 29 10:52:16 2015
New Revision: 287285
URL: https://svnweb.freebsd.org/changeset/base/287285

Log:
  MFC r286814, r286816: Remove UMA allocation of ATA requests.
  
  After CAM replaced old ATA stack, this driver processes no more then one
  request at a time per channel.  Using UMA after that is overkill, so
  replace it with simple preallocation of one request per channel.

Modified:
  stable/10/sys/dev/ata/ata-all.c
  stable/10/sys/dev/ata/ata-all.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ata/ata-all.c
==
--- stable/10/sys/dev/ata/ata-all.c Sat Aug 29 09:27:29 2015
(r287284)
+++ stable/10/sys/dev/ata/ata-all.c Sat Aug 29 10:52:16 2015
(r287285)
@@ -64,18 +64,15 @@ static void ata_cam_end_transaction(devi
 static void ata_cam_request_sense(device_t dev, struct ata_request *request);
 static int ata_check_ids(device_t dev, union ccb *ccb);
 static void ata_conn_event(void *context, int dummy);
-static void ata_init(void);
 static void ata_interrupt_locked(void *data);
 static int ata_module_event_handler(module_t mod, int what, void *arg);
 static void ata_periodic_poll(void *data);
 static int ata_str2mode(const char *str);
-static void ata_uninit(void);
 
 /* global vars */
 MALLOC_DEFINE(M_ATA, "ata_generic", "ATA driver generic layer");
 int (*ata_raid_ioctl_func)(u_long cmd, caddr_t data) = NULL;
 devclass_t ata_devclass;
-uma_zone_t ata_request_zone;
 int ata_dma_check_80pin = 1;
 
 /* sysctl vars */
@@ -651,12 +648,7 @@ ata_cam_begin_transaction(device_t dev, 
struct ata_channel *ch = device_get_softc(dev);
struct ata_request *request;
 
-   if (!(request = ata_alloc_request())) {
-   device_printf(dev, "FAILURE - out of memory in start\n");
-   ccb->ccb_h.status = CAM_REQ_INVALID;
-   xpt_done(ccb);
-   return;
-   }
+   request = &ch->request;
bzero(request, sizeof(*request));
 
/* setup request */
@@ -795,7 +787,6 @@ ata_cam_process_sense(device_t dev, stru
ccb->ccb_h.status |= CAM_AUTOSENSE_FAIL;
}
 
-   ata_free_request(request);
xpt_done(ccb);
/* Do error recovery if needed. */
if (fatalerr)
@@ -866,10 +857,8 @@ ata_cam_end_transaction(device_t dev, st
if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR &&
(ccb->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0)
ata_cam_request_sense(dev, request);
-   else {
-   ata_free_request(request);
+   else
xpt_done(ccb);
-   }
/* Do error recovery if needed. */
if (fatalerr)
ata_reinit(dev);
@@ -1149,18 +1138,3 @@ static moduledata_t ata_moduledata = { "
 DECLARE_MODULE(ata, ata_moduledata, SI_SUB_CONFIGURE, SI_ORDER_SECOND);
 MODULE_VERSION(ata, 1);
 MODULE_DEPEND(ata, cam, 1, 1, 1);
-
-static void
-ata_init(void)
-{
-ata_request_zone = uma_zcreate("ata_request", sizeof(struct ata_request),
-  NULL, NULL, NULL, NULL, 0, 0);
-}
-SYSINIT(ata_register, SI_SUB_DRIVERS, SI_ORDER_SECOND, ata_init, NULL);
-
-static void
-ata_uninit(void)
-{
-uma_zdestroy(ata_request_zone);
-}
-SYSUNINIT(ata_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, ata_uninit, NULL);

Modified: stable/10/sys/dev/ata/ata-all.h
==
--- stable/10/sys/dev/ata/ata-all.h Sat Aug 29 09:27:29 2015
(r287284)
+++ stable/10/sys/dev/ata/ata-all.h Sat Aug 29 10:52:16 2015
(r287285)
@@ -450,6 +450,7 @@ struct ata_channel {
struct ata_cam_device   curr[16];   /* Current settings */
int requestsense;   /* CCB waiting for SENSE. */
struct callout  poll_callout;   /* Periodic status poll. */
+   struct ata_request  request;
 };
 
 /* disk bay/enclosure related */
@@ -507,14 +508,6 @@ int ata_sata_getrev(device_t dev, int ta
 int ata_request2fis_h2d(struct ata_request *request, u_int8_t *fis);
 void ata_pm_identify(device_t dev);
 
-/* macros for alloc/free of struct ata_request */
-extern uma_zone_t ata_request_zone;
-#define ata_alloc_request() uma_zalloc(ata_request_zone, M_NOWAIT | M_ZERO)
-#define ata_free_request(request) { \
-   if (!(request->flags & ATA_R_DANGER2)) \
-   uma_zfree(ata_request_zone, request); \
-   }
-
 MALLOC_DECLARE(M_ATA);
 
 /* misc newbus defines */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287284 - head/usr.bin/netstat

2015-08-29 Thread Michael Tuexen
Author: tuexen
Date: Sat Aug 29 09:27:29 2015
New Revision: 287284
URL: https://svnweb.freebsd.org/changeset/base/287284

Log:
  Use the userland exported states and handle them completely.

Modified:
  head/usr.bin/netstat/sctp.c

Modified: head/usr.bin/netstat/sctp.c
==
--- head/usr.bin/netstat/sctp.c Sat Aug 29 09:22:32 2015(r287283)
+++ head/usr.bin/netstat/sctp.c Sat Aug 29 09:27:29 2015(r287284)
@@ -614,25 +614,34 @@ sctp_statesprint(uint32_t state)
int idx;
 
switch (state) {
-   case SCTP_STATE_COOKIE_WAIT:
+   case SCTP_CLOSED:
+   idx = NETSTAT_SCTP_STATES_CLOSED;
+   break;
+   case SCTP_BOUND:
+   idx = NETSTAT_SCTP_STATES_BOUND;
+   break;
+   case SCTP_LISTEN:
+   idx = NETSTAT_SCTP_STATES_LISTEN;
+   break;
+   case SCTP_COOKIE_WAIT:
idx = NETSTAT_SCTP_STATES_COOKIE_WAIT;
break;
-   case SCTP_STATE_COOKIE_ECHOED:
+   case SCTP_COOKIE_ECHOED:
idx = NETSTAT_SCTP_STATES_COOKIE_ECHOED;
break;
-   case SCTP_STATE_OPEN:
+   case SCTP_ESTABLISHED:
idx = NETSTAT_SCTP_STATES_ESTABLISHED;
break;
-   case SCTP_STATE_SHUTDOWN_SENT:
+   case SCTP_SHUTDOWN_SENT:
idx = NETSTAT_SCTP_STATES_SHUTDOWN_SENT;
break;
-   case SCTP_STATE_SHUTDOWN_RECEIVED:
+   case SCTP_SHUTDOWN_RECEIVED:
idx = NETSTAT_SCTP_STATES_SHUTDOWN_RECEIVED;
break;
-   case SCTP_STATE_SHUTDOWN_ACK_SENT:
+   case SCTP_SHUTDOWN_ACK_SENT:
idx = NETSTAT_SCTP_STATES_SHUTDOWN_ACK_SENT;
break;
-   case SCTP_STATE_SHUTDOWN_PENDING:
+   case SCTP_SHUTDOWN_PENDING:
idx = NETSTAT_SCTP_STATES_SHUTDOWN_PENDING;
break;
default:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287283 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2015-08-29 Thread Xin LI
Author: delphij
Date: Sat Aug 29 09:22:32 2015
New Revision: 287283
URL: https://svnweb.freebsd.org/changeset/base/287283

Log:
  Fix a buffer overrun which may lead to data corruption, introduced in
  r286951 by reinstating changes in r274628.
  
  In l2arc_compress_buf(), we allocate a buffer to stash away the compressed
  data in 'cdata', allocated of l2hdr->b_asize bytes.
  
  We then ask zio_compress_data() to compress the buffer, b_l1hdr.b_tmp_cdata,
  which is of l2hdr->b_asize bytes, and have the compressed size (or original
  size, if compress didn't gain enough) stored in csize.
  
  To pad the buffer to fit the optimal write size, we round up the compressed
  size to L2 device's vdev_ashift.
  
  Illumos code rounds up the size by at most SPA_MINBLOCKSIZE.  Because we
  know csize <= b_asize, and b_asize is integer multiple of SPA_MINBLOCKSIZE,
  we are guaranteed that the rounded up csize would be <= b_asize. However,
  this is not necessarily true when we round up to 1 << vdev_ashift, because
  it could be larger than SPA_MINBLOCKSIZE.
  
  So, in the worst case scenario, we are overwriting at most
  
(1 << vdev_ashift - SPA_MINBLOCKSIZE)
  
  bytes of memory next to the compressed data buffer.
  
  Andriy's original change in r274628 reorganized the code a little bit,
  by moving the padding to after we determined that the compression was
  beneficial.  At which point, we would check rounded size against the
  allocated buffer size, and the buffer overrun would not be possible.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Sat Aug 29 
09:14:32 2015(r287282)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Sat Aug 29 
09:22:32 2015(r287283)
@@ -6529,13 +6529,6 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr)
csize = zio_compress_data(ZIO_COMPRESS_LZ4, hdr->b_l1hdr.b_tmp_cdata,
cdata, l2hdr->b_asize);
 
-   rounded = P2ROUNDUP(csize,
-   (size_t)1 << l2hdr->b_dev->l2ad_vdev->vdev_ashift);
-   if (rounded > csize) {
-   bzero((char *)cdata + csize, rounded - csize);
-   csize = rounded;
-   }
-
if (csize == 0) {
/* zero block, indicate that there's nothing to write */
zio_data_buf_free(cdata, len);
@@ -6544,11 +6537,19 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr)
hdr->b_l1hdr.b_tmp_cdata = NULL;
ARCSTAT_BUMP(arcstat_l2_compress_zeros);
return (B_TRUE);
-   } else if (csize > 0 && csize < len) {
+   }
+
+   rounded = P2ROUNDUP(csize,
+   (size_t)1 << l2hdr->b_dev->l2ad_vdev->vdev_ashift);
+   if (rounded < len) {
/*
 * Compression succeeded, we'll keep the cdata around for
 * writing and release it afterwards.
 */
+   if (rounded > csize) {
+   bzero((char *)cdata + csize, rounded - csize);
+   csize = rounded;
+   }
HDR_SET_COMPRESS(hdr, ZIO_COMPRESS_LZ4);
l2hdr->b_asize = csize;
hdr->b_l1hdr.b_tmp_cdata = cdata;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287282 - head/sys/netinet

2015-08-29 Thread Michael Tuexen
Author: tuexen
Date: Sat Aug 29 09:14:32 2015
New Revision: 287282
URL: https://svnweb.freebsd.org/changeset/base/287282

Log:
  Fix the exporting of SCTP association states to userland. Without this,
  associations in SHUTDOWN-PENDING were never reported correctly.
  
  MFC after:3 weeks

Modified:
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctputil.c
  head/sys/netinet/sctputil.h

Modified: head/sys/netinet/sctp_constants.h
==
--- head/sys/netinet/sctp_constants.h   Sat Aug 29 09:10:52 2015
(r287281)
+++ head/sys/netinet/sctp_constants.h   Sat Aug 29 09:14:32 2015
(r287282)
@@ -458,7 +458,7 @@ __FBSDID("$FreeBSD$");
 
 
 /*
- * SCTP states for internal state machine XXX (should match "user" values)
+ * SCTP states for internal state machine
  */
 #define SCTP_STATE_EMPTY   0x
 #define SCTP_STATE_INUSE   0x0001

Modified: head/sys/netinet/sctp_sysctl.c
==
--- head/sys/netinet/sctp_sysctl.c  Sat Aug 29 09:10:52 2015
(r287281)
+++ head/sys/netinet/sctp_sysctl.c  Sat Aug 29 09:14:32 2015
(r287282)
@@ -453,7 +453,7 @@ sctp_sysctl_handle_assoclist(SYSCTL_HAND
if (stcb->asoc.primary_destination != NULL)
xstcb.primary_addr = 
stcb->asoc.primary_destination->ro._l_addr;
xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay;
-   xstcb.state = SCTP_GET_STATE(&stcb->asoc);  /* 
FIXME */
+   xstcb.state = (uint32_t) 
sctp_map_assoc_state(stcb->asoc.state);
/* 7.0 does not support these */
xstcb.assoc_id = sctp_get_associd(stcb);
xstcb.peers_rwnd = stcb->asoc.peers_rwnd;

Modified: head/sys/netinet/sctp_usrreq.c
==
--- head/sys/netinet/sctp_usrreq.c  Sat Aug 29 09:10:52 2015
(r287281)
+++ head/sys/netinet/sctp_usrreq.c  Sat Aug 29 09:14:32 2015
(r287282)
@@ -2668,12 +2668,7 @@ flags_out:
error = EINVAL;
break;
}
-   /*
-* I think passing the state is fine since
-* sctp_constants.h will be available to the user
-* land.
-*/
-   sstat->sstat_state = stcb->asoc.state;
+   sstat->sstat_state = 
sctp_map_assoc_state(stcb->asoc.state);
sstat->sstat_assoc_id = sctp_get_associd(stcb);
sstat->sstat_rwnd = stcb->asoc.peers_rwnd;
sstat->sstat_unackdata = stcb->asoc.sent_queue_cnt;

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Sat Aug 29 09:10:52 2015(r287281)
+++ head/sys/netinet/sctputil.c Sat Aug 29 09:14:32 2015(r287282)
@@ -893,6 +893,49 @@ sctp_select_a_tag(struct sctp_inpcb *inp
return (x);
 }
 
+int32_t
+sctp_map_assoc_state(int kernel_state)
+{
+   int32_t user_state;
+
+   if (kernel_state & SCTP_STATE_WAS_ABORTED) {
+   user_state = SCTP_CLOSED;
+   } else if (kernel_state & SCTP_STATE_SHUTDOWN_PENDING) {
+   user_state = SCTP_SHUTDOWN_PENDING;
+   } else {
+   switch (kernel_state & SCTP_STATE_MASK) {
+   case SCTP_STATE_EMPTY:
+   user_state = SCTP_CLOSED;
+   break;
+   case SCTP_STATE_INUSE:
+   user_state = SCTP_CLOSED;
+   break;
+   case SCTP_STATE_COOKIE_WAIT:
+   user_state = SCTP_COOKIE_WAIT;
+   break;
+   case SCTP_STATE_COOKIE_ECHOED:
+   user_state = SCTP_COOKIE_ECHOED;
+   break;
+   case SCTP_STATE_OPEN:
+   user_state = SCTP_ESTABLISHED;
+   break;
+   case SCTP_STATE_SHUTDOWN_SENT:
+   user_state = SCTP_SHUTDOWN_SENT;
+   break;
+   case SCTP_STATE_SHUTDOWN_RECEIVED:
+   user_state = SCTP_SHUTDOWN_RECEIVED;
+   break;
+   case SCTP_STATE_SHUTDOWN_ACK_SENT:
+   user_state = SCTP_SHUTDOWN_ACK_SENT;
+   break;
+   default:
+   user_state = SCTP_CLOSED;
+   break;
+   }
+   }
+   return (user_state);
+}
+
 int
 sctp_init_asoc(struct sctp_inpcb *inp, str

svn commit: r287281 - head/usr.bin/sockstat

2015-08-29 Thread Michael Tuexen
Author: tuexen
Date: Sat Aug 29 09:10:52 2015
New Revision: 287281
URL: https://svnweb.freebsd.org/changeset/base/287281

Log:
  Report CLOSED as state for bound sockets for consistency with
  netstat and the way TCP is handled.
  
  PR:   201585
  MFC after:3 weeks

Modified:
  head/usr.bin/sockstat/sockstat.c

Modified: head/usr.bin/sockstat/sockstat.c
==
--- head/usr.bin/sockstat/sockstat.cSat Aug 29 08:16:57 2015
(r287280)
+++ head/usr.bin/sockstat/sockstat.cSat Aug 29 09:10:52 2015
(r287281)
@@ -332,10 +332,8 @@ gather_sctp(void)
sock->socket = xinpcb->socket;
sock->proto = IPPROTO_SCTP;
sock->protoname = "sctp";
-   if (xinpcb->flags & SCTP_PCB_FLAGS_UNBOUND)
+   if (xinpcb->maxqlen == 0)
sock->state = SCTP_CLOSED;
-   else if (xinpcb->maxqlen == 0)
-   sock->state = SCTP_BOUND;
else
sock->state = SCTP_LISTEN;
if (xinpcb->flags & SCTP_PCB_FLAGS_BOUND_V6) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287280 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2015-08-29 Thread Xin LI
Author: delphij
Date: Sat Aug 29 08:16:57 2015
New Revision: 287280
URL: https://svnweb.freebsd.org/changeset/base/287280

Log:
  In r286705 (Illumos 5960/a2cdcdd), a separate thread is created with curproc
  as parent.  In the case of a send or receive, the curproc would be the
  userland application that issues the ioctl.  This would trigger an assertion
  failure introduced in Solaris compatibility shims in r196458 when kernel is
  compiled with INVARIANTS.
  
  Fix this by using p0 (proc0 or kernel) as the parent thread when creating
  the kernel threads.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c  Sat Aug 
29 07:59:31 2015(r287279)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c  Sat Aug 
29 08:16:57 2015(r287280)
@@ -786,7 +786,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp,
to_arg.ds = to_ds;
to_arg.fromtxg = fromtxg;
to_arg.flags = TRAVERSE_PRE | TRAVERSE_PREFETCH;
-   (void) thread_create(NULL, 0, send_traverse_thread, &to_arg, 0, curproc,
+   (void) thread_create(NULL, 0, send_traverse_thread, &to_arg, 0, &p0,
TS_RUN, minclsyspri);
 
struct send_block_record *to_data;
@@ -2446,7 +2446,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, 
rwa.os = ra.os;
rwa.byteswap = drc->drc_byteswap;
 
-   (void) thread_create(NULL, 0, receive_writer_thread, &rwa, 0, curproc,
+   (void) thread_create(NULL, 0, receive_writer_thread, &rwa, 0, &p0,
TS_RUN, minclsyspri);
/*
 * We're reading rwa.err without locks, which is safe since we are the
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287279 - head

2015-08-29 Thread Gleb Smirnoff
Author: glebius
Date: Sat Aug 29 07:59:31 2015
New Revision: 287279
URL: https://svnweb.freebsd.org/changeset/base/287279

Log:
  Add reminder to run etcupdate or mergemaster to get updated
  rc.d scripts for wireless.
  
  Poked by: adrian

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Sat Aug 29 07:14:29 2015(r287278)
+++ head/UPDATING   Sat Aug 29 07:59:31 2015(r287279)
@@ -32,6 +32,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
 20150827:
+   The wireless drivers had undergone changes that remove the 'parent
+   interface' from the ifconfig -l output. The rc.d network scripts
+   used to check presence of a parent interface in the list, so old
+   scripts would fail to start wireless networking. Thus, etcupdate(3)
+   or mergemaster(8) run is required after kernel update, to update your
+   rc.d scripts in /etc.
+
+20150827:
pf no longer supports 'scrub fragment crop' or 'scrub fragment drop-ovl'
These configurations are now automatically interpreted as
'scrub fragment reassemble'.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r287236 - head/bin/df

2015-08-29 Thread Garrett Cooper

> On Aug 28, 2015, at 09:00, Allan Jude  wrote:

…

>> Libxo (iirc) doesn't install atexit handlers, which means that you need to 
>> use exit (or a reason facsimile) in order for it to flush its file streams.
>> 
>> This is unintuitive though. I wish it did the right thing as part of 
>> initializing the streams..
> 
> This has nothing to do with libxo. libxo has an optional atexit handler,
> but as long as you call xo_finish(), then everything is flushed and the
> xo handle is closed. xo_finish() is indeed called the line before this
> change.

(Just wanted to clarify/correct what I said earlier :)..)

Yes. Some of the details I was remembering were a bit correct from dealing with 
the bugs with usr.bin/w, but I was also blurred/said some incorrect things (as 
others have pointed out):

- As you said, there’s an optional atexit handler in libxo (xo_finish_atexit).
- xo_finish_atexit and xo_finish both call xo_finish_h with the NULL on r287124.
- xo_finish_h writes out data, flushes its streams via xo_flush_h, then closes 
them out.

exit definitely flushes file descriptors, but it doesn’t do everything that 
xo_finish does (for obvious reasons). This is where the statement I made was 
incorrect. As Warner said later on, exit flushes file descriptors (along with 
_exit/_Exit, with caveats noted in the POSIX spec: 
http://pubs.opengroup.org/onlinepubs/9699919799/functions/_exit.html ).

Thanks :),
-NGie
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287278 - head/sys/netinet6

2015-08-29 Thread Adrian Chadd
Author: adrian
Date: Sat Aug 29 07:14:29 2015
New Revision: 287278
URL: https://svnweb.freebsd.org/changeset/base/287278

Log:
  Implement RSS hashing/re-hashing for IPv6 ingress packets.
  
  This mirrors the basic IPv4 implementation - IPv6 packets under RSS
  now are checked for a correct RSS hash and if one isn't provided,
  it's done in software.
  
  This only handles the initial receive - it doesn't yet handle
  reinjecting / rehashing packets after being decapsulated from
  various tunneling setups.  That'll come in some follow-up work.
  
  For non-RSS users, this is almost a giant no-op.
  
  It does change a couple of ipv6 methods to use const mbuf * instead of
  mbuf * but it doesn't have any functional changes.
  
  So, the following now occurs:
  
  * If the NIC doesn't do any RSS hashing, it's all done in software.
Single-queue, non-RSS NICs will now have the RX path distributed
into multiple receive netisr queues.
  
  * If the NIC provides the wrong hash (eg only IPv6 hash when we needed
an IPv6 TCP hash, or IPv6 UDP hash when we expected IPv6 hash)
then the hash is recalculated.
  
  * .. if the hash is recalculated, it'll end up being injected into
the correct netisr queue for v6 processing.
  
  Submitted by: Tiwei Bie 
  Differential Revision:https://reviews.freebsd.org/D3504

Modified:
  head/sys/netinet6/in6_rss.c
  head/sys/netinet6/in6_rss.h
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/ip6_var.h

Modified: head/sys/netinet6/in6_rss.c
==
--- head/sys/netinet6/in6_rss.c Sat Aug 29 06:58:30 2015(r287277)
+++ head/sys/netinet6/in6_rss.c Sat Aug 29 07:14:29 2015(r287278)
@@ -58,7 +58,8 @@ __FBSDID("$FreeBSD$");
 #include 
 
 /* for software rss hash support */
-#include 
+#include 
+#include 
 #include 
 #include 
 
@@ -150,3 +151,207 @@ rss_proto_software_hash_v6(const struct 
RSS_DEBUG("no available hashtypes!\n");
return (-1);
 }
+
+/*
+ * Do a software calculation of the RSS for the given mbuf.
+ *
+ * This is typically used by the input path to recalculate the RSS after
+ * some form of packet processing (eg de-capsulation, IP fragment reassembly.)
+ *
+ * dir is the packet direction - RSS_HASH_PKT_INGRESS for incoming and
+ * RSS_HASH_PKT_EGRESS for outgoing.
+ *
+ * Returns 0 if a hash was done, -1 if no hash was done, +1 if
+ * the mbuf already had a valid RSS flowid.
+ *
+ * This function doesn't modify the mbuf.  It's up to the caller to
+ * assign flowid/flowtype as appropriate.
+ */
+int
+rss_mbuf_software_hash_v6(const struct mbuf *m, int dir, uint32_t *hashval,
+uint32_t *hashtype)
+{
+   const struct ip6_hdr *ip6;
+   const struct tcphdr *th;
+   const struct udphdr *uh;
+   uint32_t flowtype;
+   uint8_t proto;
+   int off, newoff;
+   int nxt;
+
+   /*
+* XXX For now this only handles hashing on incoming mbufs.
+*/
+   if (dir != RSS_HASH_PKT_INGRESS) {
+   RSS_DEBUG("called on EGRESS packet!\n");
+   return (-1);
+   }
+
+   off = sizeof(struct ip6_hdr);
+
+   /*
+* First, validate that the mbuf we have is long enough
+* to have an IPv6 header in it.
+*/
+   if (m->m_pkthdr.len < off) {
+   RSS_DEBUG("short mbuf pkthdr\n");
+   return (-1);
+   }
+   if (m->m_len < off) {
+   RSS_DEBUG("short mbuf len\n");
+   return (-1);
+   }
+
+   /* Ok, let's dereference that */
+   ip6 = mtod(m, struct ip6_hdr *);
+   proto = ip6->ip6_nxt;
+
+   /*
+* Find the beginning of the TCP/UDP header.
+*
+* If this is a fragment then it shouldn't be four-tuple
+* hashed just yet.  Once it's reassembled into a full
+* frame it should be re-hashed.
+*/
+   while (proto != IPPROTO_FRAGMENT) {
+   newoff = ip6_nexthdr(m, off, proto, &nxt);
+   if (newoff < 0)
+   break;
+   off = newoff;
+   proto = nxt;
+   }
+
+   /*
+* If the mbuf flowid/flowtype matches the packet type,
+* and we don't support the 4-tuple version of the given protocol,
+* then signal to the owner that it can trust the flowid/flowtype
+* details.
+*
+* This is a little picky - eg, if TCPv6 / UDPv6 hashing
+* is supported but we got a TCP/UDP frame only 2-tuple hashed,
+* then we shouldn't just "trust" the 2-tuple hash.  We need
+* a 4-tuple hash.
+*/
+   flowtype = M_HASHTYPE_GET(m);
+
+   if (flowtype != M_HASHTYPE_NONE) {
+   switch (proto) {
+   case IPPROTO_UDP:
+   if ((rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV6) &&
+   (flowtype == M_HASHTYPE_RSS_UDP_IPV6)) {
+   return (1)