svn commit: r244418 - head/sys/cam/scsi

2012-12-19 Thread Alexander Motin
Author: mav
Date: Wed Dec 19 09:55:13 2012
New Revision: 244418
URL: http://svnweb.freebsd.org/changeset/base/244418

Log:
  Fix bug in r242720, that caused additional status page to not be used if
  descriptor page is supported.

Modified:
  head/sys/cam/scsi/scsi_enc_ses.c

Modified: head/sys/cam/scsi/scsi_enc_ses.c
==
--- head/sys/cam/scsi/scsi_enc_ses.cWed Dec 19 05:07:27 2012
(r244417)
+++ head/sys/cam/scsi/scsi_enc_ses.cWed Dec 19 09:55:13 2012
(r244418)
@@ -1272,13 +1272,10 @@ ses_process_pages(enc_softc_t *enc, stru
 
err = 0;
for (i = 0; i < length; i++) {
-   if (page->params[i] == SesElementDescriptor) {
+   if (page->params[i] == SesElementDescriptor)
ses->ses_flags |= SES_FLAG_DESC;
-   break;
-   } else if (page->params[i] == SesAddlElementStatus) {
+   else if (page->params[i] == SesAddlElementStatus)
ses->ses_flags |= SES_FLAG_ADDLSTATUS;
-   break;
-   }
}
 
 out:
___
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: r244383 - head/etc

2012-12-19 Thread Andrey Zonov
On 12/18/12 1:51 PM, Robert Watson wrote:
> 
> On Tue, 18 Dec 2012, Robert Watson wrote:
> 
>>> Log:
>>>  - Set memorylocked limit to 64Kb for default login class.
>>>This prevents unprivileged users to lock too much memory.
>>>  - Set memorylocked limit to 64Mb for daemon login class.
>>>Some daemons such as amd(8) and watchdogd(8) calls mlockall(2) on
>>>startup, they are run from init(8) which uses daemon login class.
>>>  - Set memorylocked limit to unlimited for root login class.
>>>
>>>  Suggested by:avg
>>>  Approved by:kib (mentor)
>>>  MFC after:1 week
>>
>> I think you should not MFC this one quickly -- let's wait for it to
>> shake out in the -CURRENT userbase for a few months to see what
>> breaks.  I wouldn't be surprised if a fair number of applications
>> (both publicly available, and local at various FreeBSD-using shops)
>> are implicitly depending on their not being limits to memorylocked by
>> default.  After an upgrade, they might find that their applications
>> simply stop working for potentially hard-to-debug reasons.
>>
>> Or we might find no one notices -- but deferring an MFC will help give
>> us a better sense of which outcome is more likely.
> 
> ... or maybe this doesn't matter before your later sysctl commit?
> 

Yes.  This change should not hurt anybody, because I change defaults for
vm.old_mlock and security.bsd.unprivileged_mlock for stable.

-- 
Andrey Zonov



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r244385 - head/sys/kern

2012-12-19 Thread Andrey Zonov
On 12/18/12 6:38 PM, Ivan Voras wrote:
> On 18 December 2012 08:36, Andrey Zonov  wrote:
>> Author: zont
>> Date: Tue Dec 18 07:36:45 2012
>> New Revision: 244385
>> URL: http://svnweb.freebsd.org/changeset/base/244385
>>
>> Log:
>>   - Add sysctl to allow unprivileged users to call mlock(2)-family system
>> calls and turn it on.
>>   - Do not allow to call them inside jail. [1]
> 
> There's a sysctl branch security.jail.param.allow. which might be
> useful here to add for jails.
> 

This one is on my list.

-- 
Andrey Zonov



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r244383 - head/etc

2012-12-19 Thread Robert N. M. Watson

On 19 Dec 2012, at 10:57, Andrey Zonov wrote:

>>> I think you should not MFC this one quickly -- let's wait for it to
>>> shake out in the -CURRENT userbase for a few months to see what
>>> breaks.  I wouldn't be surprised if a fair number of applications
>>> (both publicly available, and local at various FreeBSD-using shops)
>>> are implicitly depending on their not being limits to memorylocked by
>>> default.  After an upgrade, they might find that their applications
>>> simply stop working for potentially hard-to-debug reasons.
>>> 
>>> Or we might find no one notices -- but deferring an MFC will help give
>>> us a better sense of which outcome is more likely.
>> 
>> ... or maybe this doesn't matter before your later sysctl commit?
> 
> Yes.  This change should not hurt anybody, because I change defaults for
> vm.old_mlock and security.bsd.unprivileged_mlock for stable.

Very exciting indeed, then! Lots of gpg/etc users will appreciate this greatly.

Robert
___
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: r244424 - head/sys/kern

2012-12-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Dec 19 12:00:09 2012
New Revision: 244424
URL: http://svnweb.freebsd.org/changeset/base/244424

Log:
  The expand_name() function isn't called with the process lock held anymore,
  so we can safely use malloc(M_WAITOK) now.
  
  Pointed out by:   kib

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cWed Dec 19 11:17:08 2012(r244423)
+++ head/sys/kern/kern_sig.cWed Dec 19 12:00:09 2012(r244424)
@@ -3057,9 +3057,7 @@ expand_name(const char *comm, uid_t uid,
 
hostname = NULL;
format = corefilename;
-   name = malloc(MAXPATHLEN, M_TEMP, M_NOWAIT | M_ZERO);
-   if (name == NULL)
-   return (NULL);
+   name = malloc(MAXPATHLEN, M_TEMP, M_WAITOK | M_ZERO);
indexpos = -1;
(void)sbuf_new(&sb, name, MAXPATHLEN, SBUF_FIXEDLEN);
for (i = 0; format[i]; i++) {
@@ -3073,16 +3071,7 @@ expand_name(const char *comm, uid_t uid,
case 'H':   /* hostname */
if (hostname == NULL) {
hostname = malloc(MAXHOSTNAMELEN,
-   M_TEMP, M_NOWAIT);
-   if (hostname == NULL) {
-   log(LOG_ERR,
-   "pid %ld (%s), uid (%lu): "
-   "unable to alloc memory "
-   "for corefile hostname\n",
-   (long)pid, comm,
-   (u_long)uid);
-goto nomem;
-}
+   M_TEMP, M_WAITOK);
 }
getcredhostname(td->td_ucred, hostname,
MAXHOSTNAMELEN);
@@ -3119,7 +3108,6 @@ expand_name(const char *comm, uid_t uid,
if (sbuf_error(&sb) != 0) {
log(LOG_ERR, "pid %ld (%s), uid (%lu): corename is too "
"long\n", (long)pid, comm, (u_long)uid);
-nomem:
sbuf_delete(&sb);
free(name, M_TEMP);
return (NULL);
___
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: r244426 - head/sys/kern

2012-12-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Dec 19 12:10:14 2012
New Revision: 244426
URL: http://svnweb.freebsd.org/changeset/base/244426

Log:
  Style cleanups.

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cWed Dec 19 12:09:02 2012(r244425)
+++ head/sys/kern/kern_sig.cWed Dec 19 12:10:14 2012(r244426)
@@ -202,37 +202,37 @@ SYSCTL_INT(_kern, OID_AUTO, nodump_cored
 #defineSA_CANTMASK 0x40/* non-maskable, catchable */
 
 static int sigproptbl[NSIG] = {
-SA_KILL,   /* SIGHUP */
-SA_KILL,   /* SIGINT */
-SA_KILL|SA_CORE,   /* SIGQUIT */
-SA_KILL|SA_CORE,   /* SIGILL */
-SA_KILL|SA_CORE,   /* SIGTRAP */
-SA_KILL|SA_CORE,   /* SIGABRT */
-SA_KILL|SA_CORE,   /* SIGEMT */
-SA_KILL|SA_CORE,   /* SIGFPE */
-SA_KILL,   /* SIGKILL */
-SA_KILL|SA_CORE,   /* SIGBUS */
-SA_KILL|SA_CORE,   /* SIGSEGV */
-SA_KILL|SA_CORE,   /* SIGSYS */
-SA_KILL,   /* SIGPIPE */
-SA_KILL,   /* SIGALRM */
-SA_KILL,   /* SIGTERM */
-SA_IGNORE, /* SIGURG */
-SA_STOP,   /* SIGSTOP */
-SA_STOP|SA_TTYSTOP,/* SIGTSTP */
-SA_IGNORE|SA_CONT, /* SIGCONT */
-SA_IGNORE, /* SIGCHLD */
-SA_STOP|SA_TTYSTOP,/* SIGTTIN */
-SA_STOP|SA_TTYSTOP,/* SIGTTOU */
-SA_IGNORE, /* SIGIO */
-SA_KILL,   /* SIGXCPU */
-SA_KILL,   /* SIGXFSZ */
-SA_KILL,   /* SIGVTALRM */
-SA_KILL,   /* SIGPROF */
-SA_IGNORE, /* SIGWINCH  */
-SA_IGNORE, /* SIGINFO */
-SA_KILL,   /* SIGUSR1 */
-SA_KILL,   /* SIGUSR2 */
+   SA_KILL,/* SIGHUP */
+   SA_KILL,/* SIGINT */
+   SA_KILL|SA_CORE,/* SIGQUIT */
+   SA_KILL|SA_CORE,/* SIGILL */
+   SA_KILL|SA_CORE,/* SIGTRAP */
+   SA_KILL|SA_CORE,/* SIGABRT */
+   SA_KILL|SA_CORE,/* SIGEMT */
+   SA_KILL|SA_CORE,/* SIGFPE */
+   SA_KILL,/* SIGKILL */
+   SA_KILL|SA_CORE,/* SIGBUS */
+   SA_KILL|SA_CORE,/* SIGSEGV */
+   SA_KILL|SA_CORE,/* SIGSYS */
+   SA_KILL,/* SIGPIPE */
+   SA_KILL,/* SIGALRM */
+   SA_KILL,/* SIGTERM */
+   SA_IGNORE,  /* SIGURG */
+   SA_STOP,/* SIGSTOP */
+   SA_STOP|SA_TTYSTOP, /* SIGTSTP */
+   SA_IGNORE|SA_CONT,  /* SIGCONT */
+   SA_IGNORE,  /* SIGCHLD */
+   SA_STOP|SA_TTYSTOP, /* SIGTTIN */
+   SA_STOP|SA_TTYSTOP, /* SIGTTOU */
+   SA_IGNORE,  /* SIGIO */
+   SA_KILL,/* SIGXCPU */
+   SA_KILL,/* SIGXFSZ */
+   SA_KILL,/* SIGVTALRM */
+   SA_KILL,/* SIGPROF */
+   SA_IGNORE,  /* SIGWINCH  */
+   SA_IGNORE,  /* SIGINFO */
+   SA_KILL,/* SIGUSR1 */
+   SA_KILL,/* SIGUSR2 */
 };
 
 static void reschedule_signals(struct proc *p, sigset_t block, int flags);
@@ -3018,11 +3018,11 @@ SYSCTL_PROC(_debug, OID_AUTO, ncores, CT
 #if defined(COMPRESS_USER_CORES)
 int compress_user_cores = 1;
 SYSCTL_INT(_kern, OID_AUTO, compress_user_cores, CTLFLAG_RW,
-&compress_user_cores, 0, "");
+&compress_user_cores, 0, "Compression of user corefiles");
 
 int compress_user_cores_gzlevel = -1; /* default level */
 SYSCTL_INT(_kern, OID_AUTO, compress_user_cores_gzlevel, CTLFLAG_RW,
-&compress_user_cores_gzlevel, -1, "user core gz compression level");
+&compress_user_cores_gzlevel, -1, "Corefile gzip compression level");
 
 #define GZ_SUFFIX  ".gz"
 #define GZ_SUFFIX_LEN  3
@@ -3031,7 +3031,7 @@ SYSCTL_INT(_kern, OID_AUTO, compress_use
 static char corefilename[MAXPATHLEN] = {"%N.core"};
 TUNABLE_STR("kern.corefile", corefilename, sizeof(corefilename));
 SYSCTL_STRING(_kern, OID_AUTO, corefile, CTLFLAG_RW, corefilename,
- sizeof(corefilename), "process corefile name format string");
+   

svn commit: r244428 - head/sys/kern

2012-12-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Dec 19 12:12:53 2012
New Revision: 244428
URL: http://svnweb.freebsd.org/changeset/base/244428

Log:
  Do not audit paths we try when kern.corefile contains %I.
  
  Obtained from:WHEEL Systems

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cWed Dec 19 12:12:24 2012(r244427)
+++ head/sys/kern/kern_sig.cWed Dec 19 12:12:53 2012(r244428)
@@ -3127,7 +3127,8 @@ expand_name(const char *comm, uid_t uid,
 
flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW;
cmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
-   oflags = capmode_coredump ? VN_OPEN_NOCAPCHECK : 0;
+   oflags = VN_OPEN_NOAUDIT |
+   (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0);
 
for (i = 0; i < num_cores; i++) {
name[indexpos] = '0' + i;
___
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: r244429 - head/sys/kern

2012-12-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Dec 19 12:14:08 2012
New Revision: 244429
URL: http://svnweb.freebsd.org/changeset/base/244429

Log:
  The 'flags' argument can be modified in vn_open_cred(), so we need to
  set it for every loop interation.
  
  Pointed out by:   kib

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cWed Dec 19 12:12:53 2012(r244428)
+++ head/sys/kern/kern_sig.cWed Dec 19 12:14:08 2012(r244429)
@@ -3125,12 +3125,12 @@ expand_name(const char *comm, uid_t uid,
struct nameidata nd;
int cmode, flags, oflags, error;
 
-   flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW;
cmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
oflags = VN_OPEN_NOAUDIT |
(capmode_coredump ? VN_OPEN_NOCAPCHECK : 0);
 
for (i = 0; i < num_cores; i++) {
+   flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW;
name[indexpos] = '0' + i;
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE,
name, td);
___
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: r244389 - head/sys/dev/wtap

2012-12-19 Thread Bruce Evans

On Tue, 18 Dec 2012, Gleb Smirnoff wrote:


On Tue, Dec 18, 2012 at 08:44:59AM +, Monthadar Al Jaberi wrote:
...
M> Modified: head/sys/dev/wtap/if_wtap.c
M> 
==
M> --- head/sys/dev/wtap/if_wtap.c   Tue Dec 18 08:41:23 2012(r244388)
M> +++ head/sys/dev/wtap/if_wtap.c   Tue Dec 18 08:44:59 2012(r244389)
M> @@ -334,6 +334,10 @@ wtap_vap_create(struct ieee80211com *ic,
M>   vap = (struct ieee80211vap *) avp;
M>   error = ieee80211_vap_setup(ic, vap, name, unit, IEEE80211_M_MBSS,
M>   flags | IEEE80211_CLONE_NOBEACONS, bssid, mac);
M> + if (error) {
M> + free((struct wtap_vap*) vap, M_80211_VAP);
M> + return NULL;
M> + }
M>
M>   /* override various methods */
M>   avp->av_recv_mgmt = vap->iv_recv_mgmt;

You don't need to cast first argument of free(9). And you don't need a cast
before malloc(9) as well.


A cast might be needed if free()'s arg is a point to constant storage.
This is not the case here.


...
Also, more stylish would be to supply to free() the same variable that was
assigned at malloc(9) call, in this particular case it is "avp".


Another style bug is associated with this.  free() does's take args of
type struct wtap_vap*.  Casting to that converts vap back to the type
of avp, but not to either original type returned by malloc() or the
type taken by free().

Also, in KNF:
- casts are not followed by a space
- '*' (in almost all contexts, including the above) is preceded by a space.

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"


Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Andrey Zonov
On 12/14/12 3:32 AM, Xin LI wrote:
> Author: delphij
> Date: Thu Dec 13 23:32:47 2012
> New Revision: 244198
> URL: http://svnweb.freebsd.org/changeset/base/244198
> 
> Log:
>   Teach sysctl(8) about parsing a file (while I'm there also give it
>   capability of parsing both = and : formats).
>   
>   Submitted by:   hrs (initial version, bugs are mine)
>   MFC after:  3 months
> 
> Modified:
>   head/etc/rc.d/sysctl
>   head/sbin/sysctl/sysctl.8
>   head/sbin/sysctl/sysctl.c
> 
> Modified: head/etc/rc.d/sysctl
> ==
> --- head/etc/rc.d/sysctl  Thu Dec 13 23:19:13 2012(r244197)
> +++ head/etc/rc.d/sysctl  Thu Dec 13 23:32:47 2012(r244198)
> @@ -8,51 +8,27 @@
>  . /etc/rc.subr
>  
>  name="sysctl"
> +command="/sbin/sysctl"
>  stop_cmd=":"
>  start_cmd="sysctl_start"
>  reload_cmd="sysctl_start"
>  lastload_cmd="sysctl_start last"
>  extra_commands="reload lastload"
>  
> -#
> -# Read in a file containing sysctl settings and set things accordingly.
> -#
> -parse_file()
> -{
> - if [ -f $1 ]; then
> - while read var comments
> - do
> - case ${var} in
> - \#*|'')
> - ;;
> - *)
> - mib=${var%=*}
> - val=${var#*=}
> -
> - if current_value=`${SYSCTL} -n ${mib} 
> 2>/dev/null`; then
> - case ${current_value} in
> - ${val})
> - ;;
> - *)
> - if ! sysctl "${var}" >/dev/null 
> 2>&1; then
> - warn "unable to set 
> ${var}"
> - fi
> - ;;
> - esac
> - elif [ "$2" = "last" ]; then
> - warn "sysctl ${mib} does not exist."
> - fi
> - ;;
> - esac
> - done < $1
> - fi
> -}
> -
>  sysctl_start()
>  {
> -
> - parse_file /etc/sysctl.conf $1
> - parse_file /etc/sysctl.conf.local $1
> + case $1 in
> + last)
> + command_args="-i -f"
> + ;;
> + *)
> + command_args="-f"
> + ;;
> + esac
> +
> + for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
> + [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
> + done
>  }
>  
>  load_rc_config $name
> 

Hi,

I'd really like to see something like the patch bellow in the tree.  I
found it very useful with cfengine configuration (as like as cron.d).

What do think?

diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl
index 36f1414..014e4c5 100755
--- a/etc/rc.d/sysctl
+++ b/etc/rc.d/sysctl
@@ -26,7 +26,7 @@ sysctl_start()
;;
esac

-   for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
+   for _f in `ls /etc/sysctl.d/* 2> /dev/null` /etc/sysctl.conf
/etc/sysctl.conf.local; do
[ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
done
 }

-- 
Andrey Zonov



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Ian Lepore
On Wed, 2012-12-19 at 19:02 +0400, Andrey Zonov wrote:
> On 12/14/12 3:32 AM, Xin LI wrote:
> > Author: delphij
> > Date: Thu Dec 13 23:32:47 2012
> > New Revision: 244198
> > URL: http://svnweb.freebsd.org/changeset/base/244198
> > 
> > Log:
> >   Teach sysctl(8) about parsing a file (while I'm there also give it
> >   capability of parsing both = and : formats).
> >   
> >   Submitted by: hrs (initial version, bugs are mine)
> >   MFC after:3 months
> > 
> > Modified:
> >   head/etc/rc.d/sysctl
> >   head/sbin/sysctl/sysctl.8
> >   head/sbin/sysctl/sysctl.c
> > 
> > Modified: head/etc/rc.d/sysctl
> > ==
> > --- head/etc/rc.d/sysctlThu Dec 13 23:19:13 2012(r244197)
> > +++ head/etc/rc.d/sysctlThu Dec 13 23:32:47 2012(r244198)
> > @@ -8,51 +8,27 @@
> >  . /etc/rc.subr
> >  
> >  name="sysctl"
> > +command="/sbin/sysctl"
> >  stop_cmd=":"
> >  start_cmd="sysctl_start"
> >  reload_cmd="sysctl_start"
> >  lastload_cmd="sysctl_start last"
> >  extra_commands="reload lastload"
> >  
> > -#
> > -# Read in a file containing sysctl settings and set things accordingly.
> > -#
> > -parse_file()
> > -{
> > -   if [ -f $1 ]; then
> > -   while read var comments
> > -   do
> > -   case ${var} in
> > -   \#*|'')
> > -   ;;
> > -   *)
> > -   mib=${var%=*}
> > -   val=${var#*=}
> > -
> > -   if current_value=`${SYSCTL} -n ${mib} 
> > 2>/dev/null`; then
> > -   case ${current_value} in
> > -   ${val})
> > -   ;;
> > -   *)
> > -   if ! sysctl "${var}" >/dev/null 
> > 2>&1; then
> > -   warn "unable to set 
> > ${var}"
> > -   fi
> > -   ;;
> > -   esac
> > -   elif [ "$2" = "last" ]; then
> > -   warn "sysctl ${mib} does not exist."
> > -   fi
> > -   ;;
> > -   esac
> > -   done < $1
> > -   fi
> > -}
> > -
> >  sysctl_start()
> >  {
> > -
> > -   parse_file /etc/sysctl.conf $1
> > -   parse_file /etc/sysctl.conf.local $1
> > +   case $1 in
> > +   last)
> > +   command_args="-i -f"
> > +   ;;
> > +   *)
> > +   command_args="-f"
> > +   ;;
> > +   esac
> > +
> > +   for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
> > +   [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
> > +   done
> >  }
> >  
> >  load_rc_config $name
> > 
> 
> Hi,
> 
> I'd really like to see something like the patch bellow in the tree.  I
> found it very useful with cfengine configuration (as like as cron.d).
> 
> What do think?
> 
> diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl
> index 36f1414..014e4c5 100755
> --- a/etc/rc.d/sysctl
> +++ b/etc/rc.d/sysctl
> @@ -26,7 +26,7 @@ sysctl_start()
> ;;
> esac
> 
> -   for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
> +   for _f in `ls /etc/sysctl.d/* 2> /dev/null` /etc/sysctl.conf
> /etc/sysctl.conf.local; do
> [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
> done
>  }
> 

Instead of running sysctl a bunch of times, how about something
conceptually similar to

   cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f -

Along with this (untested) patch to make sysctl understand "-f -".

Hmmm, is /dev/stdin available as early as sysctl.conf runs?  If not, the
attached patch isn't going to work.

-- Ian

diff -r cc5bd6d80aa1 sbin/sysctl/sysctl.c
--- sbin/sysctl/sysctl.c	Sun Aug 19 11:01:08 2012 -0600
+++ sbin/sysctl/sysctl.c	Wed Dec 19 08:31:14 2012 -0700
@@ -112,7 +112,10 @@ main(int argc, char **argv)
 			eflag = 1;
 			break;
 		case 'f':
-			conffile = optarg;
+			if (strcmp(optarg, "-") == 0)
+conffile = "/dev/stdin";
+			else
+conffile = optarg;
 			break;
 		case 'h':
 			hflag = 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"

Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Alfred Perlstein
Wouldn't this obfuscate any errors in files?

Sent from my iPhone

On Dec 19, 2012, at 7:37 AM, Ian Lepore  wrote:

> On Wed, 2012-12-19 at 19:02 +0400, Andrey Zonov wrote:
>> On 12/14/12 3:32 AM, Xin LI wrote:
>>> Author: delphij
>>> Date: Thu Dec 13 23:32:47 2012
>>> New Revision: 244198
>>> URL: http://svnweb.freebsd.org/changeset/base/244198
>>> 
>>> Log:
>>>  Teach sysctl(8) about parsing a file (while I'm there also give it
>>>  capability of parsing both = and : formats).
>>> 
>>>  Submitted by:hrs (initial version, bugs are mine)
>>>  MFC after:3 months
>>> 
>>> Modified:
>>>  head/etc/rc.d/sysctl
>>>  head/sbin/sysctl/sysctl.8
>>>  head/sbin/sysctl/sysctl.c
>>> 
>>> Modified: head/etc/rc.d/sysctl
>>> ==
>>> --- head/etc/rc.d/sysctlThu Dec 13 23:19:13 2012(r244197)
>>> +++ head/etc/rc.d/sysctlThu Dec 13 23:32:47 2012(r244198)
>>> @@ -8,51 +8,27 @@
>>> . /etc/rc.subr
>>> 
>>> name="sysctl"
>>> +command="/sbin/sysctl"
>>> stop_cmd=":"
>>> start_cmd="sysctl_start"
>>> reload_cmd="sysctl_start"
>>> lastload_cmd="sysctl_start last"
>>> extra_commands="reload lastload"
>>> 
>>> -#
>>> -# Read in a file containing sysctl settings and set things accordingly.
>>> -#
>>> -parse_file()
>>> -{
>>> -if [ -f $1 ]; then
>>> -while read var comments
>>> -do
>>> -case ${var} in
>>> -\#*|'')
>>> -;;
>>> -*)
>>> -mib=${var%=*}
>>> -val=${var#*=}
>>> -
>>> -if current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then
>>> -case ${current_value} in
>>> -${val})
>>> -;;
>>> -*)
>>> -if ! sysctl "${var}" >/dev/null 2>&1; then
>>> -warn "unable to set ${var}"
>>> -fi
>>> -;;
>>> -esac
>>> -elif [ "$2" = "last" ]; then
>>> -warn "sysctl ${mib} does not exist."
>>> -fi
>>> -;;
>>> -esac
>>> -done < $1
>>> -fi
>>> -}
>>> -
>>> sysctl_start()
>>> {
>>> -
>>> -parse_file /etc/sysctl.conf $1
>>> -parse_file /etc/sysctl.conf.local $1
>>> +case $1 in
>>> +last)
>>> +command_args="-i -f"
>>> +;;
>>> +*)
>>> +command_args="-f"
>>> +;;
>>> +esac
>>> +
>>> +for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
>>> +[ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
>>> +done
>>> }
>>> 
>>> load_rc_config $name
>> 
>> Hi,
>> 
>> I'd really like to see something like the patch bellow in the tree.  I
>> found it very useful with cfengine configuration (as like as cron.d).
>> 
>> What do think?
>> 
>> diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl
>> index 36f1414..014e4c5 100755
>> --- a/etc/rc.d/sysctl
>> +++ b/etc/rc.d/sysctl
>> @@ -26,7 +26,7 @@ sysctl_start()
>>;;
>>esac
>> 
>> -   for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
>> +   for _f in `ls /etc/sysctl.d/* 2> /dev/null` /etc/sysctl.conf
>> /etc/sysctl.conf.local; do
>>[ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
>>done
>> }
> 
> Instead of running sysctl a bunch of times, how about something
> conceptually similar to
> 
>   cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f -
> 
> Along with this (untested) patch to make sysctl understand "-f -".
> 
> Hmmm, is /dev/stdin available as early as sysctl.conf runs?  If not, the
> attached patch isn't going to work.
> 
> -- Ian
> 
> diff -r cc5bd6d80aa1 sbin/sysctl/sysctl.c --- sbin/sysctl/sysctl.cSun Aug 
> 19 11:01:08 2012 -0600 +++ sbin/sysctl/sysctl.c Wed Dec 19 08:31:14 2012 
> -0700 @@ -112,7 +112,10 @@ main(int argc, char **argv) eflag = 1; break; case 
> 'f': - conffile = optarg; +   if (strcmp(optarg, "-") == 0) + 
> conffile = "/dev/stdin"; + else +   conffile = optarg; break; case 'h': 
> hflag = 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"


Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Ian Lepore
Hrm.  Yeah, it would.  Or at least, it might.  If the error message
cites the text of the line it chokes on, maybe that's not a problem.

Running sysctl once passing it a list of files would fix that, but would
probably be more complexity than it's worth.  I just always try to find
ways to reduce rc processing time on wimpy platforms, so these wild
ideas pop into my head.

-- Ian

On Wed, 2012-12-19 at 07:52 -0800, Alfred Perlstein wrote:
> Wouldn't this obfuscate any errors in files?
> 
> Sent from my iPhone
> 
> On Dec 19, 2012, at 7:37 AM, Ian Lepore  wrote:
> 
> > On Wed, 2012-12-19 at 19:02 +0400, Andrey Zonov wrote:
> >> On 12/14/12 3:32 AM, Xin LI wrote:
> >>> Author: delphij
> >>> Date: Thu Dec 13 23:32:47 2012
> >>> New Revision: 244198
> >>> URL: http://svnweb.freebsd.org/changeset/base/244198
> >>> 
> >>> Log:
> >>>  Teach sysctl(8) about parsing a file (while I'm there also give it
> >>>  capability of parsing both = and : formats).
> >>> 
> >>>  Submitted by:hrs (initial version, bugs are mine)
> >>>  MFC after:3 months
> >>> 
> >>> Modified:
> >>>  head/etc/rc.d/sysctl
> >>>  head/sbin/sysctl/sysctl.8
> >>>  head/sbin/sysctl/sysctl.c
> >>> 
> >>> Modified: head/etc/rc.d/sysctl
> >>> ==
> >>> --- head/etc/rc.d/sysctlThu Dec 13 23:19:13 2012(r244197)
> >>> +++ head/etc/rc.d/sysctlThu Dec 13 23:32:47 2012(r244198)
> >>> @@ -8,51 +8,27 @@
> >>> . /etc/rc.subr
> >>> 
> >>> name="sysctl"
> >>> +command="/sbin/sysctl"
> >>> stop_cmd=":"
> >>> start_cmd="sysctl_start"
> >>> reload_cmd="sysctl_start"
> >>> lastload_cmd="sysctl_start last"
> >>> extra_commands="reload lastload"
> >>> 
> >>> -#
> >>> -# Read in a file containing sysctl settings and set things accordingly.
> >>> -#
> >>> -parse_file()
> >>> -{
> >>> -if [ -f $1 ]; then
> >>> -while read var comments
> >>> -do
> >>> -case ${var} in
> >>> -\#*|'')
> >>> -;;
> >>> -*)
> >>> -mib=${var%=*}
> >>> -val=${var#*=}
> >>> -
> >>> -if current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then
> >>> -case ${current_value} in
> >>> -${val})
> >>> -;;
> >>> -*)
> >>> -if ! sysctl "${var}" >/dev/null 2>&1; then
> >>> -warn "unable to set ${var}"
> >>> -fi
> >>> -;;
> >>> -esac
> >>> -elif [ "$2" = "last" ]; then
> >>> -warn "sysctl ${mib} does not exist."
> >>> -fi
> >>> -;;
> >>> -esac
> >>> -done < $1
> >>> -fi
> >>> -}
> >>> -
> >>> sysctl_start()
> >>> {
> >>> -
> >>> -parse_file /etc/sysctl.conf $1
> >>> -parse_file /etc/sysctl.conf.local $1
> >>> +case $1 in
> >>> +last)
> >>> +command_args="-i -f"
> >>> +;;
> >>> +*)
> >>> +command_args="-f"
> >>> +;;
> >>> +esac
> >>> +
> >>> +for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
> >>> +[ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
> >>> +done
> >>> }
> >>> 
> >>> load_rc_config $name
> >> 
> >> Hi,
> >> 
> >> I'd really like to see something like the patch bellow in the tree.  I
> >> found it very useful with cfengine configuration (as like as cron.d).
> >> 
> >> What do think?
> >> 
> >> diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl
> >> index 36f1414..014e4c5 100755
> >> --- a/etc/rc.d/sysctl
> >> +++ b/etc/rc.d/sysctl
> >> @@ -26,7 +26,7 @@ sysctl_start()
> >>;;
> >>esac
> >> 
> >> -   for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
> >> +   for _f in `ls /etc/sysctl.d/* 2> /dev/null` /etc/sysctl.conf
> >> /etc/sysctl.conf.local; do
> >>[ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
> >>done
> >> }
> > 
> > Instead of running sysctl a bunch of times, how about something
> > conceptually similar to
> > 
> >   cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f -
> > 
> > Along with this (untested) patch to make sysctl understand "-f -".
> > 
> > Hmmm, is /dev/stdin available as early as sysctl.conf runs?  If not, the
> > attached patch isn't going to work.
> > 
> > -- Ian
> > 
> > diff -r cc5bd6d80aa1 sbin/sysctl/sysctl.c --- sbin/sysctl/sysctl.c  Sun Aug 
> > 19 11:01:08 2012 -0600 +++ sbin/sysctl/sysctl.c Wed Dec 19 08:31:14 2012 
> > -0700 @@ -112,7 +112,10 @@ main(int argc, char **argv) eflag = 1; break; 
> > case 'f': - conffile = optarg; +   if (strcmp(optarg, "-") == 0) +  
> >conffile = "/dev/stdin"; + else +   conffile = optarg; break; case 
> > 'h': hflag = 1;
> ___
> svn-src-...@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, se

