Re: svn commit: r231999 - head/sys/conf

2012-02-26 Thread Sergey Kandaurov
On 22 February 2012 19:05, Josh Paetzel  wrote:
> Author: jpaetzel
> Date: Wed Feb 22 15:05:19 2012
> New Revision: 231999
> URL: http://svn.freebsd.org/changeset/base/231999
>
> Log:
>  Fix various typos and normalize spelling.
[...]
> @@ -602,7 +602,7 @@ options     FLOWTABLE
>  options        SCTP
>  # There are bunches of options:
>  # this one turns on all sorts of
> -# nastly printing that you can
> +# nastily printing that you can
>  # do. It's all controlled by a
>  # bit mask (settable by socket opt and
>  # by sysctl). Including will not cause

adj. nasty?

-- 
wbr,
pluknet
___
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: r232176 - head/sys/modules/scc

2012-02-26 Thread Justin Hibbits
Author: jhibbits
Date: Sun Feb 26 13:27:22 2012
New Revision: 232176
URL: http://svn.freebsd.org/changeset/base/232176

Log:
  Fix the scc(4) module build.  Without the file it's missing a required symbol.
  
  Approved by:  nwhitehorn (mentor)
  MFC after:3 days

Modified:
  head/sys/modules/scc/Makefile

Modified: head/sys/modules/scc/Makefile
==
--- head/sys/modules/scc/Makefile   Sun Feb 26 12:56:12 2012
(r232175)
+++ head/sys/modules/scc/Makefile   Sun Feb 26 13:27:22 2012
(r232176)
@@ -6,7 +6,7 @@
 scc_bfe= scc_bfe_ebus.c scc_bfe_sbus.c
 .endif
 .if ${MACHINE_CPUARCH} == "powerpc"
-scc_bfe= scc_bfe_macio.c scc_bfe_quicc.c
+scc_bfe= scc_bfe_macio.c scc_bfe_quicc.c scc_dev_quicc.c
 .endif
 
 KMOD=  scc
___
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: r232177 - in head: etc/devd sys/conf sys/powerpc/conf sys/powerpc/powermac

2012-02-26 Thread Justin Hibbits
Author: jhibbits
Date: Sun Feb 26 13:45:25 2012
New Revision: 232177
URL: http://svn.freebsd.org/changeset/base/232177

Log:
  Add backlight control to ATI-graphics PowerBooks and iBooks.
  
  Approved by:  nwhitehorn (mentor)
  MFC after:1 week

Added:
  head/sys/powerpc/powermac/atibl.c   (contents, props changed)
Modified:
  head/etc/devd/apple.conf
  head/sys/conf/files.powerpc
  head/sys/powerpc/conf/GENERIC
  head/sys/powerpc/conf/GENERIC64

Modified: head/etc/devd/apple.conf
==
--- head/etc/devd/apple.confSun Feb 26 13:27:22 2012(r232176)
+++ head/etc/devd/apple.confSun Feb 26 13:45:25 2012(r232177)
@@ -19,6 +19,26 @@ notify 0 {
 };
 
 
+# The next blocks enable brightness hotkeys that can be found on Apple laptops
+notify 0 {
+   match "system"  "PMU";
+   match "subsystem"   "keys";
+   match "type""brightness";
+   match "notify"  "down";
+   action  "sysctl dev.backlight.0.level=\
+   $(expr `sysctl -n dev.backlight.0.level` - 10)";
+};
+
+notify 0 {
+   match "system"  "PMU";
+   match "subsystem"   "keys";
+   match "type""brightness";
+   match "notify"  "up";
+   action  "sysctl dev.backlight.0.level=\
+   $(expr `sysctl -n dev.backlight.0.level` + 10)";
+};
+
+
 # The next blocks enable volume hotkeys that can be found on Apple laptops
 notify 0 {
match "system"  "PMU";

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Sun Feb 26 13:27:22 2012(r232176)
+++ head/sys/conf/files.powerpc Sun Feb 26 13:45:25 2012(r232177)
@@ -145,6 +145,7 @@ powerpc/ofw/rtas.c  optionalaim
 powerpc/powermac/ata_kauai.c   optionalpowermac ata | powermac atamacio
 powerpc/powermac/ata_macio.c   optionalpowermac ata | powermac atamacio
 powerpc/powermac/ata_dbdma.c   optionalpowermac ata | powermac atamacio
+powerpc/powermac/atibl.c   optionalpowermac atibl
 powerpc/powermac/cuda.coptionalpowermac cuda
 powerpc/powermac/cpcht.c   optionalpowermac pci
 powerpc/powermac/dbdma.c   optionalpowermac pci

Modified: head/sys/powerpc/conf/GENERIC
==
--- head/sys/powerpc/conf/GENERIC   Sun Feb 26 13:27:22 2012
(r232176)
+++ head/sys/powerpc/conf/GENERIC   Sun Feb 26 13:45:25 2012
(r232177)
@@ -194,6 +194,7 @@ device  max6690 # PowerMac7,2 temperatu
 device powermac_nvram  # Open Firmware configuration NVRAM
 device smu # Apple System Management Unit
 device windtunnel  # Apple G4 MDD fan controller
+device atibl   # ATI-based backlight driver for 
PowerBooks/iBooks
 
 # ADB support
 device adb

Modified: head/sys/powerpc/conf/GENERIC64
==
--- head/sys/powerpc/conf/GENERIC64 Sun Feb 26 13:27:22 2012
(r232176)
+++ head/sys/powerpc/conf/GENERIC64 Sun Feb 26 13:45:25 2012
(r232177)
@@ -188,6 +188,7 @@ device  fcu # Apple Fan Control Unit
 device max6690 # PowerMac7,2 temperature sensor
 device powermac_nvram  # Open Firmware configuration NVRAM
 device smu # Apple System Management Unit
+device atibl   # ATI-based backlight driver for 
PowerBooks/iBooks
 
 # ADB support
 device adb

Added: head/sys/powerpc/powermac/atibl.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/powerpc/powermac/atibl.c   Sun Feb 26 13:45:25 2012
(r232177)
@@ -0,0 +1,196 @@
+/*-
+ * Copyright (c) 2012 Justin Hibbits
+ * 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 ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLAR

svn commit: r232178 - head/sys/kern

2012-02-26 Thread Konstantin Belousov
Author: kib
Date: Sun Feb 26 13:51:05 2012
New Revision: 232178
URL: http://svn.freebsd.org/changeset/base/232178

Log:
  Remove apparently redundand checks for socket so_proto being non-NULL
  from sosetopt() and sogetopt().  No exposed sockets may have so_proto
  invalid.
  
  Discussed with:   bz, rwatson
  Reviewed by:  glebius
  MFC after:2 weeks

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Sun Feb 26 13:45:25 2012(r232177)
+++ head/sys/kern/uipc_socket.c Sun Feb 26 13:51:05 2012(r232178)
@@ -2447,7 +2447,7 @@ sosetopt(struct socket *so, struct socko
CURVNET_SET(so->so_vnet);
error = 0;
if (sopt->sopt_level != SOL_SOCKET) {
-   if (so->so_proto && so->so_proto->pr_ctloutput) {
+   if (so->so_proto->pr_ctloutput != NULL) {
error = (*so->so_proto->pr_ctloutput)(so, sopt);
CURVNET_RESTORE();
return (error);
@@ -2508,8 +2508,7 @@ sosetopt(struct socket *so, struct socko
error = EINVAL;
goto bad;
}
-   if (so->so_proto != NULL &&
-  ((so->so_proto->pr_domain->dom_family == PF_INET) ||
+   if (((so->so_proto->pr_domain->dom_family == PF_INET) ||
   (so->so_proto->pr_domain->dom_family == PF_INET6) ||
   (so->so_proto->pr_domain->dom_family == PF_ROUTE))) {
so->so_fibnum = optval;
@@ -2641,11 +2640,8 @@ sosetopt(struct socket *so, struct socko
error = ENOPROTOOPT;
break;
}
-   if (error == 0 && so->so_proto != NULL &&
-   so->so_proto->pr_ctloutput != NULL) {
-   (void) ((*so->so_proto->pr_ctloutput)
- (so, sopt));
-   }
+   if (error == 0 && so->so_proto->pr_ctloutput != NULL)
+   (void)(*so->so_proto->pr_ctloutput)(so, sopt);
}
 bad:
CURVNET_RESTORE();
@@ -2695,7 +2691,7 @@ sogetopt(struct socket *so, struct socko
CURVNET_SET(so->so_vnet);
error = 0;
if (sopt->sopt_level != SOL_SOCKET) {
-   if (so->so_proto && so->so_proto->pr_ctloutput)
+   if (so->so_proto->pr_ctloutput != NULL)
error = (*so->so_proto->pr_ctloutput)(so, sopt);
else
error = ENOPROTOOPT;
___
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: r232179 - in head/sys: kern sys

2012-02-26 Thread Konstantin Belousov
Author: kib
Date: Sun Feb 26 13:55:43 2012
New Revision: 232179
URL: http://svn.freebsd.org/changeset/base/232179

Log:
  Add SO_PROTOCOL/SO_PROTOTYPE socket SOL_SOCKET-level option to get the
  socket protocol number.  This is useful since the socket type can
  be implemented by different protocols in the same protocol family,
  e.g. SOCK_STREAM may be provided by both TCP and SCTP.
  
  Submitted by: Jukka A. Ukkonen 
  PR: kern/162352
  Discussed with:   bz
  Reviewed by:  glebius
  MFC after:2 weeks

Modified:
  head/sys/kern/uipc_socket.c
  head/sys/sys/socket.h

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Sun Feb 26 13:51:05 2012(r232178)
+++ head/sys/kern/uipc_socket.c Sun Feb 26 13:55:43 2012(r232179)
@@ -2733,6 +2733,10 @@ integer:
optval = so->so_type;
goto integer;
 
+   case SO_PROTOCOL:
+   optval = so->so_proto->pr_protocol;
+   goto integer;
+
case SO_ERROR:
SOCK_LOCK(so);
optval = so->so_error;

Modified: head/sys/sys/socket.h
==
--- head/sys/sys/socket.h   Sun Feb 26 13:51:05 2012(r232178)
+++ head/sys/sys/socket.h   Sun Feb 26 13:55:43 2012(r232179)
@@ -138,6 +138,8 @@ typedef __uid_t uid_t;
 #defineSO_LISTENINCQLEN0x1013  /* socket's incomplete queue 
length */
 #defineSO_SETFIB   0x1014  /* use this FIB to route */
 #defineSO_USER_COOKIE  0x1015  /* user cookie (dummynet etc.) 
*/
+#defineSO_PROTOCOL 0x1016  /* get socket protocol (Linux 
name) */
+#defineSO_PROTOTYPESO_PROTOCOL /* alias for SO_PROTOCOL (SunOS 
name) */
 #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: r232180 - head/lib/libc/sys