svn commit: r244437 - head/contrib/gdb/gdb

2012-12-19 Thread Ed Maste
Author: emaste
Date: Wed Dec 19 16:23:20 2012
New Revision: 244437
URL: http://svnweb.freebsd.org/changeset/base/244437

Log:
  Support restrict qualifier in dwarf debug info
  
  Newer clang/llvm emit DW_TAG_restrict_type, which wasn't handled by gdb.
  Import support from Apple's gdb-1822:
  
  |  2009-03-24  Jason Molenda  (jmole...@apple.com)
  |
  |* gdbtypes.c (make_cv_type): Rename this function to make_cvr_type to
  |also handle restrict qualifiers.
  |(check_typedef): Handle TYPE_RESTRICT.
  |* gdbtypes.h (TYPE_FLAG_RESTRICT, TYPE_RESTRICT): New.
  |* hpread.c (hpread_type_lookup): Update to use make_cvr_type.
  |* stabsread.c (read_type): Pass the restrict qualifiers along.
  |* parse.c (follow_types): Pass the restrict qualifiers along.
  |* dwarf2read.c (read_tag_const_type): Call make_cvr_type.
  |(read_tag_volatile_type): Same.
  |(read_tag_restrict_type): New function.
  |(read_type_die): Handle DW_TAG_restrict_type.
  
  Obtained from: Apple
  Sponsored by: ADARA Networks

Modified:
  head/contrib/gdb/gdb/dwarf2read.c
  head/contrib/gdb/gdb/gdbtypes.c
  head/contrib/gdb/gdb/gdbtypes.h
  head/contrib/gdb/gdb/hpread.c
  head/contrib/gdb/gdb/parse.c
  head/contrib/gdb/gdb/stabsread.c

Modified: head/contrib/gdb/gdb/dwarf2read.c
==
--- head/contrib/gdb/gdb/dwarf2read.c   Wed Dec 19 16:22:46 2012
(r244436)
+++ head/contrib/gdb/gdb/dwarf2read.c   Wed Dec 19 16:23:20 2012
(r244437)
@@ -834,6 +834,8 @@ static void read_tag_const_type (struct 
 
 static void read_tag_volatile_type (struct die_info *, struct dwarf2_cu *);
 
+static void read_tag_restrict_type (struct die_info *, struct dwarf2_cu *);
+
 static void read_tag_string_type (struct die_info *, struct dwarf2_cu *);
 
 static void read_subroutine_type (struct die_info *, struct dwarf2_cu *);
@@ -3729,7 +3731,8 @@ read_tag_const_type (struct die_info *di
 }
 
   base_type = die_type (die, cu);
-  die->type = make_cv_type (1, TYPE_VOLATILE (base_type), base_type, 0);
+  die->type = make_cvr_type (1, TYPE_VOLATILE (base_type),
+ TYPE_RESTRICT (base_type), base_type, 0);
 }
 
 static void
@@ -3743,7 +3746,23 @@ read_tag_volatile_type (struct die_info 
 }
 
   base_type = die_type (die, cu);
-  die->type = make_cv_type (TYPE_CONST (base_type), 1, base_type, 0);
+  die->type = make_cvr_type (TYPE_CONST (base_type), 1,
+ TYPE_RESTRICT (base_type), base_type, 0);
+}
+
+static void
+read_tag_restrict_type (struct die_info *die, struct dwarf2_cu *cu)
+{
+  struct type *base_type;
+
+  if (die->type)
+{
+  return;
+}
+
+  base_type = die_type (die, cu);
+  die->type = make_cvr_type (TYPE_CONST (base_type), TYPE_VOLATILE (base_type),
+ 1, base_type, 0);
 }
 
 /* Extract all information from a DW_TAG_string_type DIE and add to
@@ -6086,6 +6105,9 @@ read_type_die (struct die_info *die, str
 case DW_TAG_volatile_type:
   read_tag_volatile_type (die, cu);
   break;
+case DW_TAG_restrict_type:
+  read_tag_restrict_type (die, cu);
+  break;
 case DW_TAG_string_type:
   read_tag_string_type (die, cu);
   break;

Modified: head/contrib/gdb/gdb/gdbtypes.c
==
--- head/contrib/gdb/gdb/gdbtypes.c Wed Dec 19 16:22:46 2012
(r244436)
+++ head/contrib/gdb/gdb/gdbtypes.c Wed Dec 19 16:23:20 2012
(r244437)
@@ -502,7 +502,8 @@ make_type_with_address_space (struct typ
We allocate new memory if needed.  */
 
 struct type *