2012-02-26 Thread Konstantin Belousov
Author: kib
Date: Sun Feb 26 13:57:24 2012
New Revision: 232180
URL: http://svn.freebsd.org/changeset/base/232180

Log:
  Document SO_PROTOCOL socket option.
  
  Discussed with:   bz
  Reviewed by:  glebius
  MFC after:2 weeks

Modified:
  head/lib/libc/sys/getsockopt.2

Modified: head/lib/libc/sys/getsockopt.2
==
--- head/lib/libc/sys/getsockopt.2  Sun Feb 26 13:55:43 2012
(r232179)
+++ head/lib/libc/sys/getsockopt.2  Sun Feb 26 13:57:24 2012
(r232180)
@@ -28,7 +28,7 @@
 .\" @(#)getsockopt.2   8.4 (Berkeley) 5/2/95
 .\" $FreeBSD$
 .\"
-.Dd November 21, 2011
+.Dd February 26, 2012
 .Dt GETSOCKOPT 2
 .Os
 .Sh NAME
@@ -172,6 +172,8 @@ for the socket
 .It Dv SO_BINTIME Ta "enables reception of a timestamp with datagrams"
 .It Dv SO_ACCEPTCONN Ta "get listening status of the socket (get only)"
 .It Dv SO_TYPE Ta "get the type of the socket (get only)"
+.It Dv SO_PROTOCOL Ta "get the protocol number for the socket (get only)"
+.It Dv SO_PROTOTYPE Ta "SunOS alias for the Linux SO_PROTOCOL (get only)"
 .It Dv SO_ERROR Ta "get and clear error on the socket (get only)"
 .It Dv SO_SETFIB Ta "set the associated FIB (routing table) for the socket 
(set only)"
 .El
@@ -449,7 +451,10 @@ and for
 .Ed
 .Pp
 .Dv SO_ACCEPTCONN ,
-.Dv SO_TYPE
+.Dv SO_TYPE ,
+.Dv SO_PROTOCOL
+(and its alias
+.Dv SO_PROTOTYPE )
 and
 .Dv SO_ERROR
 are options used only with
@@ -463,6 +468,12 @@ system call was invoked on the socket.
 returns the type of the socket, such as
 .Dv SOCK_STREAM ;
 it is useful for servers that inherit sockets on startup.
+.Dv SO_PROTOCOL
+returns the protocol number for the socket, for
+.Dv AF_INET
+and
+.Dv AF_INET6
+address families.
 .Dv SO_ERROR
 returns any pending error on the socket and clears
 the error status.
___
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: r232074 - head/sys/cam/ctl

2012-02-26 Thread Alexander Best
On Sat Feb 25 12, Bruce Evans wrote:
> On Fri, 24 Feb 2012, Alexander Best wrote:
> 
> >On Fri Feb 24 12, Dimitry Andric wrote:
> >>On 2012-02-24 10:38, Alexander Best wrote:
> >>>which will turn all -Wformat-invalid-specifier and -Wformat-extra-args 
> >>>errors
> >>>into warnings (because clang tot doesn't support -fformat-extensions)?
> >>
> >>It would be better to push our format extensions upstream, I think.
> >>Though the option should probably be renamed to something else, e.g.
> >>-ffreebsd-extensions, or such.
> 
> It is only for format extensions.  The idea is that a C compiler that
> supports warning about unsupported printf formats must warn about
> uses of format extensions (no matter whose they are) unless instructed
> not to do so.  It seems excessive to have separate flags
> -fbsd-format-extensions -ffreebsd-format-extensions
> -fotherbsd-format-extensions -fgnu-format-extensions
> -flinux-format-extensions ..., so I used a single flag.  If
> -fbsd-format-extensions existed, then it would have only %b as an
> extension.
> 
> Anyway, clang already supports -fformat-extensions.  The following
> compiles with this, but fails messily without it:
> 
> % #include 
> % 
> % void
> % foo(void)
> % {
> % printf("0x%b\n", 1, "\1foo");
> % }
> 
> gcc (FreeBSD-gcc) complains about %#b, but clang doesn't.  I don't know
> if %#b is valid, but it should be.
> 
> >i'm still confused regarding the actual politics regarding this change.
> >everytime this comes up i get a different answer. the last one was that 
> >since
> >the special printf format is only used for kernel code, the 
> >-fformat-extensions
> >code within clang base shouldn't be pushed upstream.
> 
> Is it only the FreeBSD version of clang that has it?  Does FreeBSD has any
> other significant local changes?  The flag should be push upstream, but
> there are likely to always be OS-specific details.  For example, if %#b
> is indeed invalid and someone fixes the kernel to support it, you don't
> want to have to wait for the upstream sources to be synchronized before
> using %#b.

yes. only the clang version that ships with the freebsd src has support for
-fformat-extensions, however i couldn't find any referrence to it in the
clang(1) manual page. so it seems the support was only hacked into the clang
source and the manual page wasn't updated.

getting these changes pushed upstream would be nice. it's very likely that
the clang folks will rename -fformat-extensions to something else, but it
shouldn't be a big problem handling the different flag names in some *.mk
file.

i don't know, if the freebsd of clang has any other major differences compared
to the vendor version. maybe the freebsd-clang wiki page has some details about
this matter (or will direct you to people who know the answer).

cheers.
alex

> 
> Bruce
___
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: r232181 - in head/sys: kern sys

2012-02-26 Thread Mikolaj Golub
Author: trociny
Date: Sun Feb 26 14:25:48 2012
New Revision: 232181
URL: http://svn.freebsd.org/changeset/base/232181

Log:
  Add sysctl to retrieve or set umask of another process.
  
  Submitted by: Dmitry Banschikov 
  Discussed with:   kib, rwatson
  Reviewed by:  kib
  MFC after:2 weeks

Modified:
  head/sys/kern/kern_proc.c
  head/sys/sys/sysctl.h

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Sun Feb 26 13:57:24 2012(r232180)
+++ head/sys/kern/kern_proc.c   Sun Feb 26 14:25:48 2012(r232181)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2471,6 +2472,49 @@ sysctl_kern_proc_ps_strings(SYSCTL_HANDL
return (error);
 }
 
+/*
+ * This sysctl allows a process to retrieve or/and set umask of
+ * another process.
+ */
+static int
+sysctl_kern_proc_umask(SYSCTL_HANDLER_ARGS)
+{
+   int *name = (int *)arg1;
+   u_int namelen = arg2;
+   struct proc *p;
+   int error;
+   u_short fd_cmask;
+
+   if (namelen != 1)
+   return (EINVAL);
+
+   if (req->newptr != NULL && req->newlen != sizeof(fd_cmask))
+   return (EINVAL);
+
+   error = pget((pid_t)name[0], PGET_WANTREAD, &p);
+   if (error != 0)
+   return (error);
+
+   FILEDESC_SLOCK(p->p_fd);
+   fd_cmask = p->p_fd->fd_cmask;
+   FILEDESC_SUNLOCK(p->p_fd);
+   error = SYSCTL_OUT(req, &fd_cmask, sizeof(fd_cmask));
+   if (error != 0)
+   goto errout;
+
+   if (req->newptr != NULL) {
+   error = SYSCTL_IN(req, &fd_cmask, sizeof(fd_cmask));
+   if (error == 0) {
+   FILEDESC_XLOCK(p->p_fd);
+   p->p_fd->fd_cmask = fd_cmask & ALLPERMS;
+   FILEDESC_XUNLOCK(p->p_fd);
+   }
+   }
+errout:
+   PRELE(p);
+   return (error);
+}
+
 SYSCTL_NODE(_kern, KERN_PROC, proc, CTLFLAG_RD,  0, "Process table");
 
 SYSCTL_PROC(_kern_proc, KERN_PROC_ALL, all, CTLFLAG_RD|CTLTYPE_STRUCT|
@@ -2572,3 +2616,7 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC
 static SYSCTL_NODE(_kern_proc, KERN_PROC_PS_STRINGS, ps_strings, CTLFLAG_RD |
CTLFLAG_MPSAFE, sysctl_kern_proc_ps_strings,
"Process ps_strings location");
+
+static SYSCTL_NODE(_kern_proc, KERN_PROC_UMASK, umask, CTLFLAG_RW |
+   CTLFLAG_ANYBODY | CTLFLAG_MPSAFE, sysctl_kern_proc_umask,
+   "Process umask");

Modified: head/sys/sys/sysctl.h
==
--- head/sys/sys/sysctl.h   Sun Feb 26 13:57:24 2012(r232180)
+++ head/sys/sys/sysctl.h   Sun Feb 26 14:25:48 2012(r232181)
@@ -563,6 +563,7 @@ SYSCTL_ALLOWED_TYPES(UINT64, uint64_t *a
 #defineKERN_PROC_AUXV  36  /* get ELF auxiliary vector */
 #defineKERN_PROC_RLIMIT37  /* process resource limits */
 #defineKERN_PROC_PS_STRINGS38  /* get ps_strings location */
+#defineKERN_PROC_UMASK 39  /* process umask */
 
 /*
  * KERN_IPC identifiers
___
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: r232182 - head/usr.bin/procstat

2012-02-26 Thread Mikolaj Golub
Author: trociny
Date: Sun Feb 26 14:27:34 2012
New Revision: 232182
URL: http://svn.freebsd.org/changeset/base/232182

Log:
  When displaying security credential information show also process umask.
  
  Submitted by: Dmitry Banschikov 
  Discussed with:   rwatson
  MFC after:2 weeks

Modified:
  head/usr.bin/procstat/procstat_cred.c

Modified: head/usr.bin/procstat/procstat_cred.c
==
--- head/usr.bin/procstat/procstat_cred.c   Sun Feb 26 14:25:48 2012
(r232181)
+++ head/usr.bin/procstat/procstat_cred.c   Sun Feb 26 14:27:34 2012
(r232182)
@@ -38,6 +38,8 @@
 
 #include "procstat.h"
 
+static const char *get_umask(struct kinfo_proc *kipp);
+
 void
 procstat_cred(struct kinfo_proc *kipp)
 {
@@ -48,9 +50,9 @@ procstat_cred(struct kinfo_proc *kipp)
gid_t *groups = NULL;
 
if (!hflag)
-   printf("%5s %-16s %5s %5s %5s %5s %5s %5s %5s %-15s\n", "PID",
-   "COMM", "EUID", "RUID", "SVUID", "EGID", "RGID", "SVGID",
-   "FLAGS", "GROUPS");
+   printf("%5s %-16s %5s %5s %5s %5s %5s %5s %5s %5s %-15s\n",
+   "PID", "COMM", "EUID", "RUID", "SVUID", "EGID", "RGID",
+   "SVGID", "UMASK", "FLAGS", "GROUPS");
 
printf("%5d ", kipp->ki_pid);
printf("%-16s ", kipp->ki_comm);
@@ -60,6 +62,7 @@ procstat_cred(struct kinfo_proc *kipp)
printf("%5d ", kipp->ki_groups[0]);
printf("%5d ", kipp->ki_rgid);
printf("%5d ", kipp->ki_svgid);
+   printf("%5s ", get_umask(kipp));
printf("%s", kipp->ki_cr_flags & CRED_FLAG_CAPMODE ? "C" : "-");
printf(" ");
 
@@ -98,3 +101,26 @@ procstat_cred(struct kinfo_proc *kipp)
 
printf("\n");
 }
+
+static const char *
+get_umask(struct kinfo_proc *kipp)
+{
+   int error;
+   int mib[4];
+   size_t len;
+   u_short fd_cmask;
+   static char umask[4];
+
+   mib[0] = CTL_KERN;
+   mib[1] = KERN_PROC;
+   mib[2] = KERN_PROC_UMASK;
+   mib[3] = kipp->ki_pid;
+   len = sizeof(fd_cmask);
+   error = sysctl(mib, 4, &fd_cmask, &len, NULL, 0);
+   if (error == 0) {
+   snprintf(umask, 4, "%03o", fd_cmask);
+   return (umask);
+   } else {
+   return ("-");
+   }
+}
___
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: r232183 - head/sys/kern

2012-02-26 Thread Jilles Tjoelker
Author: jilles
Date: Sun Feb 26 15:14:29 2012
New Revision: 232183
URL: http://svn.freebsd.org/changeset/base/232183

Log:
  Fix fchmod() and fchown() on fifos.
  
  The new fifo implementation in r232055 broke fchmod() and fchown() on fifos.
  Postfix needs this.
  
  Submitted by: gianni
  Reported by:  dougb

Modified:
  head/sys/kern/sys_pipe.c

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cSun Feb 26 14:27:34 2012(r232182)
+++ head/sys/kern/sys_pipe.cSun Feb 26 15:14:29 2012(r232183)
@@ -152,6 +152,8 @@ static fo_poll_tpipe_poll;
 static fo_kqfilter_t   pipe_kqfilter;
 static fo_stat_t   pipe_stat;
 static fo_close_t  pipe_close;
+static fo_chmod_t  pipe_chmod;
+static fo_chown_t  pipe_chown;
 
 struct fileops pipeops = {
.fo_read = pipe_read,
@@ -162,8 +164,8 @@ struct fileops pipeops = {
.fo_kqfilter = pipe_kqfilter,
.fo_stat = pipe_stat,
.fo_close = pipe_close,
-   .fo_chmod = invfo_chmod,
-   .fo_chown = invfo_chown,
+   .fo_chmod = pipe_chmod,
+   .fo_chown = pipe_chown,
.fo_flags = DFLAG_PASSABLE
 };
 
@@ -1548,6 +1550,43 @@ pipe_close(fp, td)
return (0);
 }
 
+static int
+pipe_chmod(fp, mode, active_cred, td)
+   struct file *fp;
+   mode_t mode;
+   struct ucred *active_cred;
+   struct thread *td;
+{
+   struct pipe *cpipe;
+   int error;
+
+   cpipe = fp->f_data;
+   if (cpipe->pipe_state & PIPE_NAMED)
+   error = vn_chmod(fp, mode, active_cred, td);
+   else
+   error = invfo_chmod(fp, mode, active_cred, td);
+   return (error);
+}
+
+static int
+pipe_chown(fp, uid, gid, active_cred, td)
+   struct file *fp;
+   uid_t uid;
+   gid_t gid;
+   struct ucred *active_cred;
+   struct thread *td;
+{
+   struct pipe *cpipe;
+   int error;
+
+   cpipe = fp->f_data;
+   if (cpipe->pipe_state & PIPE_NAMED)
+   error = vn_chown(fp, uid, gid, active_cred, td);
+   else
+   error = invfo_chown(fp, uid, gid, active_cred, td);
+   return (error);
+}
+
 static void
 pipe_free_kmem(cpipe)
struct pipe *cpipe;
___
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: r232184 - head/tools/regression/fifo/fifo_misc

2012-02-26 Thread Jilles Tjoelker
Author: jilles
Date: Sun Feb 26 15:32:02 2012
New Revision: 232184
URL: http://svn.freebsd.org/changeset/base/232184

Log:
  Check fchmod()/fchown() in fifo_misc test.

Modified:
  head/tools/regression/fifo/fifo_misc/fifo_misc.c

Modified: head/tools/regression/fifo/fifo_misc/fifo_misc.c
==
--- head/tools/regression/fifo/fifo_misc/fifo_misc.cSun Feb 26 15:14:29 
2012(r232183)
+++ head/tools/regression/fifo/fifo_misc/fifo_misc.cSun Feb 26 15:32:02 
2012(r232184)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2005 Robert N. M. Watson
+ * Copyright (c) 2012 Jilles Tjoelker
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -223,6 +224,97 @@ test_ioctl(void)
cleanfifo("testfifo", reader_fd, writer_fd);
 }
 
+/*
+ * fchmod(2)/fchown(2) on FIFO should work.
+ */
+static void
+test_chmodchown(void)
+{
+   struct stat sb;
+   int reader_fd, writer_fd;
+   uid_t u;
+   gid_t g;
+
+   makefifo("testfifo", __func__);
+
+   if (openfifo("testfifo", __func__, &reader_fd, &writer_fd) < 0) {
+   warn("%s: openfifo", __func__);
+   cleanfifo("testfifo", -1, -1);
+   exit(-1);
+   }
+
+   if (fchmod(reader_fd, 0666) != 0) {
+   warn("%s: fchmod", __func__);
+   cleanfifo("testfifo", reader_fd, writer_fd);
+   exit(-1);
+   }
+
+   if (stat("testfifo", &sb) != 0) {
+   warn("%s: stat", __func__);
+   cleanfifo("testfifo", reader_fd, writer_fd);
+   exit(-1);
+   }
+
+   if ((sb.st_mode & 0777) != 0666) {
+   warnx("%s: stat chmod result", __func__);
+   cleanfifo("testfifo", reader_fd, writer_fd);
+   exit(-1);
+   }
+
+   if (fstat(writer_fd, &sb) != 0) {
+   warn("%s: fstat", __func__);
+   cleanfifo("testfifo", reader_fd, writer_fd);
+   exit(-1);
+   }
+
+   if ((sb.st_mode & 0777) != 0666) {
+   warnx("%s: fstat chmod result", __func__);
+   cleanfifo("testfifo", reader_fd, writer_fd);
+   exit(-1);
+   }
+
+   if (fchown(reader_fd, -1, -1) != 0) {
+   warn("%s: fchown 1", __func__);
+   cleanfifo("testfifo", reader_fd, writer_fd);
+   exit(-1);
+   }
+
+   u = geteuid();
+   if (u == 0)
+   u = 1;
+   g = getegid();
+   if (fchown(reader_fd, u, g) != 0) {
+   warn("%s: fchown 2", __func__);
+   cleanfifo("testfifo", reader_fd, writer_fd);
+   exit(-1);
+   }
+   if (stat("testfifo", &sb) != 0) {
+   warn("%s: stat", __func__);
+   cleanfifo("testfifo", reader_fd, writer_fd);
+   exit(-1);
+   }
+
+   if (sb.st_uid != u || sb.st_gid != g) {
+   warnx("%s: stat chown result", __func__);
+   cleanfifo("testfifo", reader_fd, writer_fd);
+   exit(-1);
+   }
+
+   if (fstat(writer_fd, &sb) != 0) {
+   warn("%s: fstat", __func__);
+   cleanfifo("testfifo", reader_fd, writer_fd);
+   exit(-1);
+   }
+
+   if (sb.st_uid != u || sb.st_gid != g) {
+   warnx("%s: fstat chown result", __func__);
+   cleanfifo("testfifo", reader_fd, writer_fd);
+   exit(-1);
+   }
+
+   cleanfifo("testfifo", -1, -1);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -238,6 +330,7 @@ main(int argc, char *argv[])
test_lseek();
test_truncate();
test_ioctl();
+   test_chmodchown();
 
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: r232185 - head/sys/dev/dpt

2012-02-26 Thread Kevin Lo
Author: kevlo
Date: Sun Feb 26 16:05:20 2012
New Revision: 232185
URL: http://svn.freebsd.org/changeset/base/232185

Log:
  Remove duplicate assignment of CTS_SPI_VALID_SYNC_RATE bit

Modified:
  head/sys/dev/dpt/dpt_scsi.c

Modified: head/sys/dev/dpt/dpt_scsi.c
==
--- head/sys/dev/dpt/dpt_scsi.c Sun Feb 26 15:32:02 2012(r232184)
+++ head/sys/dev/dpt/dpt_scsi.c Sun Feb 26 16:05:20 2012(r232185)
@@ -1034,7 +1034,6 @@ dpt_action(struct cam_sim *sim, union cc
 
spi->valid = CTS_SPI_VALID_SYNC_RATE
| CTS_SPI_VALID_SYNC_OFFSET
-   | CTS_SPI_VALID_SYNC_RATE
| CTS_SPI_VALID_BUS_WIDTH
| CTS_SPI_VALID_DISC;
scsi->valid = CTS_SCSI_VALID_TQ;
___
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: r232186 - in head: cddl/contrib/opensolaris/cmd/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/kern sys/sys usr.sbin/jail

2012-02-26 Thread Martin Matuska
Author: mm
Date: Sun Feb 26 16:30:39 2012
New Revision: 232186
URL: http://svn.freebsd.org/changeset/base/232186

Log:
  Analogous to r232059, add a parameter for the ZFS file system:
  
  allow.mount.zfs:
allow mounting the zfs filesystem inside a jail
  
  This way the permssions for mounting all current VFCF_JAIL filesystems
  inside a jail are controlled wia allow.mount.* jail parameters.
  
  Update sysctl descriptions.
  Update jail(8) and zfs(8) manpages.
  
  TODO: document the connection of allow.mount.* and VFCF_JAIL for kernel
developers
  
  MFC after:10 days

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  head/sys/kern/kern_jail.c
  head/sys/sys/jail.h
  head/usr.sbin/jail/jail.8

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Feb 26 16:05:20 2012
(r232185)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Feb 26 16:30:39 2012
(r232186)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 26, 2011
+.Dd February 26, 2012
 .Dt ZFS 8
 .Os
 .Sh NAME
@@ -413,9 +413,15 @@ subcommand. You cannot attach a dataset 
 same dataset to another jails. To allow management of the dataset from within
 a jail, the
 .Sy jailed
-property has to be set. The
+property has to be set and the jail needs access to the
+.Pa /dev/zfs
+device. The
 .Sy quota
-property cannot be changed from within a jail.
+property cannot be changed from within a jail. See
+.Xr jail 8
+for information on how to allow mounting
+.Tn ZFS
+datasets from within a jail.
 .Pp
 .No A Tn ZFS
 dataset can be detached from a jail using the
@@ -2715,13 +2721,12 @@ to the jail identified by JID
 From now on this file system tree can be managed from within a jail if the
 .Sy jailed
 property has been set. To use this functionality, the jail needs the
-.Va enforce_statfs
-parameter set to
-.Sy 0
-and the
 .Va allow.mount
-parameter set to
-.Sy 1 .
+and
+.Va allow.mount.zfs
+parameters set to 1 and the
+.Va enforce_statfs
+parameter set to a value lower than 2.
 .Pp
 See
 .Xr jail 8

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cSun Feb 
26 16:05:20 2012(r232185)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cSun Feb 
26 16:30:39 2012(r232186)
@@ -60,6 +60,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "zfs_comutil.h"
 
 struct mtx zfs_debug_mtx;
@@ -1533,6 +1534,9 @@ zfs_mount(vfs_t *vfsp)
int error = 0;
int canwrite;
 
+   if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_ZFS))
+   return (EPERM);
+
if (vfs_getopt(vfsp->mnt_optnew, "from", (void **)&osname, NULL))
return (EINVAL);
 

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Sun Feb 26 16:05:20 2012(r232185)
+++ head/sys/kern/kern_jail.c   Sun Feb 26 16:30:39 2012(r232186)
@@ -203,6 +203,7 @@ static char *pr_allow_names[] = {
"allow.socket_af",
"allow.mount.devfs",
"allow.mount.nullfs",
+   "allow.mount.zfs",
 };
 const size_t pr_allow_names_size = sizeof(pr_allow_names);
 
@@ -216,6 +217,7 @@ static char *pr_allow_nonames[] = {
"allow.nosocket_af",
"allow.mount.nodevfs",
"allow.mount.nonullfs",
+   "allow.mount.nozfs",
 };
 const size_t pr_allow_nonames_size = sizeof(pr_allow_nonames);
 
@@ -4199,11 +4201,15 @@ SYSCTL_PROC(_security_jail, OID_AUTO, mo
 SYSCTL_PROC(_security_jail, OID_AUTO, mount_devfs_allowed,
 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
 NULL, PR_ALLOW_MOUNT_DEVFS, sysctl_jail_default_allow, "I",
-"Processes in jail can mount/unmount the devfs file system");
+"Processes in jail can mount the devfs file system");
 SYSCTL_PROC(_security_jail, OID_AUTO, mount_nullfs_allowed,
 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
 NULL, PR_ALLOW_MOUNT_NULLFS, sysctl_jail_default_allow, "I",
-"Processes in jail can mount/unmount the nullfs file system");
+"Processes in jail can mount the nullfs file system");
+SYSCTL_PROC(_security_jail, OID_AUTO, mount_zfs_allowed,
+CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
+NULL, PR_ALLOW_MOUNT_ZFS, sysctl_jail_default_allow, "I",
+"Processes in jail can mount the zfs file system");
 
 static int
 sysctl_jail_default_level(SYSCTL_HANDLER_ARGS)
@@ -4347,9 +4353,11 @@ SYSCTL_JAIL_PARAM_SUBNODE(allow, mount, 
 SYSCTL_JAIL_PARAM(_allow_mount, , CTLTYPE_INT | CTLFLAG_RW,
 "B", "Jail may mount/unmount jail-friendly file systems in general");
 SYSCTL_JAIL_PARAM(_allow_mount, devfs, CTLTYPE_INT

svn commit: r232187 - head/usr.bin/xargs

2012-02-26 Thread Jilles Tjoelker
Author: jilles
Date: Sun Feb 26 17:39:46 2012
New Revision: 232187
URL: http://svn.freebsd.org/changeset/base/232187

Log:
  xargs: Fix comma splice in error message.
  
  Reported by:  bde

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

Modified: head/usr.bin/xargs/xargs.c
==
--- head/usr.bin/xargs/xargs.c  Sun Feb 26 16:30:39 2012(r232186)
+++ head/usr.bin/xargs/xargs.c  Sun Feb 26 17:39:46 2012(r232187)
@@ -609,10 +609,10 @@ waitchildren(const char *name, int waita
 * exit 1-125.
 */
if (WIFSIGNALED(status))
-   errx(1, "%s: terminated with signal %d, aborting",
+   errx(1, "%s: terminated with signal %d; aborting",
name, WTERMSIG(status));
if (WEXITSTATUS(status) == 255)
-   errx(1, "%s: exited with status 255, aborting", name);
+   errx(1, "%s: exited with status 255; aborting", name);
if (WEXITSTATUS(status))
rval = 1;
}
___
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: r232192 - head/sys/kern

2012-02-26 Thread Alan Cox
Author: alc
Date: Sun Feb 26 19:10:14 2012
New Revision: 232192
URL: http://svn.freebsd.org/changeset/base/232192

Log:
  Fix typo.
  
  MFC after:1 week

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Sun Feb 26 19:05:17 2012(r232191)
+++ head/sys/kern/vfs_bio.c Sun Feb 26 19:10:14 2012(r232192)
@@ -3062,7 +3062,7 @@ allocbuf(struct buf *bp, int size)
 
/*
 * We must allocate system pages since blocking
-* here could intefere with paging I/O, no
+* here could interfere with paging I/O, no
 * matter which process we are.
 *
 * We can only test VPO_BUSY here.  Blocking on
___
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: r232197 - head/sys/kern

2012-02-26 Thread Poul-Henning Kamp
Author: phk
Date: Sun Feb 26 20:56:49 2012
New Revision: 232197
URL: http://svn.freebsd.org/changeset/base/232197

Log:
  Also call the low-level driver if ->c_iflag & (IXON|IXOFF|IXANY) changes.
  
  Uftdi(4) examines (c_iflag & (IXON|IXOFF)) to control hw XON-XOFF support.
  This is obviously no good, if changes to those bits are not communicated
  down the stack.

Modified:
  head/sys/kern/tty.c

Modified: head/sys/kern/tty.c
==
--- head/sys/kern/tty.c Sun Feb 26 20:30:21 2012(r232196)
+++ head/sys/kern/tty.c Sun Feb 26 20:56:49 2012(r232197)
@@ -1481,6 +1481,8 @@ tty_generic_ioctl(struct tty *tp, u_long
 */
if ((t->c_cflag & CIGNORE) == 0 &&
(tp->t_termios.c_cflag != t->c_cflag ||
+   ((tp->t_termios.c_iflag ^ t->c_iflag) &
+   (IXON|IXOFF|IXANY)) ||
tp->t_termios.c_ispeed != t->c_ispeed ||
tp->t_termios.c_ospeed != t->c_ospeed)) {
error = ttydevsw_param(tp, t);
___
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: r232183 - head/sys/kern

2012-02-26 Thread Giovanni Trematerra
On Sun, Feb 26, 2012 at 4:14 PM, Jilles Tjoelker  wrote:
> Author: jilles
> Date: Sun Feb 26 15:14:29 2012
> New Revision: 232183
> URL: http://svn.freebsd.org/changeset/base/232183
>
> Log:
>  Fix fchmod() and fchown() on fifos.
>
>  The new fifo implementation in r232055 broke fchmod() and fchown() on fifos.
>  Postfix needs this.
>
>  Submitted by: gianni
>  Reported by:  dougb
>
> Modified:
>  head/sys/kern/sys_pipe.c
>

Thank you.
And just for the record:

Pointy hat to: gianni
___
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: r232183 - head/sys/kern

2012-02-26 Thread Ed Schouten
Hi Jilles,

* Jilles Tjoelker , 20120226 16:14:
> +static int
> +pipe_chmod(fp, mode, active_cred, td)
> + struct file *fp;
> + mode_t mode;
> + struct ucred *active_cred;
> + struct thread *td;
> +{
> + struct pipe *cpipe;
> + int error;
> +
> + cpipe = fp->f_data;
> + if (cpipe->pipe_state & PIPE_NAMED)
> + error = vn_chmod(fp, mode, active_cred, td);
> + else
> + error = invfo_chmod(fp, mode, active_cred, td);
> + return (error);
> +}

Maybe this would be a useless optimisation, but wouldn't it be better to
just use two separate struct fileops here?

-- 
 Ed Schouten 
 WWW: http://80386.nl/


pgpG4wj7wUTnj.pgp
Description: PGP signature


svn commit: r232199 - head/sys/x86/cpufreq

2012-02-26 Thread Alexander Kabaev
Author: kan
Date: Sun Feb 26 21:24:27 2012
New Revision: 232199
URL: http://svn.freebsd.org/changeset/base/232199

Log:
  Fix apparent logic reversal in setting the 'auto_mode' flag.
  
  MFC after: 2 weeks

Modified:
  head/sys/x86/cpufreq/p4tcc.c

Modified: head/sys/x86/cpufreq/p4tcc.c
==
--- head/sys/x86/cpufreq/p4tcc.cSun Feb 26 21:24:02 2012
(r232198)
+++ head/sys/x86/cpufreq/p4tcc.cSun Feb 26 21:24:27 2012
(r232199)
@@ -276,9 +276,9 @@ p4tcc_set(device_t dev, const struct cf_
 * what the current mode.
 */
if (msr & TCC_ENABLE_ONDEMAND)
-   sc->auto_mode = TRUE;
-   else
sc->auto_mode = FALSE;
+   else
+   sc->auto_mode = TRUE;
 
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: r232200 - in head/usr.sbin/bsdinstall: distextract distfetch

2012-02-26 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Feb 26 22:09:21 2012
New Revision: 232200
URL: http://svn.freebsd.org/changeset/base/232200

Log:
  Fix segfault if distfetch and distextract binaries are run standalone
  without the DISTRIBUTIONS environment variable set.
  
  PR:   bin/165492
  Submitted by: Fernando Apesteguia
  MFC after:4 days

Modified:
  head/usr.sbin/bsdinstall/distextract/distextract.c
  head/usr.sbin/bsdinstall/distfetch/distfetch.c

Modified: head/usr.sbin/bsdinstall/distextract/distextract.c
==
--- head/usr.sbin/bsdinstall/distextract/distextract.c  Sun Feb 26 21:24:27 
2012(r232199)
+++ head/usr.sbin/bsdinstall/distextract/distextract.c  Sun Feb 26 22:09:21 
2012(r232200)
@@ -38,9 +38,16 @@ static int extract_files(int nfiles, con
 int
 main(void)
 {
-   char *diststring = strdup(getenv("DISTRIBUTIONS"));
+   char *diststring;
const char **dists;
int i, retval, ndists = 0;
+
+   if (getenv("DISTRIBUTIONS") == NULL) {
+   fprintf(stderr, "DISTRIBUTIONS variable is not set\n");
+   return (1);
+   }
+
+   diststring = strdup(getenv("DISTRIBUTIONS"));
for (i = 0; diststring[i] != 0; i++)
if (isspace(diststring[i]) && !isspace(diststring[i+1]))
ndists++;

Modified: head/usr.sbin/bsdinstall/distfetch/distfetch.c
==
--- head/usr.sbin/bsdinstall/distfetch/distfetch.c  Sun Feb 26 21:24:27 
2012(r232199)
+++ head/usr.sbin/bsdinstall/distfetch/distfetch.c  Sun Feb 26 22:09:21 
2012(r232200)
@@ -37,9 +37,16 @@ static int fetch_files(int nfiles, char 
 int
 main(void)
 {
-   char *diststring = strdup(getenv("DISTRIBUTIONS"));
+   char *diststring;
char **urls;
int i, nfetched, ndists = 0;
+
+   if (getenv("DISTRIBUTIONS") == NULL) {
+   fprintf(stderr, "DISTRIBUTIONS variable is not set\n");
+   return (1);
+   }
+
+   diststring = strdup(getenv("DISTRIBUTIONS"));
for (i = 0; diststring[i] != 0; i++)
if (isspace(diststring[i]) && !isspace(diststring[i+1]))
ndists++;
___
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: r232183 - head/sys/kern

2012-02-26 Thread Giovanni Trematerra
On Sun, Feb 26, 2012 at 10:12 PM, Ed Schouten  wrote:
> Hi Jilles,
>
> * Jilles Tjoelker , 20120226 16:14:
>> +static int
>> +pipe_chmod(fp, mode, active_cred, td)
>> +     struct file *fp;
>> +     mode_t mode;
>> +     struct ucred *active_cred;
>> +     struct thread *td;
>> +{
>> +     struct pipe *cpipe;
>> +     int error;
>> +
>> +     cpipe = fp->f_data;
>> +     if (cpipe->pipe_state & PIPE_NAMED)
>> +             error = vn_chmod(fp, mode, active_cred, td);
>> +     else
>> +             error = invfo_chmod(fp, mode, active_cred, td);
>> +     return (error);
>> +}
>
> Maybe this would be a useless optimisation, but wouldn't it be better to
> just use two separate struct fileops here?
>

I don't think the problem here is related to performance.
it might be a problem of readability.
I prefer to use one fileops for pipes and fifos just to remark
that fifos are actual pipes.
If others think that would be better to have two separated fileops,
for readability, I'm not against it.

--
Gianni
___
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: r232201 - head/usr.bin/xargs

2012-02-26 Thread Jilles Tjoelker
Author: jilles
Date: Sun Feb 26 23:06:30 2012
New Revision: 232201
URL: http://svn.freebsd.org/changeset/base/232201

Log:
  xargs: Remove an unclear comment that only tried to repeat what the code did
  
  Reported by:  bde

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

Modified: head/usr.bin/xargs/xargs.c
==
--- head/usr.bin/xargs/xargs.c  Sun Feb 26 22:09:21 2012(r232200)
+++ head/usr.bin/xargs/xargs.c  Sun Feb 26 23:06:30 2012(r232201)
@@ -604,10 +604,6 @@ waitchildren(const char *name, int waita
errno = childerr;
err(errno == ENOENT ? 127 : 126, "%s", name);
}
-   /*
-* If utility signaled or exited with a value of 255,
-* exit 1-125.
-*/
if (WIFSIGNALED(status))
errx(1, "%s: terminated with signal %d; aborting",
name, WTERMSIG(status));
___
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: r232108 - head/usr.bin/xargs

2012-02-26 Thread Jilles Tjoelker
On Sat, Feb 25, 2012 at 09:10:04AM +1100, Bruce Evans wrote:
> On Fri, 24 Feb 2012, Jilles Tjoelker wrote:
> 
> > On Sat, Feb 25, 2012 at 04:27:35AM +1100, Bruce Evans wrote:
> > ...
> >> Utilities are quite broken near here too:
> >> - under -current:
> >>- utilities still don't support signals >= 32, but give better error
> >>  messages.
> >
> > kill(1) (both /bin/kill and the 9.x/10.x sh builtin) has passed
> > arbitrary signal numbers to kill(2) for quite a while.
> 
> Apparently I got confused by testing several versions.  In -current,
> the bugs are just that:
> - bash-4.2 builtin kill doesn't understand signals >= 32, despite
>supposedly being configured for FreeBSD
> - bash-4.2 prints confusing termination messages which made me think
>that /bin/kill didn't work:
>- for signal 127, it prints "Stopped ..."
>- for signal 126, it prints "Unknown signal: 126".  I didn't notice
>  this was printed by bash(1) and not by kill(1).

> A bug in builtin kill turned up: with kill(1), both bash and sh print
> the termination message immediately, with builtin kill neither prints
> it until a newline is entered.

That's not a bug, but a normal race condition. With external kill, the
kill process usually takes long enough to shut down and be waited for
that the kill victim will have terminated too. With builtin kill, the
shell proceeds very quickly and often the kill victim will not have
terminated yet.

> >> Neither WIFSTOPPED() nor WIFEXITED() are tested, so the result of the
> >> misclassification is turning signal 127 into a normal exit with status
> >> 0.  A normal WIFSTOPPED() should not get here, else job control would
> >> just break xargs, so the bug can probably be worked around by turning
> >> WIFSTOPPED() into WIFSIGNALED() here, or just blindly using WTERMSIG()
> >> != 0 to classify signals.

> > I don't think xargs should work around that bug, particularly not by
> > introducing unspecified behaviour (the value of WTERMSIG(x) when
> > !WIFSIGNALED(x)).

> OK.  So it needs to be disallowed in the kernel.

Hmm. The kernel allows 0 <= sig <= 128 (_SIG_MAXSIG). It also allows
signals 33..64 which do not have a documented meaning.

I wonder what will break if I change _SIG_MAXSIG to 126. This will
disallow all operations on signals 127 and 128 and change the sigacts
structure. Alternatively, the check in sys_kill() and friends could be
tightened.

-- 
Jilles Tjoelker
___
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: r232074 - head/sys/cam/ctl

2012-02-26 Thread Pawel Worach
On Feb 24, 2012, at 12:09, Dimitry Andric wrote:
> On 2012-02-24 10:38, Alexander Best wrote:
>> is the clang version in base able to do complete universe builds for i386 and
>> amd64 without the need for NO_WERROR= and WERROR= now?
> 
> "universe" means all arches, and all kernel configs, so no.  The status
> for head with clang is as follows:
> 
> - buildworld with default options, e.g. no WITH_XXX or WITHOUT_XXX
>  settings, will complete without any (fatal) warnings.
> - buildkernel of the default GENERIC config still has one warning left,
>  in sys/dev/mps/mps_sas.c.  It should be simple to fix, but I'm
>  checking it with Ken first.
> - The LINT kernel configs probably have many warnings left.  I haven't
>  tested those extensively.
> 
> As soon as world & kernel compile without warnings, I'd like to have a
> tinderbox that continually builds with clang.  So head won't be
> regressing any more. :)
> 
> 
>> ps: are there any plans to add support for compiling kernel+userland with 
>> clang
>> tot? maybe this can be accomplished by doing something like
>> 
>> echo "WITH_CLANG_TOT=yes" >> /etc/src.conf
> 
> I'm not working on this at the moment.  Pawel Worach (CC'd) has a
> buildbot setup that builds FreeBSD daily with clang ToT.  Apparently
> just a few patches are needed.

You will find all the patches and hacks to build FreeBSD with llvm/clang trunk 
here:
http://llvm-amd64.freebsd.your.org/patches/

clang-*.diff contains the FreeBSD local changes, -fformat-extensions and 
worldtmp prefix stuff.
freebsd-*.diff contains the patches for FreeBSD to fix/disable -Werror warnings 
found by clang trunk
and needed hacks to the build infrastructure to use an out-of-tree compiler.

Just set CC and CXX to the *full path* of your custom version of clang.

>> which will turn all -Wformat-invalid-specifier and -Wformat-extra-args errors
>> into warnings (because clang tot doesn't support -fformat-extensions)?
> 
> It would be better to push our format extensions upstream, I think.
> Though the option should probably be renamed to something else, e.g.
> -ffreebsd-extensions, or such.

-- 
Pawel


___
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: r232108 - head/usr.bin/xargs

2012-02-26 Thread Bruce Evans

On Mon, 27 Feb 2012, Jilles Tjoelker wrote:


On Sat, Feb 25, 2012 at 09:10:04AM +1100, Bruce Evans wrote:

On Fri, 24 Feb 2012, Jilles Tjoelker wrote:



I don't think xargs should work around that bug, particularly not by
introducing unspecified behaviour (the value of WTERMSIG(x) when
!WIFSIGNALED(x)).



OK.  So it needs to be disallowed in the kernel.


Hmm. The kernel allows 0 <= sig <= 128 (_SIG_MAXSIG). It also allows
signals 33..64 which do not have a documented meaning.

I wonder what will break if I change _SIG_MAXSIG to 126. This will
disallow all operations on signals 127 and 128 and change the sigacts
structure. Alternatively, the check in sys_kill() and friends could be
tightened.


I forgot about the extra one.  128 gives slightly more brokenness than
127 -- shells are confused by it, and turn it into $? = 0.  Was the
old PR about #127 or #128 or both?

I think nothing should be using these signals, so nothing should break
if you change _SIG_MAXSIG to 126 and change the sigacts struct to use
a harder-coded 128.

Bruce
___
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: r232202 - head/usr.sbin/cron/crontab

2012-02-26 Thread Xin LI
Author: delphij
Date: Mon Feb 27 05:49:00 2012
New Revision: 232202
URL: http://svn.freebsd.org/changeset/base/232202

Log:
  Drop setuid status while doing file operations to prevent potential
  information leak.  This changeset is intended to be a minimal one
  to make backports easier.
  
  Reviewed by:  kevlo, remko
  MFC after:1 week

Modified:
  head/usr.sbin/cron/crontab/crontab.c

Modified: head/usr.sbin/cron/crontab/crontab.c
==
--- head/usr.sbin/cron/crontab/crontab.cSun Feb 26 23:06:30 2012
(r232201)
+++ head/usr.sbin/cron/crontab/crontab.cMon Feb 27 05:49:00 2012
(r232202)
@@ -194,6 +194,17 @@ parse_args(argc, argv)
}
 
if (Option == opt_replace) {
+   /* relinquish the setuid status of the binary during
+* the open, lest nonroot users read files they should
+* not be able to read.  we can't use access() here
+* since there's a race condition.  thanks go out to
+* Arnt Gulbrandsen  for spotting
+* the race.
+*/
+
+   if (swap_uids() < OK)
+   err(ERROR_EXIT, "swapping uids");
+
/* we have to open the file here because we're going to
 * chdir(2) into /var/cron before we get around to
 * reading the file.
@@ -204,21 +215,11 @@ parse_args(argc, argv)
!strcmp(resolved_path, SYSCRONTAB)) {
err(ERROR_EXIT, SYSCRONTAB " must be edited manually");
} else {
-   /* relinquish the setuid status of the binary during
-* the open, lest nonroot users read files they should
-* not be able to read.  we can't use access() here
-* since there's a race condition.  thanks go out to
-* Arnt Gulbrandsen  for spotting
-* the race.
-*/
-
-   if (swap_uids() < OK)
-   err(ERROR_EXIT, "swapping uids");
if (!(NewCrontab = fopen(Filename, "r")))
err(ERROR_EXIT, "%s", Filename);
-   if (swap_uids_back() < OK)
-   err(ERROR_EXIT, "swapping uids back");
}
+   if (swap_uids_back() < OK)
+   err(ERROR_EXIT, "swapping uids back");
}
 
Debug(DMISC, ("user=%s, file=%s, option=%s\n",
@@ -363,11 +364,15 @@ edit_cmd() {
goto fatal;
}
  again:
+   if (swap_uids() < OK)
+   err(ERROR_EXIT, "swapping uids");
if (stat(Filename, &statbuf) < 0) {
warn("stat");
  fatal:unlink(Filename);
exit(ERROR_EXIT);
}
+   if (swap_uids_back() < OK)
+   err(ERROR_EXIT, "swapping uids back");
if (statbuf.st_dev != fsbuf.st_dev || statbuf.st_ino != fsbuf.st_ino)
errx(ERROR_EXIT, "temp file must be edited in place");
if (MD5File(Filename, orig_md5) == NULL) {
@@ -433,6 +438,8 @@ edit_cmd() {
editor, WTERMSIG(waiter), WCOREDUMP(waiter) ?"" :"no ");
goto fatal;
}
+   if (swap_uids() < OK)
+   err(ERROR_EXIT, "swapping uids");
if (stat(Filename, &statbuf) < 0) {
warn("stat");
goto fatal;
@@ -443,6 +450,8 @@ edit_cmd() {
warn("MD5");
goto fatal;
}
+   if (swap_uids_back() < OK)
+   err(ERROR_EXIT, "swapping uids back");
if (strcmp(orig_md5, new_md5) == 0 && !syntax_error) {
warnx("no changes made to crontab");
goto remove;
___
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"