-make_cv_type (int cnst, int voltl, struct type *type, struct type **typeptr)
+make_cvr_type (int cnst, int voltl, int restrct, struct type *type,
+   struct type **typeptr)
 {
   struct type *ntype;  /* New type */
   struct type *tmp_type = type;/* tmp type */
@@ -517,6 +518,9 @@ make_cv_type (int cnst, int voltl, struc
   if (voltl)
 new_flags |= TYPE_FLAG_VOLATILE;
 
+  if (restrct)
+new_flags |= TYPE_FLAG_RESTRICT;
+
   if (typeptr && *typeptr != NULL)
 {
   /* Objfile is per-core-type.  This const-qualified type had best
@@ -1371,7 +1375,7 @@ struct type *
 check_typedef (struct type *type)
 {
   struct type *orig_type = type;
-  int is_const, is_volatile;
+  int is_const, is_volatile, is_restrict;
 
   while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
 {
@@ -1407,6 +1411,7 @@ check_typedef (struct type *type)
 
   is_const = TYPE_CONST (type);
   is_volatile = TYPE_VOLATILE (type);
+  is_restrict = TYPE_RESTRICT (type);
 
   /* If this is a struct/class/union with no fields, then check whether a
  full definition exists somewhere else.  This is for systems where a
@@ -1424,7 +1429,7 @@ check_typedef (struct type *type)
}
   newtype = lookup_transparent_type (name);
   if (newtype)
-   make_cv_type (is_const, is_volat

svn commit: r244439 - head/sys/netinet6

2012-12-19 Thread Andrey V. Elsukov
Author: ae
Date: Wed Dec 19 17:02:07 2012
New Revision: 244439
URL: http://svnweb.freebsd.org/changeset/base/244439

Log:
  The selectroute functions does own account of EHOSTUNREACH errors,
  no need to do it twice.
  
  MFC after:1 week

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Wed Dec 19 16:37:05 2012
(r244438)
+++ head/sys/netinet6/ip6_output.c  Wed Dec 19 17:02:07 2012
(r244439)
@@ -645,14 +645,6 @@ again:
ifp = ro->ro_rt->rt_ifp;
} else if ((error = in6_selectroute_fib(&dst_sa, opt, im6o, ro,
&ifp, &rt, inp ? inp->inp_inc.inc_fibnum : M_GETFIB(m))) != 0) {
-   switch (error) {
-   case EHOSTUNREACH:
-   V_ip6stat.ip6s_noroute++;
-   break;
-   case EADDRNOTAVAIL:
-   default:
-   break; /* XXX statistics? */
-   }
if (ifp != NULL)
in6_ifstat_inc(ifp, ifs6_out_discard);
goto bad;
___
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: r244440 - head/sys/netinet6

2012-12-19 Thread Andrey V. Elsukov
Author: ae
Date: Wed Dec 19 17:08:49 2012
New Revision: 20
URL: http://svnweb.freebsd.org/changeset/base/20

Log:
  Make dst_sa initialization only when it is actually needed.
  
  MFC after:1 week

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Wed Dec 19 17:02:07 2012
(r244439)
+++ head/sys/netinet6/ip6_output.c  Wed Dec 19 17:08:49 2012
(r20)
@@ -636,18 +636,21 @@ again:
/* adjust pointer */
ip6 = mtod(m, struct ip6_hdr *);
 
-   bzero(&dst_sa, sizeof(dst_sa));
-   dst_sa.sin6_family = AF_INET6;
-   dst_sa.sin6_len = sizeof(dst_sa);
-   dst_sa.sin6_addr = ip6->ip6_dst;
if (ro->ro_rt) {
rt = ro->ro_rt;
ifp = ro->ro_rt->rt_ifp;
-   } else if ((error = in6_selectroute_fib(&dst_sa, opt, im6o, ro,
-   &ifp, &rt, inp ? inp->inp_inc.inc_fibnum : M_GETFIB(m))) != 0) {
-   if (ifp != NULL)
-   in6_ifstat_inc(ifp, ifs6_out_discard);
-   goto bad;
+   } else {
+   bzero(&dst_sa, sizeof(dst_sa));
+   dst_sa.sin6_family = AF_INET6;
+   dst_sa.sin6_len = sizeof(dst_sa);
+   dst_sa.sin6_addr = ip6->ip6_dst;
+   error = in6_selectroute_fib(&dst_sa, opt, im6o, ro, &ifp,
+   &rt, inp ? inp->inp_inc.inc_fibnum : M_GETFIB(m));
+   if (error != 0) {
+   if (ifp != NULL)
+   in6_ifstat_inc(ifp, ifs6_out_discard);
+   goto bad;
+   }
}
if (rt == NULL) {
/*
___
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: r244441 - head/sys/netinet6

2012-12-19 Thread Andrey V. Elsukov
Author: ae
Date: Wed Dec 19 17:28:17 2012
New Revision: 21
URL: http://svnweb.freebsd.org/changeset/base/21

Log:
  When we have some address to forward (e.g. it was specified with ipfw fwd),
  we should pass it as first argument into in6_selectroute_fib function to
  initiate new route lookup.
  
  MFC after:1 week

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Wed Dec 19 17:08:49 2012
(r20)
+++ head/sys/netinet6/ip6_output.c  Wed Dec 19 17:28:17 2012
(r21)
@@ -257,7 +257,7 @@ ip6_output(struct mbuf *m0, struct ip6_p
int segleft_org = 0;
struct secpolicy *sp = NULL;
 #endif /* IPSEC */
-   struct m_tag *fwd_tag;
+   struct m_tag *fwd_tag = NULL;
 
ip6 = mtod(m, struct ip6_hdr *);
if (ip6 == NULL) {
@@ -636,14 +636,16 @@ again:
/* adjust pointer */
ip6 = mtod(m, struct ip6_hdr *);
 
-   if (ro->ro_rt) {
+   if (ro->ro_rt && fwd_tag == NULL) {
rt = ro->ro_rt;
ifp = ro->ro_rt->rt_ifp;
} else {
-   bzero(&dst_sa, sizeof(dst_sa));
-   dst_sa.sin6_family = AF_INET6;
-   dst_sa.sin6_len = sizeof(dst_sa);
-   dst_sa.sin6_addr = ip6->ip6_dst;
+   if (fwd_tag == NULL) {
+   bzero(&dst_sa, sizeof(dst_sa));
+   dst_sa.sin6_family = AF_INET6;
+   dst_sa.sin6_len = sizeof(dst_sa);
+   dst_sa.sin6_addr = ip6->ip6_dst;
+   }
error = in6_selectroute_fib(&dst_sa, opt, im6o, ro, &ifp,
&rt, inp ? inp->inp_inc.inc_fibnum : M_GETFIB(m));
if (error != 0) {
@@ -928,7 +930,7 @@ again:
if ((m->m_flags & M_IP6_NEXTHOP) &&
(fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL)) != NULL) {
dst = (struct sockaddr_in6 *)&ro->ro_dst;
-   bcopy((fwd_tag+1), dst, sizeof(struct sockaddr_in6));
+   bcopy((fwd_tag+1), &dst_sa, sizeof(struct sockaddr_in6));
m->m_flags |= M_SKIP_FIREWALL;
m->m_flags &= ~M_IP6_NEXTHOP;
m_tag_delete(m, fwd_tag);
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Alfred Perlstein
I think that it's a good idea. Maybe there's some way to give sysctl.conf the 
equivalent of #file preprocessor directives?

Sent from my iPhone

On Dec 19, 2012, at 7:56 AM, Ian Lepore  wrote:

> Hrm.  Yeah, it would.  Or at least, it might.  If the error message
> cites the text of the line it chokes on, maybe that's not a problem.
> 
> Running sysctl once passing it a list of files would fix that, but would
> probably be more complexity than it's worth.  I just always try to find
> ways to reduce rc processing time on wimpy platforms, so these wild
> ideas pop into my head.
> 
> -- Ian
> 
> On Wed, 2012-12-19 at 07:52 -0800, Alfred Perlstein wrote:
>> Wouldn't this obfuscate any errors in files?
>> 
>> Sent from my iPhone
>> 
>> On Dec 19, 2012, at 7:37 AM, Ian Lepore  
>> wrote:
>> 
>>> On Wed, 2012-12-19 at 19:02 +0400, Andrey Zonov wrote:
 On 12/14/12 3:32 AM, Xin LI wrote:
> Author: delphij
> Date: Thu Dec 13 23:32:47 2012
> New Revision: 244198
> URL: http://svnweb.freebsd.org/changeset/base/244198
> 
> Log:
> Teach sysctl(8) about parsing a file (while I'm there also give it
> capability of parsing both = and : formats).
> 
> Submitted by:hrs (initial version, bugs are mine)
> MFC after:3 months
> 
> Modified:
> head/etc/rc.d/sysctl
> head/sbin/sysctl/sysctl.8
> head/sbin/sysctl/sysctl.c
> 
> Modified: head/etc/rc.d/sysctl
> ==
> --- head/etc/rc.d/sysctlThu Dec 13 23:19:13 2012(r244197)
> +++ head/etc/rc.d/sysctlThu Dec 13 23:32:47 2012(r244198)
> @@ -8,51 +8,27 @@
> . /etc/rc.subr
> 
> name="sysctl"
> +command="/sbin/sysctl"
> stop_cmd=":"
> start_cmd="sysctl_start"
> reload_cmd="sysctl_start"
> lastload_cmd="sysctl_start last"
> extra_commands="reload lastload"
> 
> -#
> -# Read in a file containing sysctl settings and set things accordingly.
> -#
> -parse_file()
> -{
> -if [ -f $1 ]; then
> -while read var comments
> -do
> -case ${var} in
> -\#*|'')
> -;;
> -*)
> -mib=${var%=*}
> -val=${var#*=}
> -
> -if current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then
> -case ${current_value} in
> -${val})
> -;;
> -*)
> -if ! sysctl "${var}" >/dev/null 2>&1; then
> -warn "unable to set ${var}"
> -fi
> -;;
> -esac
> -elif [ "$2" = "last" ]; then
> -warn "sysctl ${mib} does not exist."
> -fi
> -;;
> -esac
> -done < $1
> -fi
> -}
> -
> sysctl_start()
> {
> -
> -parse_file /etc/sysctl.conf $1
> -parse_file /etc/sysctl.conf.local $1
> +case $1 in
> +last)
> +command_args="-i -f"
> +;;
> +*)
> +command_args="-f"
> +;;
> +esac
> +
> +for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
> +[ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
> +done
> }
> 
> load_rc_config $name
 
 Hi,
 
 I'd really like to see something like the patch bellow in the tree.  I
 found it very useful with cfengine configuration (as like as cron.d).
 
 What do think?
 
 diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl
 index 36f1414..014e4c5 100755
 --- a/etc/rc.d/sysctl
 +++ b/etc/rc.d/sysctl
 @@ -26,7 +26,7 @@ sysctl_start()
   ;;
   esac
 
 -   for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
 +   for _f in `ls /etc/sysctl.d/* 2> /dev/null` /etc/sysctl.conf
 /etc/sysctl.conf.local; do
   [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
   done
 }
>>> 
>>> Instead of running sysctl a bunch of times, how about something
>>> conceptually similar to
>>> 
>>>  cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f -
>>> 
>>> Along with this (untested) patch to make sysctl understand "-f -".
>>> 
>>> Hmmm, is /dev/stdin available as early as sysctl.conf runs?  If not, the
>>> attached patch isn't going to work.
>>> 
>>> -- Ian
>>> 
>>> diff -r cc5bd6d80aa1 sbin/sysctl/sysctl.c --- sbin/sysctl/sysctl.cSun 
>>> Aug 19 11:01:08 2012 -0600 +++ sbin/sysctl/sysctl.cWed Dec 19 08:31:14 
>>> 2012 -0700 @@ -112,7 +112,10 @@ main(int argc, char **argv) eflag = 1; 
>>> break; case 'f': - conffile = optarg; + if (strcmp(optarg, "-") == 0) + 
>>> conffile = "/dev/stdin"; + else + conff

Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Alfred Perlstein
I didn't catch your idea of multiple files to parse. That sounds like a better 
idea than mine (# based file directives) for sure. 

Sent from my iPhone

On Dec 19, 2012, at 9:37 AM, Alfred Perlstein  wrote:

> I think that it's a good idea. Maybe there's some way to give sysctl.conf the 
> equivalent of #file preprocessor directives?
> 
> Sent from my iPhone
> 
> On Dec 19, 2012, at 7:56 AM, Ian Lepore  wrote:
> 
>> Hrm.  Yeah, it would.  Or at least, it might.  If the error message
>> cites the text of the line it chokes on, maybe that's not a problem.
>> 
>> Running sysctl once passing it a list of files would fix that, but would
>> probably be more complexity than it's worth.  I just always try to find
>> ways to reduce rc processing time on wimpy platforms, so these wild
>> ideas pop into my head.
>> 
>> -- Ian
>> 
>> On Wed, 2012-12-19 at 07:52 -0800, Alfred Perlstein wrote:
>>> Wouldn't this obfuscate any errors in files?
>>> 
>>> Sent from my iPhone
>>> 
>>> On Dec 19, 2012, at 7:37 AM, Ian Lepore  
>>> wrote:
>>> 
 On Wed, 2012-12-19 at 19:02 +0400, Andrey Zonov wrote:
> On 12/14/12 3:32 AM, Xin LI wrote:
>> Author: delphij
>> Date: Thu Dec 13 23:32:47 2012
>> New Revision: 244198
>> URL: http://svnweb.freebsd.org/changeset/base/244198
>> 
>> Log:
>> Teach sysctl(8) about parsing a file (while I'm there also give it
>> capability of parsing both = and : formats).
>> 
>> Submitted by:hrs (initial version, bugs are mine)
>> MFC after:3 months
>> 
>> Modified:
>> head/etc/rc.d/sysctl
>> head/sbin/sysctl/sysctl.8
>> head/sbin/sysctl/sysctl.c
>> 
>> Modified: head/etc/rc.d/sysctl
>> ==
>> --- head/etc/rc.d/sysctlThu Dec 13 23:19:13 2012(r244197)
>> +++ head/etc/rc.d/sysctlThu Dec 13 23:32:47 2012(r244198)
>> @@ -8,51 +8,27 @@
>> . /etc/rc.subr
>> 
>> name="sysctl"
>> +command="/sbin/sysctl"
>> stop_cmd=":"
>> start_cmd="sysctl_start"
>> reload_cmd="sysctl_start"
>> lastload_cmd="sysctl_start last"
>> extra_commands="reload lastload"
>> 
>> -#
>> -# Read in a file containing sysctl settings and set things accordingly.
>> -#
>> -parse_file()
>> -{
>> -if [ -f $1 ]; then
>> -while read var comments
>> -do
>> -case ${var} in
>> -\#*|'')
>> -;;
>> -*)
>> -mib=${var%=*}
>> -val=${var#*=}
>> -
>> -if current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then
>> -case ${current_value} in
>> -${val})
>> -;;
>> -*)
>> -if ! sysctl "${var}" >/dev/null 2>&1; then
>> -warn "unable to set ${var}"
>> -fi
>> -;;
>> -esac
>> -elif [ "$2" = "last" ]; then
>> -warn "sysctl ${mib} does not exist."
>> -fi
>> -;;
>> -esac
>> -done < $1
>> -fi
>> -}
>> -
>> sysctl_start()
>> {
>> -
>> -parse_file /etc/sysctl.conf $1
>> -parse_file /etc/sysctl.conf.local $1
>> +case $1 in
>> +last)
>> +command_args="-i -f"
>> +;;
>> +*)
>> +command_args="-f"
>> +;;
>> +esac
>> +
>> +for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
>> +[ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
>> +done
>> }
>> 
>> load_rc_config $name
> 
> Hi,
> 
> I'd really like to see something like the patch bellow in the tree.  I
> found it very useful with cfengine configuration (as like as cron.d).
> 
> What do think?
> 
> diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl
> index 36f1414..014e4c5 100755
> --- a/etc/rc.d/sysctl
> +++ b/etc/rc.d/sysctl
> @@ -26,7 +26,7 @@ sysctl_start()
>  ;;
>  esac
> 
> -   for _f in /etc/sysctl.conf /etc/sysctl.conf.local; do
> +   for _f in `ls /etc/sysctl.d/* 2> /dev/null` /etc/sysctl.conf
> /etc/sysctl.conf.local; do
>  [ -r ${_f} ] && ${command} ${command_args} ${_f} > /dev/null
>  done
> }
 
 Instead of running sysctl a bunch of times, how about something
 conceptually similar to
 
 cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f -
 
 Along with this (untested) patch to make sysctl understand "-f -".
 
 Hmmm, is /dev/stdin available as early as sysctl.conf runs?  If not, the
 attached patch isn't going to work.
 
 -- Ian
 
 dif

Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Xin Li
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 12/19/12 09:37, Alfred Perlstein wrote:
> I think that it's a good idea. Maybe there's some way to give
> sysctl.conf the equivalent of #file preprocessor directives?

/me seeing sysctl(8) expanding to grow e-mail reading capability in
the future? :)

It may be worthy to make sysctl(8) to accept mutiple -f's, but it
seems to be hard to write shell scripts that utilizes this feature in
a elegant manner.

It shouldn't be hard to add -f - capability as well, which will be
useful for applications like FreeNAS.

Jilles also have some comments that I wanted to address as well.

> Sent from my iPhone
> 
> On Dec 19, 2012, at 7:56 AM, Ian Lepore
>  wrote:
> 
>> Hrm.  Yeah, it would.  Or at least, it might.  If the error
>> message cites the text of the line it chokes on, maybe that's not
>> a problem.
>> 
>> Running sysctl once passing it a list of files would fix that,
>> but would probably be more complexity than it's worth.  I just
>> always try to find ways to reduce rc processing time on wimpy
>> platforms, so these wild ideas pop into my head.
>> 
>> -- Ian
>> 
>> On Wed, 2012-12-19 at 07:52 -0800, Alfred Perlstein wrote:
>>> Wouldn't this obfuscate any errors in files?
>>> 
>>> Sent from my iPhone
>>> 
>>> On Dec 19, 2012, at 7:37 AM, Ian Lepore
>>>  wrote:
>>> 
 On Wed, 2012-12-19 at 19:02 +0400, Andrey Zonov wrote:
> On 12/14/12 3:32 AM, Xin LI wrote:
>> Author: delphij Date: Thu Dec 13 23:32:47 2012 New
>> Revision: 244198 URL:
>> http://svnweb.freebsd.org/changeset/base/244198
>> 
>> Log: Teach sysctl(8) about parsing a file (while I'm
>> there also give it capability of parsing both = and :
>> formats).
>> 
>> Submitted by:hrs (initial version, bugs are mine) MFC
>> after:3 months
>> 
>> Modified: head/etc/rc.d/sysctl head/sbin/sysctl/sysctl.8 
>> head/sbin/sysctl/sysctl.c
>> 
>> Modified: head/etc/rc.d/sysctl 
>> ==
>>
>> 
- --- head/etc/rc.d/sysctlThu Dec 13 23:19:13 2012(r244197)
>> +++ head/etc/rc.d/sysctlThu Dec 13 23:32:47 2012
>> (r244198) @@ -8,51 +8,27 @@ . /etc/rc.subr
>> 
>> name="sysctl" +command="/sbin/sysctl" stop_cmd=":" 
>> start_cmd="sysctl_start" reload_cmd="sysctl_start" 
>> lastload_cmd="sysctl_start last" extra_commands="reload
>> lastload"
>> 
>> -# -# Read in a file containing sysctl settings and set
>> things accordingly. -# -parse_file() -{ -if [ -f $1
>> ]; then -while read var comments -do -
>> case ${var} in -\#*|'') -;; -
>> *) -mib=${var%=*} -
>> val=${var#*=} - -if
>> current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then -
>> case ${current_value} in -${val}) -
>> ;; -*) -if !
>> sysctl "${var}" >/dev/null 2>&1; then -
>> warn "unable to set ${var}" -fi -
>> ;; -esac -elif [ "$2"
>> = "last" ]; then -warn "sysctl ${mib}
>> does not exist." -fi -;; 
>> -esac -done < $1 -fi -} - 
>> sysctl_start() { - -parse_file /etc/sysctl.conf $1 -
>> parse_file /etc/sysctl.conf.local $1 +case $1 in +
>> last) +command_args="-i -f" +;; +*) +
>> command_args="-f" +;; +esac + +for _f in
>> /etc/sysctl.conf /etc/sysctl.conf.local; do +[ -r
>> ${_f} ] && ${command} ${command_args} ${_f} > /dev/null +
>> done }
>> 
>> load_rc_config $name
> 
> Hi,
> 
> I'd really like to see something like the patch bellow in
> the tree.  I found it very useful with cfengine
> configuration (as like as cron.d).
> 
> What do think?
> 
> diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl index
> 36f1414..014e4c5 100755 --- a/etc/rc.d/sysctl +++
> b/etc/rc.d/sysctl @@ -26,7 +26,7 @@ sysctl_start() ;; esac
> 
> -   for _f in /etc/sysctl.conf /etc/sysctl.conf.local;
> do +   for _f in `ls /etc/sysctl.d/* 2> /dev/null`
> /etc/sysctl.conf /etc/sysctl.conf.local; do [ -r ${_f} ] &&
> ${command} ${command_args} ${_f} > /dev/null done }
 
 Instead of running sysctl a bunch of times, how about
 something conceptually similar to
 
 cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f -
 
 Along with this (untested) patch to make sysctl understand
 "-f -".
 
 Hmmm, is /dev/stdin available as early as sysctl.conf runs?
 If not, the attached patch isn't going to work.
 
 -- Ian
 
 diff -r cc5bd6d80aa1 sbin/sysctl/sysctl.c ---
 sbin/sysctl/sysctl.cSun Aug 19 11:01:08 2012 -0600 +++
 sbin/sysctl/sysctl.cWed Dec 19 08:

Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Garrett Cooper
On Wed, Dec 19, 2012 at 7:37 AM, Ian Lepore
 wrote:

...

> Instead of running sysctl a bunch of times, how about something
> conceptually similar to
>
>cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f -
>
> Along with this (untested) patch to make sysctl understand "-f -".
>
> Hmmm, is /dev/stdin available as early as sysctl.conf runs?  If not, the
> attached patch isn't going to work.

Why not just make sysctl understand multiple -f options? You're
probably going to run into more problems parsing from /dev/stdin and
it's going to obfuscate things a lot dealing with which file came
last, feeding back diagnostic info, etc.
Please don't "linuxise" this tool.
Thanks,
-Garrett
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Ian Lepore
On Wed, 2012-12-19 at 11:10 -0800, Garrett Cooper wrote:
> On Wed, Dec 19, 2012 at 7:37 AM, Ian Lepore
>  wrote:
> 
> ...
> 
> > Instead of running sysctl a bunch of times, how about something
> > conceptually similar to
> >
> >cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f -
> >
> > Along with this (untested) patch to make sysctl understand "-f -".
> >
> > Hmmm, is /dev/stdin available as early as sysctl.conf runs?  If not, the
> > attached patch isn't going to work.
> 
> Why not just make sysctl understand multiple -f options? You're
> probably going to run into more problems parsing from /dev/stdin and
> it's going to obfuscate things a lot dealing with which file came
> last, feeding back diagnostic info, etc.
> Please don't "linuxise" this tool.
> Thanks,
> -Garrett

Hrm.  I would consider enhancing a program to accept data on stdin,
thereby allowing complex tasks to be efficiently accomplished using
pipelines of simple tools, to be more "unix-ising" than "linux-ising".

-- Ian


___
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: r244444 - head/sys/kern

2012-12-19 Thread Jeff Roberson
Author: jeff
Date: Wed Dec 19 20:08:06 2012
New Revision: 24
URL: http://svnweb.freebsd.org/changeset/base/24

Log:
   - Correctly handle EWOULDBLOCK in quiesce_cpus
  
  Discussed with:   mav

Modified:
  head/sys/kern/subr_smp.c

Modified: head/sys/kern/subr_smp.c
==
--- head/sys/kern/subr_smp.cWed Dec 19 18:51:35 2012(r23)
+++ head/sys/kern/subr_smp.cWed Dec 19 20:08:06 2012(r24)
@@ -766,8 +766,9 @@ quiesce_cpus(cpuset_t map, const char *w
thread_unlock(curthread);
while (gen[cpu] == pcpu->pc_idlethread->td_generation) {
error = tsleep(quiesce_cpus, prio, wmesg, 1);
-   if (error)
+   if (error != EWOULDBLOCK)
goto out;
+   error = 0;
}
}
 out:
___
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: r244445 - in head/sys: kern sys tools

2012-12-19 Thread Jeff Roberson
Author: jeff
Date: Wed Dec 19 20:10:00 2012
New Revision: 25
URL: http://svnweb.freebsd.org/changeset/base/25

Log:
   - Add new machine parsable KTR macros for timing events.
   - Use this new format to automatically handle syscalls and VOPs.  This
 changes the earlier format but is still human readable.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/kern/subr_syscall.c
  head/sys/sys/ktr.h
  head/sys/tools/vnode_if.awk

Modified: head/sys/kern/subr_syscall.c
==
--- head/sys/kern/subr_syscall.cWed Dec 19 20:08:06 2012
(r24)
+++ head/sys/kern/subr_syscall.cWed Dec 19 20:10:00 2012
(r25)
@@ -77,13 +77,12 @@ syscallenter(struct thread *td, struct s
if (KTRPOINT(td, KTR_SYSCALL))
ktrsyscall(sa->code, sa->narg, sa->args);
 #endif
-
-   CTR6(KTR_SYSC,
-"syscall: td=%p pid %d %s (%#lx, %#lx, %#lx)",
-   td, td->td_proc->p_pid, syscallname(p, sa->code),
-   sa->args[0], sa->args[1], sa->args[2]);
+   KTR_START4(KTR_SYSC, "syscall", syscallname(p, sa->code),
+   td, "pid:%d", td->td_proc->p_pid, "arg0:%p", sa->args[0],
+   "arg1:%p", sa->args[1], "arg2:%p", sa->args[2]);
 
if (error == 0) {
+
STOPEVENT(p, S_SCE, sa->narg);
if (p->p_flag & P_TRACED && p->p_stops & S_PT_SCE) {
PROC_LOCK(p);
@@ -150,10 +149,12 @@ syscallenter(struct thread *td, struct s
sa->callp, NULL, (error) ? -1 : td->td_retval[0]);
 #endif
syscall_thread_exit(td, sa->callp);
-   CTR4(KTR_SYSC, "syscall: p=%p error=%d return %#lx %#lx",
-   p, error, td->td_retval[0], td->td_retval[1]);
}
  retval:
+   KTR_STOP4(KTR_SYSC, "syscall", syscallname(p, sa->code),
+   td, "pid:%d", td->td_proc->p_pid, "error:%d", error,
+   "retval0:%#lx", td->td_retval[0], "retval1:%#lx",
+   td->td_retval[1]);
if (traced) {
PROC_LOCK(p);
td->td_dbgflags &= ~TDB_SCE;
@@ -176,9 +177,6 @@ syscallret(struct thread *td, int error,
 */
userret(td, td->td_frame);
 
-   CTR4(KTR_SYSC, "syscall %s exit thread %p pid %d proc %s",
-   syscallname(p, sa->code), td, td->td_proc->p_pid, td->td_name);
-
 #ifdef KTRACE
if (KTRPOINT(td, KTR_SYSRET)) {
ktrsysret(sa->code, (td->td_pflags & TDP_NERRNO) == 0 ?

Modified: head/sys/sys/ktr.h
==
--- head/sys/sys/ktr.h  Wed Dec 19 20:08:06 2012(r24)
+++ head/sys/sys/ktr.h  Wed Dec 19 20:10:00 2012(r25)
@@ -244,6 +244,50 @@ void   ktr_tracepoint(u_int mask, const ch
point, a0, (v0), a1, (v1), a2, (v2), a3, (v3))
 
 /*
+ * Start functions denote the start of a region of code or operation
+ * and should be paired with stop functions for timing of nested
+ * sequences.
+ *
+ * Specifying extra attributes with the name "key" will result in
+ * multi-part keys.  For example a block device and offset pair
+ * might be used to describe a buf undergoing I/O.
+ */
+#defineKTR_START0(m, egroup, ident, key)   
\
+   KTR_EVENT0(m, egroup, ident, "start:0x%jX", (uintmax_t)key)
+#defineKTR_START1(m, egroup, ident, key, a0, v0)   
\
+   KTR_EVENT1(m, egroup, ident, "start:0x%jX", (uintmax_t)key, a0, (v0))
+#defineKTR_START2(m, egroup, ident, key, a0, v0, a1, v1)   
\
+   KTR_EVENT2(m, egroup, ident, "start:0x%jX", (uintmax_t)key, \
+   a0, (v0), a1, (v1))
+#defineKTR_START3(m, egroup, ident, key, a0, v0, a1, v1, a2, v2)\
+   KTR_EVENT3(m, egroup, ident, "start:0x%jX", (uintmax_t)key, \
+   a0, (v0), a1, (v1), a2, (v2))
+#defineKTR_START4(m, egroup, ident, key,   
\
+   a0, v0, a1, v1, a2, v2, a3, v3) \
+   KTR_EVENT4(m, egroup, ident, "start:0x%jX", (uintmax_t)key, \
+   a0, (v0), a1, (v1), a2, (v2), a3, (v3))
+
+/*
+ * Stop functions denote the end of a region of code or operation
+ * and should be paired with start functions for timing of nested
+ * sequences.
+ */
+#defineKTR_STOP0(m, egroup, ident, key)
\
+   KTR_EVENT0(m, egroup, ident, "stop:0x%jX", (uintmax_t)key)
+#defineKTR_STOP1(m, egroup, ident, key, a0, v0)
\
+   KTR_EVENT1(m, egroup, ident, "stop:0x%jX", (uintmax_t)key, a0, (v0))
+#defineKTR_STOP2(m, egroup, ident, key, a0, v0, a1, v1)
\
+   KTR_EVENT2(m, egroup, ident, "stop:0x%jX", (uintmax_t)key,  \
+   a0, (v0), a1, (v1))
+#defineKTR_STOP3(m, egroup, ident, key, a0, v0, a1, v1, a2, v2)\
+   KTR_EVENT3(m, egroup

Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Chris Rees
On 19 Dec 2012 19:37, "Garrett Cooper"  wrote:
>
> On Wed, Dec 19, 2012 at 7:37 AM, Ian Lepore
>  wrote:
>
> ...
>
> > Instead of running sysctl a bunch of times, how about something
> > conceptually similar to
> >
> >cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f -
> >
> > Along with this (untested) patch to make sysctl understand "-f -".
> >
> > Hmmm, is /dev/stdin available as early as sysctl.conf runs?  If not, the
> > attached patch isn't going to work.
>
> Why not just make sysctl understand multiple -f options? You're
> probably going to run into more problems parsing from /dev/stdin and
> it's going to obfuscate things a lot dealing with which file came
> last, feeding back diagnostic info, etc.
> Please don't "linuxise" this tool.

I seem to recall cpio being around a lot before Linux... Our sh also
accepts piped scripts.  It's useful.

ssh host cat file | sysctl -f -

Chris
___
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: r244446 - head/sys/arm/conf

2012-12-19 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Dec 19 20:33:16 2012
New Revision: 26
URL: http://svnweb.freebsd.org/changeset/base/26

Log:
  Use NFSCL since NFSCLIENT build is broken at the moment

Modified:
  head/sys/arm/conf/PANDABOARD

Modified: head/sys/arm/conf/PANDABOARD
==
--- head/sys/arm/conf/PANDABOARDWed Dec 19 20:10:00 2012
(r25)
+++ head/sys/arm/conf/PANDABOARDWed Dec 19 20:33:16 2012
(r26)
@@ -47,9 +47,7 @@ options   UFS_DIRHASH #Improve performan
 device snp
 optionsBREAK_TO_DEBUGGER
 
-#options   NFSCL
-optionsNFSCLIENT   #Network Filesystem Client
-#options   NFSSERVER   #Network Filesystem Server
+optionsNFSCL
 optionsNFS_ROOT#NFS usable as /, requires NFSCLIENT
 #options   BOOTP_NFSROOT
 #options   BOOTP_COMPAT
___
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: r244447 - head/usr.sbin/nfsd

2012-12-19 Thread Rick Macklem
Author: rmacklem
Date: Wed Dec 19 21:00:22 2012
New Revision: 27
URL: http://svnweb.freebsd.org/changeset/base/27

Log:
  Post r243965 the nfsd daemon will not start up for kernels
  built without "options INET6". This patch fixes the problem.
  
  Reported by:  avg
  Tested by:avg
  MFC after:2 weeks

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

Modified: head/usr.sbin/nfsd/nfsd.c
==
--- head/usr.sbin/nfsd/nfsd.c   Wed Dec 19 20:33:16 2012(r26)
+++ head/usr.sbin/nfsd/nfsd.c   Wed Dec 19 21:00:22 2012(r27)
@@ -264,7 +264,7 @@ main(int argc, char **argv)
ip6flag = 1;
s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
if (s == -1) {
-   if (errno != EPROTONOSUPPORT)
+   if (errno != EPROTONOSUPPORT && errno != EAFNOSUPPORT)
err(1, "socket");
ip6flag = 0;
} else if (getnetconfigent("udp6") == NULL ||
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Jilles Tjoelker
On Wed, Dec 19, 2012 at 11:16:26AM -0800, Xin Li wrote:
> It may be worthy to make sysctl(8) to accept mutiple -f's, but it
> seems to be hard to write shell scripts that utilizes this feature in
> a elegant manner.

This is possible but indeed a bit ugly.

Hard-coding the list of files is not too bad:

shift $#
for _f in /etc/sysctl.d/* /etc/sysctl.conf /etc/sysctl.conf.local; do
[ -r "$_f" ] && set -- "$@" -f "$_f"
done
sysctl "$@"

If the list is passed in the positional parameters it becomes uglier:

_first=1
for _f do
[ -n "$_first" ] && shift $#
_first=
[ -r "$_f" ] && set -- "$@" -f "$_f"
done
sysctl "$@"

This uses for's temporary storage of the words being iterated over,
building a new set of positional parameters in the loop.

An alternative is to append the new list to the old one and to use a
saved copy of $# to remove the old elements afterwards.

It would be nice to store the arguments in a variable but that is not
possible because all characters are valid in pathnames, except the null
character which cannot be used in shell either.

-- 
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Garrett Cooper
On Wed, Dec 19, 2012 at 12:14 PM, Chris Rees  wrote:
>
> On 19 Dec 2012 19:37, "Garrett Cooper"  wrote:
>>
>> On Wed, Dec 19, 2012 at 7:37 AM, Ian Lepore
>>  wrote:
>>
>> ...
>>
>> > Instead of running sysctl a bunch of times, how about something
>> > conceptually similar to
>> >
>> >cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f -
>> >
>> > Along with this (untested) patch to make sysctl understand "-f -".
>> >
>> > Hmmm, is /dev/stdin available as early as sysctl.conf runs?  If not, the
>> > attached patch isn't going to work.
>>
>> Why not just make sysctl understand multiple -f options? You're
>> probably going to run into more problems parsing from /dev/stdin and
>> it's going to obfuscate things a lot dealing with which file came
>> last, feeding back diagnostic info, etc.
>> Please don't "linuxise" this tool.
>
> I seem to recall cpio being around a lot before Linux... Our sh also accepts
> piped scripts.  It's useful.

Yes, but it just compresses data and doesn't have to necessarily
backtrack in order to do so.

> ssh host cat file | sysctl -f -

I prefer:

ssh host cat file > foo
sysctl -f foo

... and my bikesheds navy blue.

Point is that Ian is potentially solving the problem incorrectly (his
concern is over I/O latency when booting up on slower platforms).
Unless he has measurements and tests to support doing this, it really
doesn't make sense to morph sysctl from the stripped down sh
"interpreter" that it is today into something that have to handle some
of the other error conditions and input permutations that hexdump/od
deals with (which his beforementioned patch doesn't do, neither did
the patch/commit that hrs/delphij posted) as real files are grossly
different from character devices and stdio file descriptors.

I would have less qualms if the support came directly from NetBSD as
there would have been some traction on it, but the problem is that the
proposal will a) make sysctl slower and bigger (I know more than a
handful of scripts that execute sysctl _a lot_, so the faster it is at
loading the image into memory and executing the better), and b) will
make sysctl diverge further from the other BSDs (which means less
testing, more code janitor work later on, have to deal with backport
issues, etc).

Traditional Unix philosophy is construction of simple commands with a
particular, well-defined purpose. Some of the suggestions made here
doing #file, etc are going in a very Linux centric direction by making
sysctl into a custom swiss army knife that does 20 different things
instead of [again] solving what the root issue is in Ian's case:
making his system boot faster.

Thanks,
-Garrett
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Garrett Cooper
On Wed, Dec 19, 2012 at 1:04 PM, Jilles Tjoelker  wrote:
> On Wed, Dec 19, 2012 at 11:16:26AM -0800, Xin Li wrote:
>> It may be worthy to make sysctl(8) to accept mutiple -f's, but it
>> seems to be hard to write shell scripts that utilizes this feature in
>> a elegant manner.
>
> This is possible but indeed a bit ugly.
>
> Hard-coding the list of files is not too bad:
>
> shift $#
> for _f in /etc/sysctl.d/* /etc/sysctl.conf /etc/sysctl.conf.local; do
> [ -r "$_f" ] && set -- "$@" -f "$_f"
> done
> sysctl "$@"
>
> If the list is passed in the positional parameters it becomes uglier:
>
> _first=1
> for _f do
> [ -n "$_first" ] && shift $#
> _first=
> [ -r "$_f" ] && set -- "$@" -f "$_f"
> done
> sysctl "$@"
>
> This uses for's temporary storage of the words being iterated over,
> building a new set of positional parameters in the loop.
>
> An alternative is to append the new list to the old one and to use a
> saved copy of $# to remove the old elements afterwards.
>
> It would be nice to store the arguments in a variable but that is not
> possible because all characters are valid in pathnames, except the null
> character which cannot be used in shell either.

find -exec / echo | xargs ? Seems like there's a better way to solve this.
Thanks,
-Garrett
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Garrett Cooper
On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper  wrote:

...

> find -exec / echo | xargs ? Seems like there's a better way to solve this.

Of course we also might be overengineering the problem (my
suggestion definitely was overengineered). Why not pass in the
appropriate arguments via sysctl_args in /etc/rc.conf ?
Thanks,
-Garrett
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Xin Li
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 12/19/12 13:08, Garrett Cooper wrote:
> On Wed, Dec 19, 2012 at 12:14 PM, Chris Rees 
> wrote:
>> 
>> On 19 Dec 2012 19:37, "Garrett Cooper" 
>> wrote:
>>> 
>>> On Wed, Dec 19, 2012 at 7:37 AM, Ian Lepore 
>>>  wrote:
>>> 
>>> ...
>>> 
 Instead of running sysctl a bunch of times, how about
 something conceptually similar to
 
 cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f -
 
 Along with this (untested) patch to make sysctl understand
 "-f -".
 
 Hmmm, is /dev/stdin available as early as sysctl.conf runs?
 If not, the attached patch isn't going to work.
>>> 
>>> Why not just make sysctl understand multiple -f options?
>>> You're probably going to run into more problems parsing from
>>> /dev/stdin and it's going to obfuscate things a lot dealing
>>> with which file came last, feeding back diagnostic info, etc. 
>>> Please don't "linuxise" this tool.
>> 
>> I seem to recall cpio being around a lot before Linux... Our sh
>> also accepts piped scripts.  It's useful.
> 
> Yes, but it just compresses data and doesn't have to necessarily 
> backtrack in order to do so.
> 
>> ssh host cat file | sysctl -f -
> 
> I prefer:
> 
> ssh host cat file > foo sysctl -f foo
> 
> ... and my bikesheds navy blue.

Vulnerable to temporary file attacks (which is relatively easy to
mitigate with mkstemp, though) and poor error handling.

Cheers,
- -- 
Xin LI https://www.delphij.net/
FreeBSD - The Power to Serve!   Live free or die
-BEGIN PGP SIGNATURE-

iQEcBAEBCAAGBQJQ0jqqAAoJEG80Jeu8UPuzBiMH/3EF1cDUcjpa9+k7OAPmJx89
PGQhy64QH5CZiztTFMpHsywaAJSr/5LeR/28SdP4YRB67P4IeSLFgRsB+6XqmCJz
cwtuYmZKiorjUhZ9jojwuYG+tab/dRFit46oqk5FujVE8FPhvvBcDpwVyX5vXfsX
HHUyks49pjx/pTFGldb6BxZ9Gp9OZyNXgAM5/RLAW/NLYMEksSp2z4YUquYIZYeh
8ZWsdpQKLFRXv3XG1pnpNYinoKjJ5Khxi6J10yrrOnBdUE1d0VBbMb5BdrBui65I
bQVBTNPnoIQEYP2HtLybL5nnpwvX23ujLDQOxOA6/HtEUz6+206s9JHjRTTWOnc=
=+9Qv
-END PGP SIGNATURE-
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Xin Li
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 12/19/12 13:10, Garrett Cooper wrote:
> On Wed, Dec 19, 2012 at 1:04 PM, Jilles Tjoelker 
> wrote:
>> On Wed, Dec 19, 2012 at 11:16:26AM -0800, Xin Li wrote:
>>> It may be worthy to make sysctl(8) to accept mutiple -f's, but
>>> it seems to be hard to write shell scripts that utilizes this
>>> feature in a elegant manner.
>> 
>> This is possible but indeed a bit ugly.
>> 
>> Hard-coding the list of files is not too bad:
>> 
>> shift $# for _f in /etc/sysctl.d/* /etc/sysctl.conf
>> /etc/sysctl.conf.local; do [ -r "$_f" ] && set -- "$@" -f "$_f" 
>> done sysctl "$@"
>> 
>> If the list is passed in the positional parameters it becomes
>> uglier:
>> 
>> _first=1 for _f do [ -n "$_first" ] && shift $# _first= [ -r
>> "$_f" ] && set -- "$@" -f "$_f" done sysctl "$@"
>> 
>> This uses for's temporary storage of the words being iterated
>> over, building a new set of positional parameters in the loop.
>> 
>> An alternative is to append the new list to the old one and to
>> use a saved copy of $# to remove the old elements afterwards.
>> 
>> It would be nice to store the arguments in a variable but that is
>> not possible because all characters are valid in pathnames,
>> except the null character which cannot be used in shell either.
> 
> find -exec / echo | xargs ? Seems like there's a better way to
> solve this. Thanks,

Won't work because you have to add -f's.

Cheers,
- -- 
Xin LI https://www.delphij.net/
FreeBSD - The Power to Serve!   Live free or die
-BEGIN PGP SIGNATURE-

iQEcBAEBCAAGBQJQ0jjBAAoJEG80Jeu8UPuzdRQH/AxNFRT1n+9aGQ7BuwHXSl5k
aY+Em7+W7de4HRh2Xmkt66q64419HxgKBv45DBtcg35xEWIaDBNTgZ0JKfvG94eg
mH43tq270sTuWJ1pZRIxybfLSPrP2uwsyG372Vw40AW2KdrWH1VZgKlTlmU8nF9G
b/cnTa5BhD5r+35o2gsWIQT6j34hWGja9tOi4vgmAAMxDbgdL2sHE42R0Tex/Ydz
hlRXAl+dMNqx9mw0rUwKdGBUFa5vDLokhI+AKCiAOMPxtUqheee1GqAytyEb0nst
uZcF/cmBDoS5j/W7UGfLrlR6fSr0nxqjbIVr4VSa15aUCvEmW5oZ3HhRy+lZYM4=
=5kx8
-END PGP SIGNATURE-
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Xin Li
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 12/19/12 13:12, Garrett Cooper wrote:
> On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper
>  wrote:
> 
> ...
> 
>> find -exec / echo | xargs ? Seems like there's a better way to
>> solve this.
> 
> Of course we also might be overengineering the problem (my 
> suggestion definitely was overengineered). Why not pass in the 
> appropriate arguments via sysctl_args in /etc/rc.conf ? Thanks,

Irrelevant.  Consider this (extreme) situation: someone distributes
several sets of sysctl values tuned for certain situations, like
tcp.conf, supermicro.conf, ... and wants to put them together in a
directory, it's useful to source from the directory without having to
do a generation of command line on boot, so when something goes wrong,
they just remove the pack rather than changing /etc/rc.conf.

Cheers,
- -- 
Xin LI https://www.delphij.net/
FreeBSD - The Power to Serve!   Live free or die
-BEGIN PGP SIGNATURE-

iQEcBAEBCAAGBQJQ0jlhAAoJEG80Jeu8UPuzxfMH+wejtu+VZeIqL9QMDT1LRlgp
l3BQgq2SHg25agnDBrt0fj8T69oR9+T/o6cXUlfQH05U0Lb6E70AFd69YeLrdxfj
KmwPmh2R/I8tdvlAp8cUn6FGuuM/9ssMk+ppmU3hjxynuVCRmuY3Dra9RJZ7Sh+J
P+MgN50KwRHBvWSLITNyr9u3TE2euk23Q/QZLqw2lZpWRiM96aSYzHHtdmJZkk+F
1A9cZPsGGy4w9fhxzANbMfDwGfvKucG79l7W6wly85LCAOMv/M9GmWUWDC6j4Q93
sIJyca/19JOdDBQL0zBLDarCkZdgeKYUHbZNY4h1SCT2tjuIHF3Qc6sHRRyhDjQ=
=a5K4
-END PGP SIGNATURE-
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Benjamin Kaduk
[cc trimmed]

On Wed, Dec 19, 2012 at 5:02 PM, Xin Li  wrote:

> Irrelevant.  Consider this (extreme) situation: someone distributes
> several sets of sysctl values tuned for certain situations, like
> tcp.conf, supermicro.conf, ... and wants to put them together in a
> directory, it's useful to source from the directory without having to
> do a generation of command line on boot, so when something goes wrong,
> they just remove the pack rather than changing /etc/rc.conf.
>

Not a direct reply, but just noting that it can be *very* useful to have,
e.g., a README or foo.old or foo.disabled file in
the same directory where the "live" configuration files live.  Always
interpreting the full '*' glob is not always the best
thing to do.

-Ben Kaduk
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Garrett Cooper
On Wed, Dec 19, 2012 at 2:07 PM, Xin Li  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> On 12/19/12 13:08, Garrett Cooper wrote:
>> On Wed, Dec 19, 2012 at 12:14 PM, Chris Rees 
>> wrote:
>>>
>>> On 19 Dec 2012 19:37, "Garrett Cooper" 
>>> wrote:

 On Wed, Dec 19, 2012 at 7:37 AM, Ian Lepore
  wrote:

 ...

> Instead of running sysctl a bunch of times, how about
> something conceptually similar to
>
> cat /etc/sysctl.d/* /etc/sysctl.conf | sysctl -f -
>
> Along with this (untested) patch to make sysctl understand
> "-f -".
>
> Hmmm, is /dev/stdin available as early as sysctl.conf runs?
> If not, the attached patch isn't going to work.

 Why not just make sysctl understand multiple -f options?
 You're probably going to run into more problems parsing from
 /dev/stdin and it's going to obfuscate things a lot dealing
 with which file came last, feeding back diagnostic info, etc.
 Please don't "linuxise" this tool.
>>>
>>> I seem to recall cpio being around a lot before Linux... Our sh
>>> also accepts piped scripts.  It's useful.
>>
>> Yes, but it just compresses data and doesn't have to necessarily
>> backtrack in order to do so.
>>
>>> ssh host cat file | sysctl -f -
>>
>> I prefer:
>>
>> ssh host cat file > foo sysctl -f foo
>>
>> ... and my bikesheds navy blue.
>
> Vulnerable to temporary file attacks (which is relatively easy to
> mitigate with mkstemp, though) and poor error handling.

I am well aware of that; it was just a simple example.
Pedantically speaking if I really cared about "robustness" in terms of
setting sysctls, I would do this:

#!/bin/sh
set -ex
: ${TMPDIR=/tmp}
tmp="$(mktemp "$TMPDIR/sysctl.XX")"
trap "rm -f '$tmp'" EXIT
ssh host "cat file" > "$tmp"
sysctl -f "$tmp"
# =

But even that's not perfect: just like all the EISPIPE errors that
could come along and ruin one's day running sysctl(8) with the
previous suggested patch if one has things defined in the right/wrong
order, partial input comes across the fifo/pipe/socket/etc, or I
needed to roll back the changes as well.
Thanks,
-Garrett
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Xin Li
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 12/19/12 14:28, Benjamin Kaduk wrote:
> [cc trimmed]
> 
> On Wed, Dec 19, 2012 at 5:02 PM, Xin Li  > wrote:
> 
> Irrelevant.  Consider this (extreme) situation: someone
> distributes several sets of sysctl values tuned for certain
> situations, like tcp.conf, supermicro.conf, ... and wants to put
> them together in a directory, it's useful to source from the
> directory without having to do a generation of command line on
> boot, so when something goes wrong, they just remove the pack
> rather than changing /etc/rc.conf.
> 
> 
> Not a direct reply, but just noting that it can be *very* useful
> to have, e.g., a README or foo.old or foo.disabled file in the same
> directory where the "live" configuration files live.  Always 
> interpreting the full '*' glob is not always the best thing to do.

This is not an Unix utility should solve.  To quote Terry Lambert: "If
you aim the gun at your foot and pull the trigger, it's UNIX's job to
ensure reliable delivery of the bullet to where you aimed the gun (in
this case, Mr. Foot)."  In other words, sysctl -f README should
interpret README as input, not a file that contains user consumable text.

To solve the problem we need a construct like in /etc/rc.subr,
run_rc_script().

Cheers,
- -- 
Xin LI https://www.delphij.net/
FreeBSD - The Power to Serve!   Live free or die
-BEGIN PGP SIGNATURE-

iQEcBAEBCAAGBQJQ0kGbAAoJEG80Jeu8UPuzdzsH/35v8W1ww2AIqun5Hhwp35Az
xxlf/TDQdW1WE3ZwW2gqOD7AgGx+Q3yRKf+nGmQe1yvu8WP3i4HVUkDfp+ySzytZ
oEBxLJnYZGstuHcmhncLGU6PbCBwcK3Y9dRlFIb9L5srFHaVuMsWK2nIZDx7TeOS
+tcSwOSuJrerqCw6e6O61spHYTnIdnlAb1jEV7GaUciVqcgBxbKMf9iMpAspWm/e
vl3dogHI+0NCT/tgaKAjS2EdG5UKqugF6Opc5RrwqDRo6kFNExy+0DN1UeFN4ahV
775872xHZEkHJvZtoTNXH5wKsfPhvjKLne2/nVkKhfu9aHwkXaHdZZXJdxB7+RU=
=kMyx
-END PGP SIGNATURE-
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Benjamin Kaduk
On Wed, Dec 19, 2012 at 5:37 PM, Xin Li  wrote:

> > Not a direct reply, but just noting that it can be *very* useful
> > to have, e.g., a README or foo.old or foo.disabled file in the same
> > directory where the "live" configuration files live.  Always
> > interpreting the full '*' glob is not always the best thing to do.
>
> This is not an Unix utility should solve.  To quote Terry Lambert: "If
> you aim the gun at your foot and pull the trigger, it's UNIX's job to
> ensure reliable delivery of the bullet to where you aimed the gun (in
> this case, Mr. Foot)."  In other words, sysctl -f README should
> interpret README as input, not a file that contains user consumable text.
>

Certainly.
I was thinking about the proposal akin to 'cat /etc/sysctl.d/* | sysctl -f
-' and similar proposals bandied about.

I would prefer to not see an unanchored glob used in such a case.

-Ben Kaduk
___
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: r244451 - head/sys/kern

2012-12-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Dec 19 23:40:02 2012
New Revision: 244451
URL: http://svnweb.freebsd.org/changeset/base/244451

Log:
  Use correct file permissions when looking for available core file if
  kern.corefile contains %I.
  
  Obtained from:WHEEL Systems

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cWed Dec 19 23:34:19 2012(r244450)
+++ head/sys/kern/kern_sig.cWed Dec 19 23:40:02 2012(r244451)
@@ -3125,7 +3125,7 @@ expand_name(const char *comm, uid_t uid,
struct nameidata nd;
int cmode, flags, oflags, error;
 
-   cmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
+   cmode = S_IRUSR | S_IWUSR;
oflags = VN_OPEN_NOAUDIT |
(capmode_coredump ? VN_OPEN_NOCAPCHECK : 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: r244452 - head/sys/kern

2012-12-19 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Dec 19 23:59:48 2012
New Revision: 244452
URL: http://svnweb.freebsd.org/changeset/base/244452

Log:
  Replace expand_name() function with corefile_open() function, which not
  only returns name, but also vnode of corefile to use.
  
  This simplifies the code and closes few races, especially in %I handling.
  
  Reviewed by:  kib
  Obtained from:WHEEL Systems

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cWed Dec 19 23:40:02 2012(r244451)
+++ head/sys/kern/kern_sig.cWed Dec 19 23:59:48 2012(r244452)
@@ -106,7 +106,6 @@ SDT_PROBE_ARGTYPE(proc, kernel, , signal
 SDT_PROBE_ARGTYPE(proc, kernel, , signal_discard, 2, "int");
 
 static int coredump(struct thread *);
-static char*expand_name(const char *, uid_t, pid_t, struct thread *, int);
 static int killpg1(struct thread *td, int sig, int pgid, int all,
ksiginfo_t *ksi);
 static int issignal(struct thread *td, int stop_allowed);
@@ -3034,8 +3033,9 @@ SYSCTL_STRING(_kern, OID_AUTO, corefile,
 sizeof(corefilename), "Process corefile name format string");
 
 /*
- * expand_name(name, uid, pid, td, compress)
- * Expand the name described in corefilename, using name, uid, and pid.
+ * corefile_open(comm, uid, pid, td, compress, vpp, namep)
+ * Expand the name described in corefilename, using name, uid, and pid
+ * and open/create core file.
  * corefilename is a printf-like string, with three format specifiers:
  * %N  name of process ("name")
  * %P  process id (pid)
@@ -3044,15 +3044,15 @@ SYSCTL_STRING(_kern, OID_AUTO, corefile,
  * by using "/dev/null", or all core files can be stored in "/cores/%U/%N-%P".
  * This is controlled by the sysctl variable kern.corefile (see above).
  */
-static char *
-expand_name(const char *comm, uid_t uid, pid_t pid, struct thread *td,
-int compress)
+static int
+corefile_open(const char *comm, uid_t uid, pid_t pid, struct thread *td,
+int compress, struct vnode **vpp, char **namep)
 {
+   struct nameidata nd;
struct sbuf sb;
const char *format;
-   char *name;
-   int i, indexpos;
-   char *hostname;
+   char *hostname, *name;
+   int indexpos, i, error, cmode, flags, oflags;
 
hostname = NULL;
format = corefilename;
@@ -3110,11 +3110,14 @@ expand_name(const char *comm, uid_t uid,
"long\n", (long)pid, comm, (u_long)uid);
sbuf_delete(&sb);
free(name, M_TEMP);
-   return (NULL);
+   return (ENOMEM);
}
sbuf_finish(&sb);
sbuf_delete(&sb);
 
+   cmode = S_IRUSR | S_IWUSR;
+   oflags = VN_OPEN_NOAUDIT | (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0);
+
/*
 * If the core format has a %I in it, then we need to check
 * for existing corefiles before returning a name.
@@ -3122,18 +3125,10 @@ expand_name(const char *comm, uid_t uid,
 * non-existing core file name to use.
 */
if (indexpos != -1) {
-   struct nameidata nd;
-   int cmode, flags, oflags, error;
-
-   cmode = S_IRUSR | S_IWUSR;
-   oflags = VN_OPEN_NOAUDIT |
-   (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0);
-
for (i = 0; i < num_cores; i++) {
flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW;
name[indexpos] = '0' + i;
-   NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE,
-   name, td);
+   NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td);
error = vn_open_cred(&nd, &flags, cmode, oflags,
td->td_ucred, NULL);
if (error) {
@@ -3143,25 +3138,26 @@ expand_name(const char *comm, uid_t uid,
"pid %d (%s), uid (%u):  Path `%s' failed "
"on initial open test, error = %d\n",
pid, comm, uid, name, error);
-   free(name, M_TEMP);
-   return (NULL);
-   }
-   NDFREE(&nd, NDF_ONLY_PNBUF);
-   VOP_UNLOCK(nd.ni_vp, 0);
-   error = vn_close(nd.ni_vp, FWRITE, td->td_ucred, td);
-   if (error) {
-   log(LOG_ERR,
-   "pid %d (%s), uid (%u):  Path `%s' failed "
-   "on close after initial open test, "
-   "error = %d\n",
-   pid, comm, uid, name, error);
-   free(name, M_TEMP);
-   return (NULL);

svn commit: r244453 - head/sys/conf

2012-12-19 Thread Olivier Houchard
Author: cognet
Date: Thu Dec 20 00:06:24 2012
New Revision: 244453
URL: http://svnweb.freebsd.org/changeset/base/244453

Log:
  Get the old NFSCLIENT to compile by adding now needed files.

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Dec 19 23:59:48 2012(r244452)
+++ head/sys/conf/files Thu Dec 20 00:06:24 2012(r244453)
@@ -3511,15 +3511,15 @@ rpc/clnt_dg.c   optional krpc | nfslockd
 rpc/clnt_rc.c  optional krpc | nfslockd | nfsclient | nfscl | 
nfsd
 rpc/clnt_vc.c  optional krpc | nfslockd | nfsclient | 
nfsserver | nfscl | nfsd
 rpc/getnetconfig.c optional krpc | nfslockd | nfsclient | 
nfsserver | nfscl | nfsd
-rpc/replay.c   optional krpc | nfslockd | nfsserver | nfscl | 
nfsd
+rpc/replay.c   optional krpc | nfslockd | nfsclient | 
nfsserver | nfscl | nfsd
 rpc/rpc_callmsg.c  optional krpc | nfslockd | nfsclient | 
nfsserver | nfscl | nfsd
 rpc/rpc_generic.c  optional krpc | nfslockd | nfsclient | 
nfsserver | nfscl | nfsd
 rpc/rpc_prot.c optional krpc | nfslockd | nfsclient | 
nfsserver | nfscl | nfsd
 rpc/rpcb_clnt.coptional krpc | nfslockd | nfsclient | 
nfsserver | nfscl | nfsd
 rpc/rpcb_prot.coptional krpc | nfslockd | nfsclient | 
nfsserver | nfscl | nfsd
-rpc/svc.c  optional krpc | nfslockd | nfsserver | nfscl | 
nfsd
-rpc/svc_auth.c optional krpc | nfslockd | nfsserver | nfscl | 
nfsd
-rpc/svc_auth_unix.coptional krpc | nfslockd | nfsserver | nfscl | 
nfsd
+rpc/svc.c  optional krpc | nfslockd | nfsclient | 
nfsserver | nfscl | nfsd
+rpc/svc_auth.c optional krpc | nfslockd | nfsclient | 
nfsserver | nfscl | nfsd
+rpc/svc_auth_unix.coptional krpc | nfslockd | nfsclient | 
nfsserver | nfscl | nfsd
 rpc/svc_dg.c   optional krpc | nfslockd | nfsserver | nfscl | 
nfsd
 rpc/svc_generic.c  optional krpc | nfslockd | nfsserver | nfscl | 
nfsd
 rpc/svc_vc.c   optional krpc | nfslockd | nfsserver | nfscl | 
nfsd
___
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: r244112 - head/sys/kern

2012-12-19 Thread John Baldwin
On Tuesday, December 18, 2012 5:31:47 pm Alfred Perlstein wrote:
> On 12/18/12 12:37 PM, John Baldwin wrote:
> > On Monday, December 17, 2012 4:21:43 pm Alfred Perlstein wrote:
> >> On 12/17/12 11:39 AM, John Baldwin wrote:
> >>> On Saturday, December 15, 2012 1:04:17 am Bruce Evans wrote:
>  On Fri, 14 Dec 2012, Alfred Perlstein wrote:
> 
> > On 12/14/12 4:12 PM, Robert Watson wrote:
> >> On Fri, 14 Dec 2012, John Baldwin wrote:
> >>
> >>> On Thursday, December 13, 2012 4:02:15 am Gleb Smirnoff wrote:
>  On Wed, Dec 12, 2012 at 04:53:48PM -0800, Alfred Perlstein wrote: A> 
>  The
>  problem again is that not all the KASSERTS are inviolable, if you A> 
>  want
>  to do a project to split them, then please do, it would really be A>
>  helpful, as for now, they are a mis-mash of death/warnings and there 
>  are
>  A> at least three vendors who approve of this as well as 3 long term 
>  A>
>  committers that approved my change (not including Adrian).
> 
>  Can you show examples of not inviolable KASSERTs?
> >>> There are none.  They are all assertions for a reason.  However, in my
>  Not even one whose existence is a bug? :-)
> >>> They should just not exist at all then. :)  All the more reason for them 
> >>> to
> >>> panic early and often so developers will be prompted to remove them.
> >>>
> >> This is hard to explain to a customer.
> >>
> >> customer: "So we ran your debug image and got you a panic, here is the
> >> information.  So can you tell us what is the problem?"
> >> alfred: "well that is due to XXX other thing that is broken, thanks for
> >> helping us resolve that unrelated problem!"
> >> customer: "i hate you"
> >> alfred: "get in line."
> > Are your customers running HEAD?  Assertions in a stable branch have been
> > through testing and generally aren't bogus, so dying on incorrect assertions
> > (meaning the assertion tripped for non-buggy code) should not be the common
> > case.  Thus, that shouldn't really be the basis for an argument on this.
> >
> > I can also come up with arbitrary strawmen:
> >
> > customer: "help!  we lost a bunch of data!"
> > jhb: "oh, well, I can see why: the box reported this critical error while
> >your data was still there, but it went ahead and corrupted it all
> >anyway even though it knew about the error because I thought you 
> > wanted
> >longer uptimes"
> > jhb: "don't worry, I have a patch to fix the error"
> > customer: "don't bother, we are switching to X"
> >
> 
> Yes, that happens when they run -stable.

No, the kernel doesn't "know" it's going to corrupt the data if assertions
aren't enabled.

If you had something that only selectively enabled certain assertions that
would be fine, but in my use case I'd still want them to always panic.

That would just give you a more fine-grained tool for how much performance
you are willing to sacrafice for extra safety.

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


Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Mark Johnston
On Wed, Dec 19, 2012 at 02:02:09PM -0800, Xin Li wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
> 
> On 12/19/12 13:12, Garrett Cooper wrote:
> > On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper
> >  wrote:
> > 
> > ...
> > 
> >> find -exec / echo | xargs ? Seems like there's a better way to
> >> solve this.
> > 
> > Of course we also might be overengineering the problem (my 
> > suggestion definitely was overengineered). Why not pass in the 
> > appropriate arguments via sysctl_args in /etc/rc.conf ? Thanks,
> 
> Irrelevant.  Consider this (extreme) situation: someone distributes
> several sets of sysctl values tuned for certain situations, like
> tcp.conf, supermicro.conf, ... and wants to put them together in a
> directory, it's useful to source from the directory without having to
> do a generation of command line on boot, so when something goes wrong,
> they just remove the pack rather than changing /etc/rc.conf.

At work I've changed the -f flag of syslogd and newsyslog to accept a
directory which gets non-recursively searched for input files. This way
we can have a directory, say /etc/syslog.d, into which package install
scripts can easily drop config files.

For something like sysctl this might be a bit much, but it's just a
thought. The example diff below is what I have in mind.

-Mark

diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index 8fad089..c880b45 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -42,6 +42,7 @@ static const char rcsid[] =
 #endif /* not lint */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -49,6 +50,7 @@ static const char rcsid[] =
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -64,6 +66,7 @@ static const char *conffile;
 static int aflag, bflag, dflag, eflag, hflag, iflag;
 static int Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag;
 
+static int handlefile(const char *);
 static int oidfmt(int *, int, char *, u_int *);
 static int parsefile(const char *);
 static int parse(const char *, int);
@@ -165,7 +168,7 @@ main(int argc, char **argv)
 
warncount = 0;
if (conffile != NULL)
-   warncount += parsefile(conffile);
+   warncount += handlefile(conffile);
 
while (argc-- > 0)
warncount += parse(*argv++, 0);
@@ -402,6 +405,48 @@ parse(const char *string, int lineno)
 }
 
 static int
+handlefile(const char *filename)
+{
+   DIR *dir;
+   struct dirent *de;
+   struct stat sb;
+   char path[MAXPATHLEN], *fname;
+   size_t off;
+   int warncount = 0;
+
+   if (stat(filename, &sb))
+   err(EX_NOINPUT, "%s", filename);
+   if (S_ISREG(sb.st_mode)) {
+   return (parsefile(filename));
+   } else if (!S_ISDIR(sb.st_mode))
+   errx(EX_USAGE, "invalid input file '%s'", filename);
+
+   dir = opendir(filename);
+   if (dir == NULL)
+   err(EX_NOINPUT, "%s", filename);
+   off = strlcpy(path, filename, sizeof(path) - 1);
+   if (off >= sizeof(path) - 1)
+   errx(EX_NOINPUT, "input path '%s' too long", filename);
+
+   fname = path + off;
+   *fname++ = '/';
+   off++;
+   while ((de = readdir(dir)) != NULL) {
+   strlcpy(fname, de->d_name, sizeof(path) - off);
+   if (stat(path, &sb)) {
+   warn("%s", path);
+   continue;
+   } else if (!S_ISREG(sb.st_mode))
+   continue;
+
+   warncount += parsefile(path);
+   }
+   closedir(dir);
+
+   return (warncount);
+}
+
+static int
 parsefile(const char *filename)
 {
FILE *file;
___
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: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Mark Johnston
On Wed, Dec 19, 2012 at 05:21:40PM -0600, Brooks Davis wrote:
> On Wed, Dec 19, 2012 at 05:58:54PM -0500, Mark Johnston wrote:
> > On Wed, Dec 19, 2012 at 02:02:09PM -0800, Xin Li wrote:
> > > -BEGIN PGP SIGNED MESSAGE-
> > > Hash: SHA256
> > > 
> > > On 12/19/12 13:12, Garrett Cooper wrote:
> > > > On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper
> > > >  wrote:
> > > > 
> > > > ...
> > > > 
> > > >> find -exec / echo | xargs ? Seems like there's a better way to
> > > >> solve this.
> > > > 
> > > > Of course we also might be overengineering the problem (my 
> > > > suggestion definitely was overengineered). Why not pass in the 
> > > > appropriate arguments via sysctl_args in /etc/rc.conf ? Thanks,
> > > 
> > > Irrelevant.  Consider this (extreme) situation: someone distributes
> > > several sets of sysctl values tuned for certain situations, like
> > > tcp.conf, supermicro.conf, ... and wants to put them together in a
> > > directory, it's useful to source from the directory without having to
> > > do a generation of command line on boot, so when something goes wrong,
> > > they just remove the pack rather than changing /etc/rc.conf.
> > 
> > At work I've changed the -f flag of syslogd and newsyslog to accept a
> > directory which gets non-recursively searched for input files. This way
> > we can have a directory, say /etc/syslog.d, into which package install
> > scripts can easily drop config files.
> > 
> > For something like sysctl this might be a bit much, but it's just a
> > thought. The example diff below is what I have in mind.
> 
> I don't have a strong opinion about the usefulness of this feature.  It
> seems useful particularly in conjunction with supporting multiple -f's.

I don't really either. Just thought I'd suggest it.

> 
> I do have a few comments on the implementation below.
> 

Thanks! I didn't know about openat(). Here's the regenerated diff.

diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index 8fad089..9e453f6 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -42,6 +42,7 @@ static const char rcsid[] =
 #endif /* not lint */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -49,8 +50,11 @@ static const char rcsid[] =
 #include 
 
 #include 
+#include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -64,8 +68,9 @@ static const char *conffile;
 static int aflag, bflag, dflag, eflag, hflag, iflag;
 static int Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag;
 
+static int handlefile(const char *);
 static int oidfmt(int *, int, char *, u_int *);
-static int parsefile(const char *);
+static int parsefile(int);
 static int parse(const char *, int);
 static int show_var(int *, int);
 static int sysctl_all(int *oid, int len);
@@ -165,7 +170,7 @@ main(int argc, char **argv)
 
warncount = 0;
if (conffile != NULL)
-   warncount += parsefile(conffile);
+   warncount += handlefile(conffile);
 
while (argc-- > 0)
warncount += parse(*argv++, 0);
@@ -402,15 +407,55 @@ parse(const char *string, int lineno)
 }
 
 static int
-parsefile(const char *filename)
+handlefile(const char *filename)
+{
+   DIR *dir;
+   struct dirent *de;
+   struct stat sb;
+   int fd, warncount = 0;
+
+   fd = open(filename, O_RDONLY);
+   if (fd < 0)
+   err(EX_NOINPUT, "%s", filename);
+   if (fstat(fd, &sb))
+   err(EX_NOINPUT, "%s", filename);
+
+   if (S_ISREG(sb.st_mode)) {
+   return (parsefile(fd));
+   } else if (!S_ISDIR(sb.st_mode))
+   errx(EX_USAGE, "invalid input file '%s'", filename);
+
+   dir = fdopendir(fd);
+   if (dir == NULL)
+   err(EX_NOINPUT, "%s", filename);
+   while ((de = readdir(dir)) != NULL) {
+   if (fnmatch("*.conf", de->d_name, 0) != 0)
+   continue;
+   fd = openat(fd, de->d_name, O_RDONLY);
+   if (fd < 0 || fstat(fd, &sb) != 0) {
+   warn("%s", de->d_name);
+   continue;
+   } else if (!S_ISREG(sb.st_mode))
+   continue;
+
+   warncount += parsefile(fd);
+   close(fd);
+   }
+   closedir(dir);
+
+   return (warncount);
+}
+
+static int
+parsefile(int fd)
 {
FILE *file;
char line[BUFSIZ], *p, *pq, *pdq;
int warncount = 0, lineno = 0;
 
-   file = fopen(filename, "r");
+   file = fdopen(fd, "r");
if (file == NULL)
-   err(EX_NOINPUT, "%s", filename);
+   err(EX_OSERR, "fdopen()");
while (fgets(line, sizeof(line), file) != NULL) {
lineno++;
p = line;
@@ -446,7 +491,6 @@ parsefile(const char *filename)
else
warncount += parse(p, lineno);
}
-   fclose(file);
 
return (warncount);
 }

Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Brooks Davis
On Wed, Dec 19, 2012 at 05:58:54PM -0500, Mark Johnston wrote:
> On Wed, Dec 19, 2012 at 02:02:09PM -0800, Xin Li wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA256
> > 
> > On 12/19/12 13:12, Garrett Cooper wrote:
> > > On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper
> > >  wrote:
> > > 
> > > ...
> > > 
> > >> find -exec / echo | xargs ? Seems like there's a better way to
> > >> solve this.
> > > 
> > > Of course we also might be overengineering the problem (my 
> > > suggestion definitely was overengineered). Why not pass in the 
> > > appropriate arguments via sysctl_args in /etc/rc.conf ? Thanks,
> > 
> > Irrelevant.  Consider this (extreme) situation: someone distributes
> > several sets of sysctl values tuned for certain situations, like
> > tcp.conf, supermicro.conf, ... and wants to put them together in a
> > directory, it's useful to source from the directory without having to
> > do a generation of command line on boot, so when something goes wrong,
> > they just remove the pack rather than changing /etc/rc.conf.
> 
> At work I've changed the -f flag of syslogd and newsyslog to accept a
> directory which gets non-recursively searched for input files. This way
> we can have a directory, say /etc/syslog.d, into which package install
> scripts can easily drop config files.
> 
> For something like sysctl this might be a bit much, but it's just a
> thought. The example diff below is what I have in mind.

I don't have a strong opinion about the usefulness of this feature.  It
seems useful particularly in conjunction with supporting multiple -f's.

I do have a few comments on the implementation below.

> -Mark
> 
> diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
> index 8fad089..c880b45 100644
> --- a/sbin/sysctl/sysctl.c
> +++ b/sbin/sysctl/sysctl.c
> @@ -42,6 +42,7 @@ static const char rcsid[] =
>  #endif /* not lint */
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -49,6 +50,7 @@ static const char rcsid[] =
>  #include 
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -64,6 +66,7 @@ static const char *conffile;
>  static int   aflag, bflag, dflag, eflag, hflag, iflag;
>  static int   Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag;
>  
> +static int   handlefile(const char *);
>  static int   oidfmt(int *, int, char *, u_int *);
>  static int   parsefile(const char *);
>  static int   parse(const char *, int);
> @@ -165,7 +168,7 @@ main(int argc, char **argv)
>  
>   warncount = 0;
>   if (conffile != NULL)
> - warncount += parsefile(conffile);
> + warncount += handlefile(conffile);
>  
>   while (argc-- > 0)
>   warncount += parse(*argv++, 0);
> @@ -402,6 +405,48 @@ parse(const char *string, int lineno)
>  }
>  
>  static int
> +handlefile(const char *filename)
> +{
> + DIR *dir;
> + struct dirent *de;
> + struct stat sb;
> + char path[MAXPATHLEN], *fname;
> + size_t off;
> + int warncount = 0;
> +
> + if (stat(filename, &sb))
> + err(EX_NOINPUT, "%s", filename);

I'd open the file and then use fstat here.  You will need to open it one
way or another and there's no point it checking it's type if you can't.

> + if (S_ISREG(sb.st_mode)) {
> + return (parsefile(filename));
> + } else if (!S_ISDIR(sb.st_mode))
> + errx(EX_USAGE, "invalid input file '%s'", filename);
> +
> + dir = opendir(filename);

With the above suggestion, this would become just use fdopendir() here.

> + if (dir == NULL)
> + err(EX_NOINPUT, "%s", filename);
> + off = strlcpy(path, filename, sizeof(path) - 1);
> + if (off >= sizeof(path) - 1)
> + errx(EX_NOINPUT, "input path '%s' too long", filename);
> +
> + fname = path + off;
> + *fname++ = '/';
> + off++;
> + while ((de = readdir(dir)) != NULL) {

Per other's suggestions I would probably only read .conf files.  A
simple fnmatch() will let you do that.

> + strlcpy(fname, de->d_name, sizeof(path) - off);

Rather than doing string manipulation, use openat() here to open the
files in the directory.

> + if (stat(path, &sb)) {
> + warn("%s", path);
> + continue;
> + } else if (!S_ISREG(sb.st_mode))
> + continue;
> +
> + warncount += parsefile(path);
> + }
> + closedir(dir);
> +
> + return (warncount);
> +}
> +
> +static int
>  parsefile(const char *filename)

Alter to take a file descriptor instead of a path.

-- Brooks

>  {
>   FILE *file;
> 


pgpZ2njp3FhrX.pgp
Description: PGP signature


svn commit: r244466 - in head/sys: kern sys

2012-12-19 Thread Olivier Houchard
Author: cognet
Date: Thu Dec 20 00:34:54 2012
New Revision: 244466
URL: http://svnweb.freebsd.org/changeset/base/244466

Log:
  Create an architecture-agnostic buffer pool manager that uses uma(9) to
  manage a set of power-of-2 sized buffers for bus_dmamem_alloc().
  
  This allows the caller to provide the back-end allocator uma allocator,
  allowing full control of the memory pages backing the pool.  For
  convenience, it provides an optional builtin allocator that provides pages
  allocated with the VM_MEMATTR_UNCACHEABLE attribute, for managing pools of
  DMA buffers for BUS_DMA_COHERENT or BUS_DMA_NOCACHE.
  
  This also allows the caller to specify a minimum alignment, and it ensures
  that all buffers start on a boundary and have a length that's a multiple of
  that value, to avoid using buffers that trigger partial cache line flushes.
  
  Submitted by: Ian Lepore 

Added:
  head/sys/kern/subr_busdma_bufalloc.c   (contents, props changed)
  head/sys/sys/busdma_bufalloc.h   (contents, props changed)

Added: head/sys/kern/subr_busdma_bufalloc.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/kern/subr_busdma_bufalloc.cThu Dec 20 00:34:54 2012
(r244466)
@@ -0,0 +1,174 @@
+/*-
+ * Copyright (c) 2012 Ian Lepore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+/*
+ * Buffer allocation support routines for bus_dmamem_alloc implementations.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * We manage buffer zones up to a page in size.  Buffers larger than a page can
+ * be managed by one of the kernel's page-oriented memory allocation routines 
as
+ * efficiently as what we can do here.  Also, a page is the largest size for
+ * which we can g'tee contiguity when using uma, and contiguity is one of the
+ * requirements we have to fulfill.
+ */
+#defineMIN_ZONE_BUFSIZE32
+#defineMAX_ZONE_BUFSIZEPAGE_SIZE
+
+/*
+ * The static array of 12 bufzones is big enough to handle all the zones for 
the
+ * smallest supported allocation size of 32 through the largest supported page
+ * size of 64K.  If you up the biggest page size number, up the array size too.
+ * Basically the size of the array needs to be log2(maxsize)-log2(minsize)+1,
+ * but I don't know of an easy way to express that as a compile-time constant.
+ */
+#if PAGE_SIZE > 65536
+#error Unsupported page size
+#endif
+
+struct busdma_bufalloc {
+   bus_size_t  min_size;
+   size_t  num_zones;
+   struct busdma_bufzone   buf_zones[12];
+};
+
+busdma_bufalloc_t 
+busdma_bufalloc_create(const char *name, bus_size_t minimum_alignment,
+uma_alloc alloc_func, uma_free free_func, u_int32_t zcreate_flags)
+{
+   struct busdma_bufalloc *ba;
+   struct busdma_bufzone *bz;
+   int i;
+   bus_size_t cursize;
+
+   ba = malloc(sizeof(struct busdma_bufalloc), M_DEVBUF, 
+   M_ZERO | M_WAITOK);
+
+   ba->min_size = MAX(MIN_ZONE_BUFSIZE, minimum_alignment);
+
+   /*
+* Each uma zone is created with an alignment of size-1, meaning that
+* the alignment is equal to the size (I.E., 64 byte buffers are aligned
+* to 64 byte boundaries, etc).  This allows for a fast efficient test
+* when deciding whether a pool buffer meets the constraints of a given
+* tag used for allocation: the buffer is usable if tag->alignment <=
+* bufzone->size.
+*/
+   for (i = 0, bz = ba->buf_zones, cursize = ba->min_size;
+ 

svn commit: r244469 - head/sys/arm/arm

2012-12-19 Thread Olivier Houchard
Author: cognet
Date: Thu Dec 20 00:35:26 2012
New Revision: 244469
URL: http://svnweb.freebsd.org/changeset/base/244469

Log:
  Use the new allocator in bus_dmamem_alloc().

Modified:
  head/sys/arm/arm/busdma_machdep-v6.c

Modified: head/sys/arm/arm/busdma_machdep-v6.c
==
--- head/sys/arm/arm/busdma_machdep-v6.cThu Dec 20 00:35:08 2012
(r244468)
+++ head/sys/arm/arm/busdma_machdep-v6.cThu Dec 20 00:35:26 2012
(r244469)
@@ -1,4 +1,5 @@
 /*-
+ * Copyright (c) 2012 Ian Lepore
  * Copyright (c) 2010 Mark Tinguely
  * Copyright (c) 2004 Olivier Houchard
  * Copyright (c) 2002 Peter Grehan
@@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -53,6 +55,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -83,7 +87,6 @@ struct bus_dma_tag {
int   map_count;
bus_dma_lock_t   *lockfunc;
void *lockfuncarg;
-   bus_dma_segment_t *segments;
struct bounce_zone *bounce_zone;
/*
 * DMA range for this tag.  If the page doesn't fall within
@@ -93,6 +96,14 @@ struct bus_dma_tag {
 */
struct arm32_dma_range  *ranges;
int _nranges;
+   /*
+* Most tags need one or two segments, and can use the local tagsegs
+* array.  For tags with a larger limit, we'll allocate a bigger array
+* on first use.
+*/
+   bus_dma_segment_t   *segments;
+   bus_dma_segment_t   tagsegs[2];
+
 
 };
 
@@ -150,6 +161,8 @@ struct bus_dmamap {
pmap_t pmap;
bus_dmamap_callback_t *callback;
void  *callback_arg;
+   int   flags;
+#define DMAMAP_COHERENT(1 << 0)
STAILQ_ENTRY(bus_dmamap) links;
STAILQ_HEAD(,sync_list) slist;
 };
@@ -169,6 +182,38 @@ int run_filter(bus_dma_tag_t dmat, bus_a
 static int _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map,
 void *buf, bus_size_t buflen, int flags);
 
+static busdma_bufalloc_t coherent_allocator;   /* Cache of coherent buffers */
+static busdma_bufalloc_t standard_allocator;   /* Cache of standard buffers */
+static void
+busdma_init(void *dummy)
+{
+
+   /* Create a cache of buffers in standard (cacheable) memory. */
+   standard_allocator = busdma_bufalloc_create("buffer", 
+   arm_dcache_align,   /* minimum_alignment */
+   NULL,   /* uma_alloc func */ 
+   NULL,   /* uma_free func */
+   0); /* uma_zcreate_flags */
+
+   /*
+* Create a cache of buffers in uncacheable memory, to implement the
+* BUS_DMA_COHERENT (and potentially BUS_DMA_NOCACHE) flag.
+*/
+   coherent_allocator = busdma_bufalloc_create("coherent",
+   arm_dcache_align,   /* minimum_alignment */
+   busdma_bufalloc_alloc_uncacheable, 
+   busdma_bufalloc_free_uncacheable, 
+   0); /* uma_zcreate_flags */
+}
+
+/*
+ * This init historically used SI_SUB_VM, but now the init code requires
+ * malloc(9) using M_DEVBUF memory, which is set up later than SI_SUB_VM, by
+ * SI_SUB_KMEM and SI_ORDER_SECOND, so we'll go right after that by using
+ * SI_SUB_KMEM and SI_ORDER_THIRD.
+ */
+SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_THIRD, busdma_init, NULL);
+
 static __inline int
 _bus_dma_can_bounce(vm_offset_t lowaddr, vm_offset_t highaddr)
 {
@@ -322,7 +367,18 @@ bus_dma_tag_create(bus_dma_tag_t parent,
newtag->lockfunc = dflt_lock;
newtag->lockfuncarg = NULL;
}
-   newtag->segments = NULL;
+   /*
+* If all the segments we need fit into the local tagsegs array, set the
+* pointer now.  Otherwise NULL the pointer and an array of segments
+* will be allocated later, on first use.  We don't pre-allocate now
+* because some tags exist just to pass contraints to children in the
+* device hierarchy, and they tend to use BUS_SPACE_UNRESTRICTED and we
+* sure don't want to try to allocate an array for that.
+*/
+   if (newtag->nsegments <= nitems(newtag->tagsegs))
+   newtag->segments = newtag->tagsegs;
+   else
+   newtag->segments = NULL;
 
/* Take into account any restrictions imposed by our parent tag */
if (parent != NULL) {
@@ -411,7 +467,8 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat)
parent = dmat->parent;
atomic_subtract_int(&dmat->ref_count, 1);
if (dmat->ref_count == 0) {
-   if (dmat->segments != NULL)
+   if (dmat->segments != NULL &&
+   dmat->segments != dmat->tagsegs)
  

svn commit: r244471 - head/sys/arm/arm

2012-12-19 Thread Olivier Houchard
Author: cognet
Date: Thu Dec 20 00:38:08 2012
New Revision: 244471
URL: http://svnweb.freebsd.org/changeset/base/244471

Log:
  Busdma enhancements, especially for managing small uncacheable buffers.
  
  - Use the new architecture-agnostic buffer pool manager that uses uma(9)
to manage a set of power-of-2 sized buffers for bus_dmamem_alloc().
  
  - Create pools of buffers backed by both regular and uncacheable memory,
and use them to handle regular versus BUS_DMA_COHERENT allocations.
  
  - Use uma(9) to manage a pool of bus_dmamap structs instead of local code
to manage a static list of 500 items (it took 3300 maps to get to
multi-user mode, so the static pool wasn't much of an optimization).
  
  - Small BUS_DMA_COHERENT allocations no longer waste an entire page per
allocation, or set pages to uncached when they contain data other than
DMA buffers.  There's no longer a need for drivers to work around the
inefficiency by allocing large buffers then sub-dividing them.
  
  - Because we know the alignment and padding of buffers allocated by
bus_dmamem_alloc() (whether coherent or regular memory, and whether
obtained from the pool allocator or directly from the kernel) we
can avoid doing partial cacheline flushes on them.
  
  - Add a fast-out to _bus_dma_could_bounce() (and some comments about
what the routine really does because the old misplaced comment was wrong).
  
  - Everywhere the dma tag alignment is used, the interpretation is that
an alignment of 1 means no special alignment.  If the tag is created
with an alignment argument of zero, store it in the tag as one, and
remove all the code scattered around that changed 0->1 at point of use.
  
  - Remove stack-allocated arrays of segments, use a local array of two
segments within the tag struct, or dynamically allocate an array at first
use if nsegments > 2.  On an arm system I tested, only 5 of 97 tags used
more than two segments.  On my x86 desktop it was only 7 of 111 tags.
  
  Submitted by: Ian Lepore 

Modified:
  head/sys/arm/arm/busdma_machdep.c

Modified: head/sys/arm/arm/busdma_machdep.c
==
--- head/sys/arm/arm/busdma_machdep.c   Thu Dec 20 00:37:11 2012
(r244470)
+++ head/sys/arm/arm/busdma_machdep.c   Thu Dec 20 00:38:08 2012
(r244471)
@@ -1,4 +1,5 @@
 /*-
+ * Copyright (c) 2012 Ian Lepore
  * Copyright (c) 2004 Olivier Houchard
  * Copyright (c) 2002 Peter Grehan
  * Copyright (c) 1997, 1998 Justin T. Gibbs.
@@ -32,7 +33,23 @@
 __FBSDID("$FreeBSD$");
 
 /*
- * ARM bus dma support routines
+ * ARM bus dma support routines.
+ *
+ * XXX Things to investigate / fix some day...
+ *  - What is the earliest that this API can be called?  Could there be any
+ *fallout from changing the SYSINIT() order from SI_SUB_VM to SI_SUB_KMEM?
+ *  - The manpage mentions the BUS_DMA_NOWAIT flag only in the context of the
+ *bus_dmamap_load() function.  This code has historically (and still does)
+ *honor it in bus_dmamem_alloc().  If we got rid of that we could lose some
+ *error checking because some resource management calls would become WAITOK
+ *and thus "cannot fail."
+ *  - The decisions made by _bus_dma_can_bounce() should be made once, at tag
+ *creation time, and the result stored in the tag.
+ *  - It should be possible to take some shortcuts when mapping a buffer we 
know
+ *came from the uma(9) allocators based on what we know about such buffers
+ *(aligned, contiguous, etc).
+ *  - The allocation of bounce pages could probably be cleaned up, then we 
could
+ *retire arm_remap_nocache().
  */
 
 #define _ARM32_BUS_DMA_PRIVATE
@@ -40,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -50,7 +68,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -81,7 +102,6 @@ struct bus_dma_tag {
int map_count;
bus_dma_lock_t  *lockfunc;
void*lockfuncarg;
-   bus_dma_segment_t   *segments;
/*
 * DMA range for this tag.  If the page doesn't fall within
 * one of these ranges, an error is returned.  The caller
@@ -91,6 +111,13 @@ struct bus_dma_tag {
struct arm32_dma_range  *ranges;
int _nranges;
struct bounce_zone *bounce_zone;
+   /*
+* Most tags need one or two segments, and can use the local tagsegs
+* array.  For tags with a larger limit, we'll allocate a bigger array
+* on first use.
+*/
+   bus_dma_segment_t   *segments;
+   bus_dma_segment_t   tagsegs[2];
 };
 
 struct bounce_page {
@@ -134,7 +161,7 @@ SYSCTL_INT(_hw_busdma, OID_AUTO, total_b
 #define DMAMAP_LINEAR  0x1
 #define DMAMAP_MBUF0x2
 #define DMAMAP_UIO 

svn commit: r244473 - head/sys/arm/arm

2012-12-19 Thread Olivier Houchard
Author: cognet
Date: Thu Dec 20 00:50:04 2012
New Revision: 244473
URL: http://svnweb.freebsd.org/changeset/base/244473

Log:
  Use C comments instead of C++ comments.
  
  Spotted out by:   gonzo (thanks, man)

Modified:
  head/sys/arm/arm/busdma_machdep.c

Modified: head/sys/arm/arm/busdma_machdep.c
==
--- head/sys/arm/arm/busdma_machdep.c   Thu Dec 20 00:40:59 2012
(r244472)
+++ head/sys/arm/arm/busdma_machdep.c   Thu Dec 20 00:50:04 2012
(r244473)
@@ -197,8 +197,10 @@ static void free_bounce_page(bus_dma_tag
 /* Default tag, as most drivers provide no parent tag. */
 bus_dma_tag_t arm_root_dma_tag;
 
-//
-// Begin block of code useful to transplant to other implementations.
+/*
+ * 
+ * Begin block of code useful to transplant to other implementations.
+ */
 
 static uma_zone_t dmamap_zone; /* Cache of struct bus_dmamap items */
 
@@ -275,8 +277,10 @@ busdma_init(void *dummy)
  */
 SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_THIRD, busdma_init, NULL);
 
-// End block of code useful to transplant to other implementations.
-//
+/*
+ * End block of code useful to transplant to other implementations.
+ * 
+ */
 
 /*
  * Return true if a match is made.
___
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: r244474 - head/sys/conf

2012-12-19 Thread Olivier Houchard
Author: cognet
Date: Thu Dec 20 00:57:24 2012
New Revision: 244474
URL: http://svnweb.freebsd.org/changeset/base/244474

Log:
  We want to build subr_busdma_bufalloc.c on arm.

Modified:
  head/sys/conf/files.arm

Modified: head/sys/conf/files.arm
==
--- head/sys/conf/files.arm Thu Dec 20 00:50:04 2012(r244473)
+++ head/sys/conf/files.arm Thu Dec 20 00:57:24 2012(r244474)
@@ -70,6 +70,7 @@ font.hoptionalsc  
\
compile-with"uudecode < 
/usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char 
dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < 
/usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char 
dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < 
/usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char 
dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \
no-obj no-implicit-rule before-depend   \
clean   "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 
${SC_DFLT_FONT}-8x8"
+kern/subr_busdma_bufalloc.cstandard
 kern/subr_dummy_vdso_tc.c  standard
 libkern/arm/divsi3.S   standard
 libkern/arm/ffs.S  standard
___
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: r244475 - head/sys/fs/ext2fs

2012-12-19 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Dec 20 02:22:36 2012
New Revision: 244475
URL: http://svnweb.freebsd.org/changeset/base/244475

Log:
  More constant renaming in preparation for newer features.
  
  We also try to make better use of the fs flags instead of
  trying adapt the code according to the fs structures. In
  the case of subsecond timestamps and birthtime we now
  check that the feature is explicitly enabled: previously
  we only checked that the reserved space was available and
  silently wrote them.
  
  This approach is much safer, especially if the filesystem
  happens to use embedded inodes or support EAs.
  
  Discussed with:   Zheng Liu
  MFC after:5 days

Modified:
  head/sys/fs/ext2fs/ext2_dinode.h
  head/sys/fs/ext2fs/ext2_inode_cnv.c
  head/sys/fs/ext2fs/ext2_vfsops.c
  head/sys/fs/ext2fs/ext2fs.h

Modified: head/sys/fs/ext2fs/ext2_dinode.h
==
--- head/sys/fs/ext2fs/ext2_dinode.hThu Dec 20 00:57:24 2012
(r244474)
+++ head/sys/fs/ext2fs/ext2_dinode.hThu Dec 20 02:22:36 2012
(r244475)
@@ -60,15 +60,16 @@
 #define EXT2_APPEND0x0020 /* writes to file may only append */
 #define EXT2_NODUMP0x0040  /* do not dump file */
 #define EXT2_NOATIME   0x0080  /* do not update atime */
-#define EXT2_INDEX 0x1000  /* hash-indexed directory */
-#define EXT2_IMAGIC0x2000  /* AFS directory */
-#define EXT2_JOURNAL_DATA  0x4000 /* file data should be 
journaled */
-#define EXT2_NOTAIL0x8000 /* file tail should not be merged */
-#define EXT2_DIRSYNC   0x0001  /* dirsync behaviour */
-#define EXT2_TOPDIR0x0002 /* Top of directory hierarchies*/
-#define EXT2_HUGE_FILE 0x0004  /* Set to each huge file */
-#define EXT2_EXTENTS   0x0008  /* Inode uses extents */
-#define EXT2_EOFBLOCKS 0x0040 /* Blocks allocated beyond EOF */
+
+#define EXT4_INDEX 0x1000  /* hash-indexed directory */
+#define EXT4_IMAGIC0x2000  /* AFS directory */
+#define EXT4_JOURNAL_DATA  0x4000 /* file data should be journaled */
+#define EXT4_NOTAIL0x8000 /* file tail should not be merged */
+#define EXT4_DIRSYNC   0x0001  /* dirsync behaviour */
+#define EXT4_TOPDIR0x0002 /* Top of directory hierarchies*/
+#define EXT4_HUGE_FILE 0x0004  /* Set to each huge file */
+#define EXT4_EXTENTS   0x0008  /* Inode uses extents */
+#define EXT4_EOFBLOCKS 0x0040 /* Blocks allocated beyond EOF */
 
 /*
  * Definitions for nanosecond timestamps.
@@ -78,8 +79,7 @@
 #define EXT3_EPOCH_MASK((1 << EXT3_EPOCH_BITS) - 1)
 #define EXT3_NSEC_MASK (~0UL << EXT3_EPOCH_BITS)
 
-#define E2DI_HAS_XTIME(ip) (EXT2_INODE_SIZE((ip)->i_e2fs) > \
-   E2FS_REV0_INODE_SIZE)
+#define E2DI_HAS_XTIME(ip) (EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, 
EXT2F_ROCOMPAT_EXTRA_ISIZE))
 
 /*
  * Structure of an inode on the disk

Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c
==
--- head/sys/fs/ext2fs/ext2_inode_cnv.c Thu Dec 20 00:57:24 2012
(r244474)
+++ head/sys/fs/ext2fs/ext2_inode_cnv.c Thu Dec 20 02:22:36 2012
(r244475)
@@ -27,17 +27,18 @@
  */
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 #define XTIME_TO_NSEC(x)   ((x & EXT3_NSEC_MASK) >> 2)
-#define NSEC_TO_XTIME(t)   ((t << 2) & EXT3_NSEC_MASK)
+#define NSEC_TO_XTIME(t)   (le32toh(t << 2) & EXT3_NSEC_MASK)
 
 void
 ext2_print_inode( in )

Modified: head/sys/fs/ext2fs/ext2_vfsops.c
==
--- head/sys/fs/ext2fs/ext2_vfsops.cThu Dec 20 00:57:24 2012
(r244474)
+++ head/sys/fs/ext2fs/ext2_vfsops.cThu Dec 20 02:22:36 2012
(r244475)
@@ -349,7 +349,7 @@ compute_sb_data(struct vnode *devvp, str
}
}
/* Check for extra isize in big inodes. */
-   if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT4F_ROCOMPAT_EXTRA_ISIZE) &&
+   if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_EXTRA_ISIZE) &&
EXT2_INODE_SIZE(fs) < sizeof(struct ext2fs_dinode)) {
printf("ext2fs: no space for extra inode timestamps\n");
return (EINVAL);

Modified: head/sys/fs/ext2fs/ext2fs.h
==
--- head/sys/fs/ext2fs/ext2fs.h Thu Dec 20 00:57:24 2012(r244474)
+++ head/sys/fs/ext2fs/ext2fs.h Thu Dec 20 02:22:36 2012(r244475)
@@ -215,18 +215,18 @@ struct m_ext2fs {
 #define EXT2F_ROCOMPAT_SPARSESUPER 0x0001
 #define EXT2F_ROCOMPAT_LARGEFILE   0x0002
 #define EX

svn commit: r244476 - head/sys/arm/include

2012-12-19 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Dec 20 03:33:33 2012
New Revision: 244476
URL: http://svnweb.freebsd.org/changeset/base/244476

Log:
  Fix misleading comment

Modified:
  head/sys/arm/include/pmap.h

Modified: head/sys/arm/include/pmap.h
==
--- head/sys/arm/include/pmap.h Thu Dec 20 02:22:36 2012(r244475)
+++ head/sys/arm/include/pmap.h Thu Dec 20 03:33:33 2012(r244476)
@@ -551,7 +551,7 @@ voidpmap_pte_init_arm10(void);
 #endif /* CPU_ARM10 */
 #if (ARM_MMU_V6 + ARM_MMU_V7) != 0
 void   pmap_pte_init_mmu_v6(void);
-#endif /* CPU_ARM11 */
+#endif /* (ARM_MMU_V6 + ARM_MMU_V7) != 0 */
 #endif /* (ARM_MMU_GENERIC + ARM_MMU_SA1) != 0 */
 
 #if /* ARM_MMU_SA1 == */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"


Re: svn commit: r244198 - in head: etc/rc.d sbin/sysctl

2012-12-19 Thread Brooks Davis
On Wed, Dec 19, 2012 at 06:59:17PM -0500, Mark Johnston wrote:
> On Wed, Dec 19, 2012 at 05:21:40PM -0600, Brooks Davis wrote:
> > On Wed, Dec 19, 2012 at 05:58:54PM -0500, Mark Johnston wrote:
> > > On Wed, Dec 19, 2012 at 02:02:09PM -0800, Xin Li wrote:
> > > > -BEGIN PGP SIGNED MESSAGE-
> > > > Hash: SHA256
> > > > 
> > > > On 12/19/12 13:12, Garrett Cooper wrote:
> > > > > On Wed, Dec 19, 2012 at 1:10 PM, Garrett Cooper
> > > > >  wrote:
> > > > > 
> > > > > ...
> > > > > 
> > > > >> find -exec / echo | xargs ? Seems like there's a better way to
> > > > >> solve this.
> > > > > 
> > > > > Of course we also might be overengineering the problem (my 
> > > > > suggestion definitely was overengineered). Why not pass in the 
> > > > > appropriate arguments via sysctl_args in /etc/rc.conf ? Thanks,
> > > > 
> > > > Irrelevant.  Consider this (extreme) situation: someone distributes
> > > > several sets of sysctl values tuned for certain situations, like
> > > > tcp.conf, supermicro.conf, ... and wants to put them together in a
> > > > directory, it's useful to source from the directory without having to
> > > > do a generation of command line on boot, so when something goes wrong,
> > > > they just remove the pack rather than changing /etc/rc.conf.
> > > 
> > > At work I've changed the -f flag of syslogd and newsyslog to accept a
> > > directory which gets non-recursively searched for input files. This way
> > > we can have a directory, say /etc/syslog.d, into which package install
> > > scripts can easily drop config files.
> > > 
> > > For something like sysctl this might be a bit much, but it's just a
> > > thought. The example diff below is what I have in mind.
> > 
> > I don't have a strong opinion about the usefulness of this feature.  It
> > seems useful particularly in conjunction with supporting multiple -f's.
> 
> I don't really either. Just thought I'd suggest it.
> 
> > 
> > I do have a few comments on the implementation below.
> > 
> 
> Thanks! I didn't know about openat(). Here's the regenerated diff.
> 
> diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
> index 8fad089..9e453f6 100644
> --- a/sbin/sysctl/sysctl.c
> +++ b/sbin/sysctl/sysctl.c
> @@ -42,6 +42,7 @@ static const char rcsid[] =
>  #endif /* not lint */
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -49,8 +50,11 @@ static const char rcsid[] =
>  #include 
>  
>  #include 
> +#include 
>  #include 
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -64,8 +68,9 @@ static const char *conffile;
>  static int   aflag, bflag, dflag, eflag, hflag, iflag;
>  static int   Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag;
>  
> +static int   handlefile(const char *);
>  static int   oidfmt(int *, int, char *, u_int *);
> -static int   parsefile(const char *);
> +static int   parsefile(int);
>  static int   parse(const char *, int);
>  static int   show_var(int *, int);
>  static int   sysctl_all(int *oid, int len);
> @@ -165,7 +170,7 @@ main(int argc, char **argv)
>  
>   warncount = 0;
>   if (conffile != NULL)
> - warncount += parsefile(conffile);
> + warncount += handlefile(conffile);
>  
>   while (argc-- > 0)
>   warncount += parse(*argv++, 0);
> @@ -402,15 +407,55 @@ parse(const char *string, int lineno)
>  }
>  
>  static int
> -parsefile(const char *filename)
> +handlefile(const char *filename)
> +{
> + DIR *dir;
> + struct dirent *de;
> + struct stat sb;
> + int fd, warncount = 0;
> +
> + fd = open(filename, O_RDONLY);
> + if (fd < 0)
> + err(EX_NOINPUT, "%s", filename);
> + if (fstat(fd, &sb))
> + err(EX_NOINPUT, "%s", filename);
> +
> + if (S_ISREG(sb.st_mode)) {
> + return (parsefile(fd));

This leaks the fd.  I might just keep the close() in parsefile() so that
in consumes the fd.

-- Brooks

> + } else if (!S_ISDIR(sb.st_mode))
> + errx(EX_USAGE, "invalid input file '%s'", filename);
> +
> + dir = fdopendir(fd);
> + if (dir == NULL)
> + err(EX_NOINPUT, "%s", filename);
> + while ((de = readdir(dir)) != NULL) {
> + if (fnmatch("*.conf", de->d_name, 0) != 0)
> + continue;
> + fd = openat(fd, de->d_name, O_RDONLY);
> + if (fd < 0 || fstat(fd, &sb) != 0) {
> + warn("%s", de->d_name);
> + continue;
> + } else if (!S_ISREG(sb.st_mode))
> + continue;
> +
> + warncount += parsefile(fd);
> + close(fd);
> + }
> + closedir(dir);
> +
> + return (warncount);
> +}
> +
> +static int
> +parsefile(int fd)
>  {
>   FILE *file;
>   char line[BUFSIZ], *p, *pq, *pdq;
>   int warncount = 0, lineno = 0;
>  
> - file = fopen(filename, "r");
> + file = fdopen(fd, "r");
>   if (file == NULL)
> - err(EX_NOINPUT, "%s", filename);
> +  

svn commit: r244480 - in head/sys: arm/arm arm/broadcom/bcm2835 arm/conf arm/include arm/versatile conf

2012-12-19 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Dec 20 04:32:02 2012
New Revision: 244480
URL: http://svnweb.freebsd.org/changeset/base/244480

Log:
  Replace generic ARM11 option with more specific
  support for ARM1136 and ARM1176
  
  Submitted by: Daisuke Aoyama 
  Obtained from:NetBSD

Added:
  head/sys/arm/arm/cpufunc_asm_arm11x6.S   (contents, props changed)
Modified:
  head/sys/arm/arm/cpufunc.c
  head/sys/arm/arm/elf_trampoline.c
  head/sys/arm/arm/identcpu.c
  head/sys/arm/arm/locore.S
  head/sys/arm/broadcom/bcm2835/files.bcm2835
  head/sys/arm/conf/RPI-B
  head/sys/arm/conf/VERSATILEPB
  head/sys/arm/include/armreg.h
  head/sys/arm/include/cpuconf.h
  head/sys/arm/include/cpufunc.h
  head/sys/arm/include/intr.h
  head/sys/arm/versatile/files.versatile
  head/sys/conf/files.arm
  head/sys/conf/options.arm

Modified: head/sys/arm/arm/cpufunc.c
==
--- head/sys/arm/arm/cpufunc.c  Thu Dec 20 04:16:25 2012(r244479)
+++ head/sys/arm/arm/cpufunc.c  Thu Dec 20 04:32:02 2012(r244480)
@@ -974,18 +974,18 @@ struct cpu_functions fa526_cpufuncs = {
 };
 #endif /* CPU_FA526 || CPU_FA626TE */
 
-#if defined(CPU_ARM11)
-struct cpu_functions arm11_cpufuncs = {
+#if defined(CPU_ARM1136)
+struct cpu_functions arm1136_cpufuncs = {
/* CPU functions */

cpufunc_id, /* id   */
-   arm11_drain_writebuf,   /* cpwait   */
+   cpufunc_nullop, /* cpwait   */

/* MMU functions */

cpufunc_control,/* control  */
cpufunc_domains,/* Domain   */
-   arm11_setttb,   /* Setttb   */
+   arm11x6_setttb, /* Setttb   */
cpufunc_faultstatus,/* Faultstatus  */
cpufunc_faultaddress,   /* Faultaddress */

@@ -1000,30 +1000,91 @@ struct cpu_functions arm11_cpufuncs = {

/* Cache operations */

-   armv6_icache_sync_all,  /* icache_sync_all  */
-   armv6_icache_sync_range,/* icache_sync_range*/
+   arm11x6_icache_sync_all,/* icache_sync_all  */
+   arm11x6_icache_sync_range,  /* icache_sync_range*/

-   armv6_dcache_wbinv_all, /* dcache_wbinv_all */
+   arm11x6_dcache_wbinv_all,   /* dcache_wbinv_all */
armv6_dcache_wbinv_range,   /* dcache_wbinv_range   */
armv6_dcache_inv_range, /* dcache_inv_range */
armv6_dcache_wb_range,  /* dcache_wb_range  */

-   armv6_idcache_wbinv_all,/* idcache_wbinv_all*/
-   armv6_idcache_wbinv_range,  /* idcache_wbinv_range  */
+   arm11x6_idcache_wbinv_all,  /* idcache_wbinv_all*/
+   arm11x6_idcache_wbinv_range,/* idcache_wbinv_range  */

-   (void*)cpufunc_nullop,  /* l2cache_wbinv_all*/
+   (void *)cpufunc_nullop, /* l2cache_wbinv_all*/
(void *)cpufunc_nullop, /* l2cache_wbinv_range  */
(void *)cpufunc_nullop, /* l2cache_inv_range*/
(void *)cpufunc_nullop, /* l2cache_wb_range */

/* Other functions */

-   cpufunc_nullop, /* flush_prefetchbuf*/
+   arm11x6_flush_prefetchbuf,  /* flush_prefetchbuf*/
arm11_drain_writebuf,   /* drain_writebuf   */
cpufunc_nullop, /* flush_brnchtgt_C */
(void *)cpufunc_nullop, /* flush_brnchtgt_E */

-   arm11_sleep,/* sleep*/
+   arm11_sleep,/* sleep*/
+   
+   /* Soft functions */
+   
+   cpufunc_null_fixup, /* dataabt_fixup*/
+   cpufunc_null_fixup, /* prefetchabt_fixup*/
+   
+   arm11_context_switch,   /* context_switch   */
+   
+   arm11x6_setup   /* cpu setup*/
+};
+#endif /* CPU_ARM1136 */
+#if defined(CPU_ARM1176)
+struct cpu_functions arm1176_cpufuncs = {
+   /* CPU functions */
+   
+   cpufunc_id, /* id   */
+   cpufunc_nullop, /* cpwait   */
+   
+   /* MMU functions */
+   
+   cpufunc_control,/* control  */
+   cpufunc_domains,/* Domain   */
+   arm11x6_setttb, /* Setttb   */
+   cpufunc_faultstatus,/* Faultstatus  */
+   cpufunc_faultaddress,   /* Faultaddress */
+   
+   /* TLB functions */
+   
+   arm11_tlb_flushID,  /* tlb_flushID  */
+   arm11_tlb

svn commit: r244481 - head/sys/dev/mii

2012-12-19 Thread Pyun YongHyeon
Author: yongari
Date: Thu Dec 20 04:47:31 2012
New Revision: 244481
URL: http://svnweb.freebsd.org/changeset/base/244481

Log:
  For fiber PHYs, BRGPHY_MII_1000CTL register is not defined at all
  so do not touch it.

Modified:
  head/sys/dev/mii/brgphy.c

Modified: head/sys/dev/mii/brgphy.c
==
--- head/sys/dev/mii/brgphy.c   Thu Dec 20 04:32:02 2012(r244480)
+++ head/sys/dev/mii/brgphy.c   Thu Dec 20 04:47:31 2012(r244481)
@@ -608,6 +608,11 @@ brgphy_mii_phy_auto(struct mii_softc *sc
(sc->mii_flags & MIIF_FORCEPAUSE) != 0)
anar |= BRGPHY_ANAR_PC | BRGPHY_ANAR_ASP;
PHY_WRITE(sc, BRGPHY_MII_ANAR, anar);
+   ktcr = BRGPHY_1000CTL_AFD | BRGPHY_1000CTL_AHD;
+   if (sc->mii_mpd_model == MII_MODEL_BROADCOM_BCM5701)
+   ktcr |= BRGPHY_1000CTL_MSE | BRGPHY_1000CTL_MSC;
+   PHY_WRITE(sc, BRGPHY_MII_1000CTL, ktcr);
+   PHY_READ(sc, BRGPHY_MII_1000CTL);
} else {
anar = BRGPHY_SERDES_ANAR_FDX | BRGPHY_SERDES_ANAR_HDX;
if ((media & IFM_FLOW) != 0 ||
@@ -616,12 +621,6 @@ brgphy_mii_phy_auto(struct mii_softc *sc
PHY_WRITE(sc, BRGPHY_SERDES_ANAR, anar);
}
 
-   ktcr = BRGPHY_1000CTL_AFD | BRGPHY_1000CTL_AHD;
-   if (sc->mii_mpd_model == MII_MODEL_BROADCOM_BCM5701)
-   ktcr |= BRGPHY_1000CTL_MSE | BRGPHY_1000CTL_MSC;
-   PHY_WRITE(sc, BRGPHY_MII_1000CTL, ktcr);
-   ktcr = PHY_READ(sc, BRGPHY_MII_1000CTL);
-
PHY_WRITE(sc, BRGPHY_MII_BMCR, BRGPHY_BMCR_AUTOEN |
BRGPHY_BMCR_STARTNEG);
PHY_WRITE(sc, BRGPHY_MII_IMR, 0xFF00);
___
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: r244482 - head/sys/dev/mii

2012-12-19 Thread Pyun YongHyeon
Author: yongari
Date: Thu Dec 20 05:02:12 2012
New Revision: 244482
URL: http://svnweb.freebsd.org/changeset/base/244482

Log:
  Recognize 5720S PHY and treat it as 5708S PHY.
  Unfortunately 5720S uses 5709S PHY id so add a hack to detect 5720S
  PHY by checking parent device name.  5720S PHY does not support 2500SX.
  
  Tested by:Geans Pin < geanspin <> broadcom dot com >

Modified:
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/miidevs

Modified: head/sys/dev/mii/brgphy.c
==
--- head/sys/dev/mii/brgphy.c   Thu Dec 20 04:47:31 2012(r244481)
+++ head/sys/dev/mii/brgphy.c   Thu Dec 20 05:02:12 2012(r244482)
@@ -204,6 +204,13 @@ brgphy_attach(device_t dev)
&brgphy_funcs, 0);
 
bsc->serdes_flags = 0;
+   ifp = sc->mii_pdata->mii_ifp;
+
+   /* Find the MAC driver associated with this PHY. */
+   if (strcmp(ifp->if_dname, "bge") == 0)
+   bge_sc = ifp->if_softc;
+   else if (strcmp(ifp->if_dname, "bce") == 0)
+   bce_sc = ifp->if_softc;
 
/* Handle any special cases based on the PHY ID */
switch (sc->mii_mpd_oui) {
@@ -235,22 +242,21 @@ brgphy_attach(device_t dev)
sc->mii_flags |= MIIF_HAVEFIBER;
break;
case MII_MODEL_BROADCOM2_BCM5709S:
-   bsc->serdes_flags |= BRGPHY_5709S;
+   /*
+* XXX
+* 5720S and 5709S shares the same PHY id.
+* Assume 5720S PHY if parent device is bge(4).
+*/
+   if (bge_sc != NULL)
+   bsc->serdes_flags |= BRGPHY_5708S;
+   else
+   bsc->serdes_flags |= BRGPHY_5709S;
sc->mii_flags |= MIIF_HAVEFIBER;
break;
}
break;
}
 
-   ifp = sc->mii_pdata->mii_ifp;
-
-   /* Find the MAC driver associated with this PHY. */
-   if (strcmp(ifp->if_dname, "bge") == 0)  {
-   bge_sc = ifp->if_softc;
-   } else if (strcmp(ifp->if_dname, "bce") == 0) {
-   bce_sc = ifp->if_softc;
-   }
-
PHY_RESET(sc);
 
/* Read the PHY's capabilities. */

Modified: head/sys/dev/mii/miidevs
==
--- head/sys/dev/mii/miidevsThu Dec 20 04:47:31 2012(r244481)
+++ head/sys/dev/mii/miidevsThu Dec 20 05:02:12 2012(r244482)
@@ -180,7 +180,7 @@ model BROADCOM2 BCM5722 0x002d BCM5722 
 model BROADCOM2 BCM57840x003a BCM5784 10/100/1000baseT PHY
 model BROADCOM2 BCM5709C   0x003c BCM5709 10/100/1000baseT PHY
 model BROADCOM2 BCM57610x003d BCM5761 10/100/1000baseT PHY
-model BROADCOM2 BCM5709S   0x003f BCM5709S 1000/2500baseSX PHY
+model BROADCOM2 BCM5709S   0x003f BCM5709S/5720S 1000/2500baseSX PHY
 model BROADCOM3 BCM57780   0x0019 BCM57780 1000BASE-T media interface
 model BROADCOM3 BCM5717C   0x0020 BCM5717C 1000BASE-T media interface
 model BROADCOM3 BCM5719C   0x0022 BCM5719C 1000BASE-T media interface
___
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"