Re: svn commit: r240067 - head/sys/kern
On Mon, 3 Sep 2012 12:29:05 -0700 Garrett Cooper wrote: >> On Mon, Sep 3, 2012 at 2:23 AM, Aleksandr Rybalko >> wrote: >> > On Mon, 3 Sep 2012 02:05:15 -0700 >> > Garrett Cooper wrote: >> > >> >>> On Sep 3, 2012, at 1:52 AM, Aleksandr Rybalko wrote: >> >>> >> >>> > Author: ray >> >>> > Date: Mon Sep 3 08:52:05 2012 >> >>> > New Revision: 240067 >> >>> > URL: http://svn.freebsd.org/changeset/base/240067 >> >>> > >> >>> > Log: >> >>> > Add kern.hintmode sysctl variable to show current state of >> >>> > hints: 0 - loader hints in environment only; >> >>> > 1 - static hints only >> >>> > 2 - fallback mode (Dynamic KENV with fallback to kernel >> >>> > environment) Add kern.hintmode write handler, accept only >> >>> > value 2. That will switch static KENV to dynamic. So it will >> >>> > be possible to change device hints. >> >>> >> >>> ... >> >>> >> >>> > + /* Migrate from static to dynamic hints */ >> >>> > + switch (hintmode) { >> >>> > + case 0: >> >>> > + if (dynamic_kenv) >> >>> > + /* Already here */ >> >>> > + hintmode = value; /* XXX: Need we switch >> >>> > or not ? */ >> >>> > + return (0); >> >>> >> >>> typo (missing braces)? >> > >> > Ohhh, yeah, testing now. >> > Thank you! >> > >> >>> >> >>> Also, don't you need extra glue for jails? >> > >> > Why, jails uses separate hints/kenv? >> >> I was wondering whether or not the tunables could be changed from the >> jail, thus allowing someone to affect the host system or if this >> memory space was effectively CoWed in some way, shape or form. Think after switch hints will be controlled by the same policy as before. Normal hints 0-16KB, so it will not be big memory waste. Handler allow to do it only one time: user set it to 2, handler copy env. Next time any just check, if 2, do nothing. You think better to add CTLFLAG_PRISON flag, to hide it from jails? >> >> Thanks! >> -Garrett Thank you Garrett! WBW -- Aleksandr Rybalko ___ 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: r240067 - head/sys/kern
On Mon, 3 Sep 2012 20:02:08 +0300 Konstantin Belousov wrote: >> On Mon, Sep 03, 2012 at 09:09:08AM -0700, m...@freebsd.org wrote: >> > On Mon, Sep 3, 2012 at 1:52 AM, Aleksandr Rybalko >> > wrote: >> > > Author: ray >> > > Date: Mon Sep 3 08:52:05 2012 >> > > New Revision: 240067 >> > > URL: http://svn.freebsd.org/changeset/base/240067 >> > > >> > > Log: >> > > Add kern.hintmode sysctl variable to show current state of >> > > hints: 0 - loader hints in environment only; >> > > 1 - static hints only >> > > 2 - fallback mode (Dynamic KENV with fallback to kernel >> > > environment) Add kern.hintmode write handler, accept only value >> > > 2. That will switch static KENV to dynamic. So it will be >> > > possible to change device hints. >> > > >> > > Approved by: adrian (mentor) >> > > >> > > Modified: >> > > head/sys/kern/subr_hints.c >> > > >> > > Modified: head/sys/kern/subr_hints.c >> > > == >> > > --- head/sys/kern/subr_hints.c Mon Sep 3 07:18:24 2012 >> > > (r240066) +++ head/sys/kern/subr_hints.c Mon Sep 3 08:52:05 >> > > 2012(r240067) @@ -29,8 +29,10 @@ __FBSDID("$FreeBSD$"); >> > > >> > > #include >> > > #include >> > > +#include >> > > #include >> > > #include >> > > +#include >> > >> > Putting on my style-nazi hat. sysctl comes before systm >> > alphabetically. >> Systm.h is very special, it normally comes as the second item in the >> include list, right after param.h. Just recheck, in that case there is indeed no requirement to swap sysctl.h and systm.h. Thanks Kostik! Will fix my style(9)ability :) WBW -- Alexandr Rybalko aka Alex RAY ___ 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: r240067 - head/sys/kern
On Mon, 3 Sep 2012 09:09:08 -0700 m...@freebsd.org wrote: >> On Mon, Sep 3, 2012 at 1:52 AM, Aleksandr Rybalko >> wrote: >> > Author: ray >> > Date: Mon Sep 3 08:52:05 2012 >> > New Revision: 240067 >> > URL: http://svn.freebsd.org/changeset/base/240067 >> > >> > Log: >> > Add kern.hintmode sysctl variable to show current state of hints: >> > 0 - loader hints in environment only; >> > 1 - static hints only >> > 2 - fallback mode (Dynamic KENV with fallback to kernel >> > environment) Add kern.hintmode write handler, accept only value 2. >> > That will switch static KENV to dynamic. So it will be possible to >> > change device hints. >> > >> > Approved by: adrian (mentor) >> > >> > Modified: >> > head/sys/kern/subr_hints.c >> > >> > Modified: head/sys/kern/subr_hints.c >> > == >> > --- head/sys/kern/subr_hints.c Mon Sep 3 07:18:24 2012 >> > (r240066) +++ head/sys/kern/subr_hints.c Mon Sep 3 08:52:05 >> > 2012(r240067) @@ -29,8 +29,10 @@ __FBSDID("$FreeBSD$"); >> > >> > #include >> > #include >> > +#include >> > #include >> > #include >> > +#include >> >> Putting on my style-nazi hat. sysctl comes before systm >> alphabetically. >> >> > #include >> > >> > /* >> > @@ -42,6 +44,81 @@ static int use_kenv; >> > static char *hintp; >> > >> > /* >> > + * Define kern.hintmode sysctl, which only accept value 2, that >> > cause to >> > + * switch from Static KENV mode to Dynamic KENV. So systems that >> > have hints >> > + * compiled into kernel will be able to see/modify KENV (and >> > hints too). >> > + */ >> > + >> > +static int >> > +sysctl_hintmode(SYSCTL_HANDLER_ARGS) >> > +{ >> > + int error, i, from_kenv, value, eqidx; >> > + const char *cp; >> > + char *line, *eq; >> >> These are not sorted properly; pointers come before scalars, and >> within the group they should be sorted alphabetically; e.g. "eqidx" >> comes before all the other ints. >> >> > + >> > + from_kenv = 0; >> > + cp = kern_envp; >> > + value = hintmode; >> > + >> > + /* Fetch candidate for new hintmode value */ >> > + error = sysctl_handle_int(oidp, &value, 0, req); >> > + if (error || !req->newptr) >> >> This may be copying existing code, but style(9) explicitly forbids >> using '!' except on boolean expressions. Since req->newptr is a >> pointer, an explicit comparison to NULL should be made. This error >> is repeated later. >> >> Thanks, >> matthew >> >> > + return (error); >> > + >> > + if (value != 2) >> > + /* Only accept swithing to hintmode 2 */ >> > + return (EINVAL); >> > + >> > + /* Migrate from static to dynamic hints */ >> > + switch (hintmode) { >> > + case 0: >> > + if (dynamic_kenv) >> > + /* Already here */ >> > + hintmode = value; /* XXX: Need we switch >> > or not ? */ >> > + return (0); >> > + from_kenv = 1; >> > + cp = kern_envp; >> > + break; >> > + case 1: >> > + cp = static_hints; >> > + break; >> > + case 2: >> > + /* Nothing to do, hintmode already 2 */ >> > + return (0); >> > + } >> > + >> > + while (cp) { >> > + i = strlen(cp); >> > + if (i == 0) >> > + break; >> > + if (from_kenv) { >> > + if (strncmp(cp, "hint.", 5) != 0) >> > + /* kenv can have not only hints */ >> > + continue; >> > + } >> > + eq = strchr(cp, '='); >> > + if (!eq) >> > + /* Bad hint value */ >> > + continue; >> > + eqidx = eq - cp; >> > + >> > + line = malloc(i+1, M_TEMP, M_WAITOK); >> > + strcpy(line, cp); >> > + line[eqidx] = '\0'; >> > + setenv(line, line + eqidx + 1); >> > + free(line, M_TEMP); >> > + cp += i + 1; >> > + } >> > + >> > + hintmode = value; >> > + use_kenv = 1; >> > + return (0); >> > +} >> > + >> > +SYSCTL_PROC(_kern, OID_AUTO, hintmode, CTLTYPE_INT|CTLFLAG_RW, >> > +&hintmode, 0, sysctl_hintmode, "I", "Get/set current >> > hintmode"); + >> > +/* >> > * Evil wildcarding resource string lookup. >> > * This walks the supplied env string table and returns a match. >> > * The start point can be remembered for incremental searches. Think that one is last version :) http://people.freebsd.org/~ray/subr_hints.c.patch Thank you Matthew! WBW -- Aleksandr Rybalko ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to
svn commit: r240082 - head/sys/ofed/drivers/infiniband/ulp/ipoib
Author: melifaro Date: Tue Sep 4 10:56:30 2012 New Revision: 240082 URL: http://svn.freebsd.org/changeset/base/240082 Log: Remove unneeded ipfw headers introduced in r213447 from Infiniband code. MFC after: 2 weeks Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h == --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Tue Sep 4 05:54:43 2012(r240081) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Tue Sep 4 10:56:30 2012(r240082) @@ -67,8 +67,6 @@ #include #include #include -#include -#include #endif #ifdef INET6 #include ___ 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: r240083 - head/bin/setfacl
Author: trasz Date: Tue Sep 4 11:43:00 2012 New Revision: 240083 URL: http://svn.freebsd.org/changeset/base/240083 Log: Make setfacl(1) behave properly in situations like "setfacl -kd". MFC after:1 month Modified: head/bin/setfacl/setfacl.c Modified: head/bin/setfacl/setfacl.c == --- head/bin/setfacl/setfacl.c Tue Sep 4 10:56:30 2012(r240082) +++ head/bin/setfacl/setfacl.c Tue Sep 4 11:43:00 2012(r240083) @@ -73,6 +73,7 @@ main(int argc, char *argv[]) { acl_t acl; acl_type_t acl_type; + acl_entry_t unused_entry; char filename[PATH_MAX]; int local_error, carried_error, ch, i, entry_number, ret; int h_flag; @@ -296,6 +297,20 @@ main(int argc, char *argv[]) } } + /* +* Don't try to set an empty default ACL; it will always fail. +* Use acl_delete_def_file(3) instead. +*/ + if (acl_type == ACL_TYPE_DEFAULT && + acl_get_entry(acl, ACL_FIRST_ENTRY, &unused_entry) == 0) { + if (acl_delete_def_file(file->filename) == -1) { + warn("%s: acl_delete_def_file() failed", + file->filename); + carried_error++; + } + continue; + } + /* don't bother setting the ACL if something is broken */ if (local_error) { carried_error++; ___ 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: r240084 - head/bin/setfacl
Author: trasz Date: Tue Sep 4 11:50:13 2012 New Revision: 240084 URL: http://svn.freebsd.org/changeset/base/240084 Log: Make "setfacl -bd" an alias for "setfacl -k". Previously it would crash on assert. PR: bin/165807 MFC after:1 month Modified: head/bin/setfacl/setfacl.c Modified: head/bin/setfacl/setfacl.c == --- head/bin/setfacl/setfacl.c Tue Sep 4 11:43:00 2012(r240083) +++ head/bin/setfacl/setfacl.c Tue Sep 4 11:50:13 2012(r240084) @@ -264,6 +264,17 @@ main(int argc, char *argv[]) need_mask = 1; break; case OP_REMOVE_EXT: + /* +* Don't try to call remove_ext() for empty +* default ACL. +*/ + if (acl_type == ACL_TYPE_DEFAULT && + acl_get_entry(acl, ACL_FIRST_ENTRY, + &unused_entry) == 0) { + local_error += remove_default(&acl, + file->filename); + break; + } remove_ext(&acl, file->filename); need_mask = 0; break; ___ 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: r240085 - head/bin/getfacl
Author: trasz Date: Tue Sep 4 12:02:23 2012 New Revision: 240085 URL: http://svn.freebsd.org/changeset/base/240085 Log: In getfacl(1) manual page, mention where to read about the ACL syntax. PR submitter suggested adding it to acl(3) instead, but I don't think pointing ordinary users at section 3 is a good idea. PR: docs/162380 MFC after:1 month Modified: head/bin/getfacl/getfacl.1 Modified: head/bin/getfacl/getfacl.1 == --- head/bin/getfacl/getfacl.1 Tue Sep 4 11:50:13 2012(r240084) +++ head/bin/getfacl/getfacl.1 Tue Sep 4 12:02:23 2012(r240085) @@ -97,6 +97,10 @@ then reads a list of pathnames, each terminated by one newline character, from the standard input. .El +.Pp +For an explanation of the ACL syntax, see the +.Xr setfacl 1 +manual page. .Sh EXIT STATUS .Ex -std .Sh EXAMPLES ___ 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: r240086 - in head: share/man/man9 sys/conf sys/libkern sys/net sys/sys
Author: glebius Date: Tue Sep 4 12:07:33 2012 New Revision: 240086 URL: http://svn.freebsd.org/changeset/base/240086 Log: - Move jenkins.h to jenkins_hash.c - Provide missing function that can do hashing of arbitrary sized buffer. - Refetch lookup3.c and do only minimal edits to it, so that diff between our jenkins_hash.c and lookup3.c is minimal. - Add declarations for jenkins_hash(), jenkins_hash32() to sys/hash.h. - Document these functions in hash(9) Obtained from:http://burtleburtle.net/bob/c/lookup3.c Added: head/sys/libkern/jenkins_hash.c - copied, changed from r240081, head/sys/libkern/jenkins.h Deleted: head/sys/libkern/jenkins.h Modified: head/share/man/man9/hash.9 head/sys/conf/files head/sys/net/flowtable.c head/sys/sys/hash.h Modified: head/share/man/man9/hash.9 == --- head/share/man/man9/hash.9 Tue Sep 4 12:02:23 2012(r240085) +++ head/share/man/man9/hash.9 Tue Sep 4 12:07:33 2012(r240086) @@ -26,7 +26,7 @@ .\" $OpenBSD: hash.9,v 1.5 2003/04/17 05:08:39 jmc Exp $ .\" $FreeBSD$ .\" -.Dd April 3, 2007 +.Dd September 4, 2012 .Dt HASH 9 .Os .Sh NAME @@ -36,7 +36,9 @@ .Nm hash32_str , .Nm hash32_strn , .Nm hash32_stre , -.Nm hash32_strne +.Nm hash32_strne , +.Nm jenkins_hash32 , +.Nm jenkins_hash .Nd general kernel hashing functions .Sh SYNOPSIS .In sys/hash.h @@ -50,6 +52,10 @@ .Fn hash32_stre "const void *buf" "int end" "const char **ep" "uint32_t hash" .Ft uint32_t .Fn hash32_strne "const void *buf" "size_t len" "int end" "const char **ep" "uint32_t hash" +.Ft uint32_t +.Fn jenkins_hash "const void *buf" "size_t len" "uint32_t hash" +.Ft uint32_t +.Fn jenkins_hash32 "const uint32_t *buf" "size_t count" "uint32_t hash" .Sh DESCRIPTION The .Fn hash32 @@ -107,6 +113,23 @@ is not .Dv NULL , it is set to the point in the buffer at which the hash function terminated hashing. +.Pp +The +.Fn jenkins_hash +function has same semantics as the +.Fn hash32_buf , +but provides more advanced hashing algorithm with better distribution. +.Pp +The +.Fn jenkins_hash32 +uses same hashing algorithm as the +.Fn jenkins_hash +function, but works only on +.Ft uint32_t +sized arrays, thus is simplier and faster. +It accepts an array of +.Ft uint32_t +values in its first argument and size of this array in the second argument. .Sh RETURN VALUES The .Fn hash32 @@ -150,12 +173,24 @@ be revisited. .Sh HISTORY The .Nm -functions were first committed to +functions first appeared in .Nx 1.6 . -The -.Ox -versions were written and massaged for -.Ox 2.3 -by Tobias Weingartner, -and finally committed for -.Ox 3.2 . +The current implementation of +.Nm hash32 +functions was first committed to +.Ox 3.2 , +and later imported to +.Fx 6.1 . +The +.Nm jenkins_hash +functions were added in +.Fx 10.0 . +.Sh AUTHORS +The +.Nm hash32 +functions were written by +.An Tobias Weingartner . +The +.Nm jenkins_hash +functions was written by +Bob Jenkins . Modified: head/sys/conf/files == --- head/sys/conf/files Tue Sep 4 12:02:23 2012(r240085) +++ head/sys/conf/files Tue Sep 4 12:07:33 2012(r240086) @@ -2797,6 +2797,7 @@ libkern/inet_aton.c standard libkern/inet_ntoa.cstandard libkern/inet_ntop.cstandard libkern/inet_pton.cstandard +libkern/jenkins_hash.c standard libkern/mcount.c optional profiling-routine libkern/memcchr.c standard libkern/memcmp.c standard Copied and modified: head/sys/libkern/jenkins_hash.c (from r240081, head/sys/libkern/jenkins.h) == --- head/sys/libkern/jenkins.h Tue Sep 4 05:54:43 2012(r240081, copy source) +++ head/sys/libkern/jenkins_hash.c Tue Sep 4 12:07:33 2012 (r240086) @@ -1,43 +1,44 @@ -#ifndef __LIBKERN_JENKINS_H__ -#define __LIBKERN_JENKINS_H__ /* * Taken from http://burtleburtle.net/bob/c/lookup3.c * $FreeBSD$ */ +#include +#include + /* --- - lookup3.c, by Bob Jenkins, May 2006, Public Domain. - - These are functions for producing 32-bit hashes for hash table lookup. - hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final() - are externally useful functions. Routines to test the hash are included - if SELF_TEST is defined. You can use this free for any purpose. It's in - the public domain. It has no warranty. - - You probably want to use hashlittle(). hashlittle() and hashbig() - hash byte arrays. hashlittle() is faster than hashbig() on - little-endian machines. Intel and AMD are little-endian machines. - On second thought, you probably want hashlittle2(), which is identical to - hashlittle() except it returns two 32-bit
svn commit: r240087 - head/bin/setfacl
Author: trasz Date: Tue Sep 4 12:19:34 2012 New Revision: 240087 URL: http://svn.freebsd.org/changeset/base/240087 Log: Fix an error in setfacl(1) that manifested like this: # setfacl -m u:trasz:rwx x # setfacl -m u:root:rwx x # getfacl x # file: x # owner: root # group: wheel user::rw- user:root:rwx user:trasz:rwx group::r-- mask::rwx other::r-- # setfacl -m u:root:rwx x setfacl: x: acl_calc_mask() failed: Invalid argument setfacl: x: failed to set ACL mask For NFSv4 ACLs, this sort of situation would result in duplicated entries. MFC after:1 month Modified: head/bin/setfacl/merge.c Modified: head/bin/setfacl/merge.c == --- head/bin/setfacl/merge.cTue Sep 4 12:07:33 2012(r240086) +++ head/bin/setfacl/merge.cTue Sep 4 12:19:34 2012(r240087) @@ -94,7 +94,7 @@ merge_acl(acl_t acl, acl_t *prev_acl, co acl_tag_t tag, tag_new; acl_entry_type_t entry_type, entry_type_new; acl_flagset_t flagset; - int entry_id, entry_id_new, have_entry, entry_number = 0; + int entry_id, entry_id_new, have_entry, had_entry, entry_number = 0; int acl_brand, prev_acl_brand; acl_get_brand_np(acl, &acl_brand); @@ -116,6 +116,7 @@ merge_acl(acl_t acl, acl_t *prev_acl, co while (acl_get_entry(acl, entry_id, &entry) == 1) { entry_id = ACL_NEXT_ENTRY; have_entry = 0; + had_entry = 0; /* keep track of existing ACL_MASK entries */ if (acl_get_tag_type(entry, &tag) == -1) @@ -187,7 +188,7 @@ merge_acl(acl_t acl, acl_t *prev_acl, co err(1, "%s: acl_set_flagset_np() failed", filename); } - have_entry = 1; + had_entry = have_entry = 1; break; default: /* should never be here */ @@ -197,7 +198,7 @@ merge_acl(acl_t acl, acl_t *prev_acl, co } /* if this entry has not been found, it must be new */ - if (have_entry == 0) { + if (had_entry == 0) { /* * NFSv4 ACL entries must be prepended to the ACL. ___ 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: r240088 - head/bin/cp
Author: trasz Date: Tue Sep 4 12:27:23 2012 New Revision: 240088 URL: http://svn.freebsd.org/changeset/base/240088 Log: Explicitly mention that "cp -p" copies ACLs. PR: docs/168962 MFC after:1 month Modified: head/bin/cp/cp.1 Modified: head/bin/cp/cp.1 == --- head/bin/cp/cp.1Tue Sep 4 12:19:34 2012(r240087) +++ head/bin/cp/cp.1Tue Sep 4 12:27:23 2012(r240088) @@ -32,7 +32,7 @@ .\"@(#)cp.18.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd January 17, 2010 +.Dd September 4, 2012 .Dt CP 1 .Os .Sh NAME @@ -164,7 +164,7 @@ Cause .Nm to preserve the following attributes of each source file in the copy: modification time, access time, -file flags, file mode, user ID, and group ID, as allowed by permissions. +file flags, file mode, ACL, user ID, and group ID, as allowed by permissions. .Pp If the user ID and group ID cannot be preserved, no error message is displayed and the exit value is not altered. ___ 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: r240090 - head/libexec/save-entropy
Author: dougb Date: Tue Sep 4 16:00:51 2012 New Revision: 240090 URL: http://svn.freebsd.org/changeset/base/240090 Log: 1. Use install -d to create the entropy_dir if missing so that we can do it all in one command, with no permissions race. 2. Simplify the rotation logic by cd'ing into the directory, with a test to make sure that it succeeds. 3. Remove any files numbered higher than entropy_save_num. This helps when the user reduces the number, and may be useful for other purposes down the road. 4. Simplify the rotation logic by first testing the common case (it's a regular file) then testing if something else exists with the same name using elif. Also switch from using jot to simpler countdown format. 5. Fix logger lines and error messages to be more consistent, and wrap the code more consistently in the 80 column range. The "not a regular file" error message was mistakenly wrapped entirely in "quotes" which caused logger to include line-wrapping whitespace. Change that to wrap only the variables in quotes, which is both consistent and works better. 6. Update copyright to reflect the fact that changes were made this year. Parts of 2-4 were taken from etc/periodic/daily/310.accounting Modified: head/libexec/save-entropy/save-entropy.sh Modified: head/libexec/save-entropy/save-entropy.sh == --- head/libexec/save-entropy/save-entropy.sh Tue Sep 4 15:58:58 2012 (r240089) +++ head/libexec/save-entropy/save-entropy.sh Tue Sep 4 16:00:51 2012 (r240090) @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2001-2006 Douglas Barton, do...@freebsd.org +# Copyright (c) 2001-2006,2012 Douglas Barton, do...@freebsd.org # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ # This script is called by cron to store bits of randomness which are # then used to seed /dev/random on boot. -# Originally developed by Doug Barton, do...@freebsd.org +# Originally developed by Doug Barton, do...@freebsd.org PATH=/bin:/usr/bin @@ -55,38 +55,36 @@ entropy_save_sz=${entropy_save_sz:-2048} entropy_save_num=${entropy_save_num:-8} if [ ! -d "${entropy_dir}" ]; then - umask 077 - mkdir "${entropy_dir}" || { - logger -is -t "$0" The entropy directory "${entropy_dir}" does not \ -exist, and cannot be created. Therefore no entropy can be saved. ; - exit 1;} - /usr/sbin/chown operator:operator "${entropy_dir}" - chmod 0700 "${entropy_dir}" + install -d -o operator -g operator -m 0700 "${entropy_dir}" || { + logger -is -t "$0" The entropy directory "${entropy_dir}" does \ + not exist, and cannot be created. Therefore no entropy can \ + be saved.; exit 1; } fi +cd "${entropy_dir}" || { + logger -is -t "$0" Cannot cd to the entropy directory: "${entropy_dir}". \ + Entropy file rotation is aborted.; exit 1; } + +for f in saved-entropy.*; do + case "${f}" in saved-entropy.\*) continue ;; esac # No files match + [ ${f#saved-entropy\.} -ge ${entropy_save_num} ] && unlink ${f} +done + umask 377 -esn_m1=$(( ${entropy_save_num} - 1 )) -for file_num in `jot $esn_m1 $esn_m1 1`; do - if [ -e "${entropy_dir}/saved-entropy.${file_num}" ]; then - if [ -f "${entropy_dir}/saved-entropy.${file_num}" ]; then - new_file=saved-entropy.$(( $file_num + 1 )) - if [ -e "${entropy_dir}/${new_file}" ]; then - unlink ${entropy_dir}/${new_file} - fi - mv "${entropy_dir}/saved-entropy.${file_num}" \ - "${entropy_dir}/${new_file}" - else - logger -is -t "$0" \ -"${entropy_dir}/saved-entropy.${file_num} is not a regular file, and therefore \ -it will not be rotated. Entropy file harvesting is aborted." - exit 1 - fi +n=$(( ${entropy_save_num} - 1 )) +while [ ${n} -ge 1 ]; do + if [ -f "saved-entropy.${n}" ]; then + mv "saved-entropy.${n}" "saved-entropy.$(( ${n} + 1 ))" + elif [ -e "saved-entropy.${n}" -o -L "saved-entropy.${n}" ]; then + logger -is -t "$0" \ + "${entropy_dir}/saved-entropy.${n}" is not a regular file, and so \ + it will not be rotated. Entropy file rotation is aborted. + exit 1 fi + n=$(( ${n} - 1 )) done -dd if=/dev/random of="${entropy_dir}/saved-entropy.1" \ -bs="$entropy_save_sz" count=1 2> /dev/null +dd if=/dev/random of=saved-entropy.1 bs=${entropy_save_sz} count=1 2>/dev/null exit 0 - ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mai
Re: svn commit: r239998 - head/contrib/dtc
On 2012-09-02, at 03:48, Andrew Turner wrote: > Author: andrew > Date: Sun Sep 2 01:48:47 2012 > New Revision: 239998 > URL: http://svn.freebsd.org/changeset/base/239998 > > Log: > Fix a logic inversion in an assert to allow us to use dts files that > include other files. > > Modified: > head/contrib/dtc/dtc-lexer.l Is this a bug in the dtc that should be upstreamed perhaps, or is it fixed at the point beyond our recent import of the vendor package? Rafal ___ 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: r240096 - head/sys/vm
Author: des Date: Tue Sep 4 19:04:02 2012 New Revision: 240096 URL: http://svn.freebsd.org/changeset/base/240096 Log: No memory barrier is required. This was pointed out by kib@ a while ago, but I got distracted by other matters. Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cTue Sep 4 17:29:35 2012(r240095) +++ head/sys/vm/swap_pager.cTue Sep 4 19:04:02 2012(r240096) @@ -50,7 +50,7 @@ * * - on the fly reallocation of swap during putpages. The new system * does not try to keep previously allocated swap blocks for dirty - * pages. + * pages. * * - on the fly deallocation of swap * @@ -154,15 +154,21 @@ int swap_pager_avail; static int swdev_syscall_active = 0; /* serialize swap(on|off) */ static vm_ooffset_t swap_total; -SYSCTL_QUAD(_vm, OID_AUTO, swap_total, CTLFLAG_RD, &swap_total, 0, +SYSCTL_QUAD(_vm, OID_AUTO, swap_total, CTLFLAG_RD, &swap_total, 0, "Total amount of available swap storage."); static vm_ooffset_t swap_reserved; -SYSCTL_QUAD(_vm, OID_AUTO, swap_reserved, CTLFLAG_RD, &swap_reserved, 0, +SYSCTL_QUAD(_vm, OID_AUTO, swap_reserved, CTLFLAG_RD, &swap_reserved, 0, "Amount of swap storage needed to back all allocated anonymous memory."); static int overcommit = 0; -SYSCTL_INT(_vm, OID_AUTO, overcommit, CTLFLAG_RW, &overcommit, 0, +SYSCTL_INT(_vm, OID_AUTO, overcommit, CTLFLAG_RW, &overcommit, 0, "Configure virtual memory overcommit behavior. See tuning(7) " "for details."); +static unsigned long swzone; +SYSCTL_ULONG(_vm, OID_AUTO, swzone, CTLFLAG_RD, &swzone, 0, +"Actual size of swap metadata zone"); +static unsigned long swap_maxpages; +SYSCTL_ULONG(_vm, OID_AUTO, swap_maxpages, CTLFLAG_RD, &swap_maxpages, 0, +"Maximum amount of swap supported"); /* bits from overcommit */ #defineSWAP_RESERVE_FORCE_ON (1 << 0) @@ -184,7 +190,7 @@ swap_reserve_by_cred(vm_ooffset_t incr, static int curfail; static struct timeval lastfail; struct uidinfo *uip; - + uip = cred->cr_ruidinfo; if (incr & PAGE_MASK) @@ -285,7 +291,7 @@ void swap_release_by_cred(vm_ooffset_t decr, struct ucred *cred) { struct uidinfo *uip; - + uip = cred->cr_ruidinfo; if (decr & PAGE_MASK) @@ -328,7 +334,7 @@ static struct sx sw_alloc_sx; SYSCTL_INT(_vm, OID_AUTO, swap_async_max, -CTLFLAG_RW, &swap_async_max, 0, "Maximum running async swap ops"); + CTLFLAG_RW, &swap_async_max, 0, "Maximum running async swap ops"); /* * "named" and "unnamed" anon region objects. Try to reduce the overhead @@ -340,7 +346,7 @@ SYSCTL_INT(_vm, OID_AUTO, swap_async_max #define NOBJLIST(handle) \ (&swap_pager_object_list[((int)(intptr_t)handle >> 4) & (NOBJLISTS-1)]) -static struct mtx sw_alloc_mtx;/* protect list manipulation */ +static struct mtx sw_alloc_mtx;/* protect list manipulation */ static struct pagerlst swap_pager_object_list[NOBJLISTS]; static uma_zone_t swap_zone; static struct vm_objectswap_zone_obj; @@ -419,7 +425,7 @@ swp_pager_free_nrpage(vm_page_t m) /* * SWP_SIZECHECK() - update swap_pager_full indication - * + * * update the swap_pager_almost_full indication and warn when we are * about to run out of swap space, using lowat/hiwat hysteresis. * @@ -474,7 +480,7 @@ swp_pager_hash(vm_object_t object, vm_pi /* * SWAP_PAGER_INIT() - initialize the swap pager! * - * Expected to be started from system init. NOTE: This code is run + * Expected to be started from system init. NOTE: This code is run * before much else so be careful what you depend on. Most of the VM * system has yet to be initialized at this point. */ @@ -506,7 +512,7 @@ swap_pager_init(void) void swap_pager_swap_init(void) { - int n, n2; + unsigned long n, n2; /* * Number of in-transit swap bp operations. Don't @@ -519,7 +525,7 @@ swap_pager_swap_init(void) * MAX_PAGEOUT_CLUSTER. Also be aware that swap ops are * constrained by the swap device interleave stripe size. * -* Currently we hardwire nsw_wcount_async to 4. This limit is +* Currently we hardwire nsw_wcount_async to 4. This limit is * designed to prevent other I/O from having high latencies due to * our pageout I/O. The value 4 works well for one or two active swap * devices but is probably a little low if you have more. Even so, @@ -548,11 +554,11 @@ swap_pager_swap_init(void) n = cnt.v_page_count / 2; if (maxswzone && n > maxswzone / sizeof(struct swblock)) n = maxswzone / sizeof(struct swblock); - n2 = n; swap_zone = uma_zcreate("SWAPMETA", sizeof(struct swblock), NULL, NULL, N
Re: svn commit: r240096 - head/sys/vm
On Tuesday, September 04, 2012 3:04:02 pm Dag-Erling SmXrgrav wrote: > Author: des > Date: Tue Sep 4 19:04:02 2012 > New Revision: 240096 > URL: http://svn.freebsd.org/changeset/base/240096 > > Log: > No memory barrier is required. This was pointed out by kib@ a while ago, > but I got distracted by other matters. Humm, this seemed to have a lot of unrelated changes? -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r240098 - in head/sys: amd64/conf conf i386/conf
Author: jhb Date: Tue Sep 4 19:19:36 2012 New Revision: 240098 URL: http://svn.freebsd.org/changeset/base/240098 Log: Fix duplicate entries for mwl(4): - Move mwlfw from {amd64,i386}/conf/NOTES to sys/conf/NOTES (mwl(4) is already present in sys/conf/NOTES). - Remove duplicate mwl(4) entries from {amd64,i386}/conf/NOTES. - While here, add a description to the sfxge line in amd64/conf/NOTES. Modified: head/sys/amd64/conf/NOTES head/sys/conf/NOTES head/sys/i386/conf/NOTES Modified: head/sys/amd64/conf/NOTES == --- head/sys/amd64/conf/NOTES Tue Sep 4 19:14:57 2012(r240097) +++ head/sys/amd64/conf/NOTES Tue Sep 4 19:19:36 2012(r240098) @@ -306,8 +306,6 @@ options DRM_DEBUG # Include debug print # mlx4ib: Mellanox ConnectX HCA InfiniBand # mlxen: Mellanox ConnectX HCA Ethernet # mthca: Mellanox HCA InfiniBand -# mwl: Marvell 88W8363 IEEE 802.11 adapter -# Requires the mwl firmware module # nfe: nVidia nForce MCP on-board Ethernet Networking (BSD open source) # nve: nVidia nForce MCP on-board Ethernet Networking # sfxge: Solarflare SFC9000 family 10Gb Ethernet adapters @@ -324,10 +322,9 @@ device iwn # Intel 4965/1000/5000/6000 device mlx4ib # Mellanox ConnectX HCA InfiniBand device mlxen # Mellanox ConnectX HCA Ethernet device mthca # Mellanox HCA InfiniBand -device mwl # Marvell 88W8363 802.11n wireless NICs. device nfe # nVidia nForce MCP on-board Ethernet device nve # nVidia nForce MCP on-board Ethernet Networking -device sfxge +device sfxge # Solarflare SFC9000 10Gb Ethernet device wpi # Intel 3945ABG wireless NICs. # IEEE 802.11 adapter firmware modules @@ -350,7 +347,6 @@ device wpi # Intel 3945ABG wireless NI # iwn5150fw: Specific module for the 5150 only # iwn6000fw: Specific module for the 6000 only # iwn6050fw: Specific module for the 6050 only -# mwlfw: Marvell 88W8363 firmware # wpifw: Intel 3945ABG Wireless LAN Controller firmware device iwifw @@ -368,7 +364,6 @@ device iwn5000fw device iwn5150fw device iwn6000fw device iwn6050fw -device mwlfw device wpifw # Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Tue Sep 4 19:14:57 2012(r240097) +++ head/sys/conf/NOTES Tue Sep 4 19:19:36 2012(r240098) @@ -1968,6 +1968,8 @@ devicexmphy # XaQti XMAC II # SMC TigerCard 1000 (SMC9462SX), and some Addtron cards. # malo: Marvell Libertas wireless NICs. # mwl: Marvell 88W8363 802.11n wireless NICs. +# Requires the mwl firmware module +# mwlfw: Marvell 88W8363 firmware # msk: Support for gigabit ethernet adapters based on the Marvell/SysKonnect # Yukon II Gigabit controllers, including 88E8021, 88E8022, 88E8061, # 88E8062, 88E8035, 88E8036, 88E8038, 88E8050, 88E8052, 88E8053, @@ -2163,6 +2165,7 @@ devicebwi # Broadcom BCM430* BCM431* device bwn # Broadcom BCM43xx device malo# Marvell Libertas wireless NICs. device mwl # Marvell 88W8363 802.11n wireless NICs. +device mwlfw device ral # Ralink Technology RT2500 wireless NICs. # Use sf_buf(9) interface for jumbo buffers on ti(4) controllers. Modified: head/sys/i386/conf/NOTES == --- head/sys/i386/conf/NOTESTue Sep 4 19:14:57 2012(r240097) +++ head/sys/i386/conf/NOTESTue Sep 4 19:19:36 2012(r240098) @@ -577,8 +577,6 @@ hint.mse.0.irq="5" # mlx4ib: Mellanox ConnectX HCA InfiniBand # mlxen: Mellanox ConnectX HCA Ethernet # mthca: Mellanox HCA InfiniBand -# mwl: Marvell 88W8363 IEEE 802.11 adapter -# Requires the mwl firmware module # nfe: nVidia nForce MCP on-board Ethernet Networking (BSD open source) # nve: nVidia nForce MCP on-board Ethernet Networking # sbni: Granch SBNI12-xx ISA and PCI adapters @@ -624,7 +622,6 @@ hint.le.0.drq="0" device mlx4ib # Mellanox ConnectX HCA InfiniBand device mlxen # Mellanox ConnectX HCA Ethernet device mthca # Mellanox HCA InfiniBand -device mwl # Marvell 88W8363 802.11n wireless NICs. device nfe # nVidia nForce MCP on-board Ethernet device nve # nVidia nForce MCP on-board Ethernet Networking device sbni @@ -659,7 +656,6 @@ device wpi # Intel 3945ABG wireless NI # iwn5150fw: Specific module for the 5150 only # iwn6000fw:
svn commit: r240099 - in head/sys: net netinet netinet/ipfw
Author: melifaro Date: Tue Sep 4 19:43:26 2012 New Revision: 240099 URL: http://svn.freebsd.org/changeset/base/240099 Log: Introduce new link-layer PFIL hook V_link_pfil_hook. Merge ether_ipfw_chk() and part of bridge_pfil() into unified ipfw_check_frame() function called by PFIL. This change was suggested by rwatson? @ DevSummit. Remove ipfw headers from ether/bridge code since they are unneeded now. Note this thange introduce some (temporary) performance penalty since PFIL read lock has to be acquired for every link-level packet. MFC after: 3 weeks Modified: head/sys/net/if_bridge.c head/sys/net/if_ethersubr.c head/sys/net/if_var.h head/sys/netinet/ip_var.h head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/ipfw/ip_fw_pfil.c head/sys/netinet/ipfw/ip_fw_private.h Modified: head/sys/net/if_bridge.c == --- head/sys/net/if_bridge.cTue Sep 4 19:19:36 2012(r240098) +++ head/sys/net/if_bridge.cTue Sep 4 19:43:26 2012(r240099) @@ -100,7 +100,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -131,8 +130,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include /* * Size of the route hash table. Must be a power of two. @@ -2981,7 +2978,6 @@ bridge_pfil(struct mbuf **mp, struct ifn { int snap, error, i, hlen; struct ether_header *eh1, eh2; - struct ip_fw_args args; struct ip *ip; struct llc llc1; u_int16_t ether_type; @@ -3055,6 +3051,16 @@ bridge_pfil(struct mbuf **mp, struct ifn goto bad; } + /* Run the packet through pfil before stripping link headers */ + if (PFIL_HOOKED(&V_link_pfil_hook) && pfil_ipfw != 0 && + dir == PFIL_OUT && ifp != NULL) { + + error = pfil_run_hooks(&V_link_pfil_hook, mp, ifp, dir, NULL); + + if (*mp == NULL || error != 0) /* packet consumed by filter */ + return (error); + } + /* Strip off the Ethernet header and keep a copy. */ m_copydata(*mp, 0, ETHER_HDR_LEN, (caddr_t) &eh2); m_adj(*mp, ETHER_HDR_LEN); @@ -3085,63 +3091,6 @@ bridge_pfil(struct mbuf **mp, struct ifn goto bad; } - /* XXX this section is also in if_ethersubr.c */ - // XXX PFIL_OUT or DIR_OUT ? - if (V_ip_fw_chk_ptr && pfil_ipfw != 0 && - dir == PFIL_OUT && ifp != NULL) { - struct m_tag *mtag; - - error = -1; - /* fetch the start point from existing tags, if any */ - mtag = m_tag_locate(*mp, MTAG_IPFW_RULE, 0, NULL); - if (mtag == NULL) { - args.rule.slot = 0; - } else { - struct ipfw_rule_ref *r; - - /* XXX can we free the tag after use ? */ - mtag->m_tag_id = PACKET_TAG_NONE; - r = (struct ipfw_rule_ref *)(mtag + 1); - /* packet already partially processed ? */ - if (r->info & IPFW_ONEPASS) - goto ipfwpass; - args.rule = *r; - } - - args.m = *mp; - args.oif = ifp; - args.next_hop = NULL; - args.next_hop6 = NULL; - args.eh = &eh2; - args.inp = NULL;/* used by ipfw uid/gid/jail rules */ - i = V_ip_fw_chk_ptr(&args); - *mp = args.m; - - if (*mp == NULL) - return (error); - - if (ip_dn_io_ptr && (i == IP_FW_DUMMYNET)) { - - /* put the Ethernet header back on */ - M_PREPEND(*mp, ETHER_HDR_LEN, M_DONTWAIT); - if (*mp == NULL) - return (error); - bcopy(&eh2, mtod(*mp, caddr_t), ETHER_HDR_LEN); - - /* -* Pass the pkt to dummynet, which consumes it. The -* packet will return to us via bridge_dummynet(). -*/ - args.oif = ifp; - ip_dn_io_ptr(mp, DIR_FWD | PROTO_IFB, &args); - return (error); - } - - if (i != IP_FW_PASS) /* drop */ - goto bad; - } - -ipfwpass: error = 0; /* Modified: head/sys/net/if_ethersubr.c == --- head/sys/net/if_ethersubr.c Tue Sep 4 19:19:36 2012(r240098) +++ head/sys/net/if_ethersubr.c Tue Sep 4 19:43:26 2012(r240099) @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -63,6
svn commit: r240101 - head/tools/test/hwpmc
Author: gnn Date: Tue Sep 4 20:14:37 2012 New Revision: 240101 URL: http://svn.freebsd.org/changeset/base/240101 Log: Add a reasonable error message telling the caller to specify a program to be executed under hwpmc. If there is no program to run then exit. Modified: head/tools/test/hwpmc/pmctest.py Modified: head/tools/test/hwpmc/pmctest.py == --- head/tools/test/hwpmc/pmctest.pyTue Sep 4 19:49:37 2012 (r240100) +++ head/tools/test/hwpmc/pmctest.pyTue Sep 4 20:14:37 2012 (r240101) @@ -67,6 +67,10 @@ def main(): (options, args) = parser.parse_args() +if (options.program == None): +print "specify program, such as ls, with -p/--program" +sys.exit() + p = subprocess.Popen(["pmccontrol", "-L"], stdout=PIPE) counters = p.communicate()[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: r240103 - head/tools/tools/netmap
Author: emaste Date: Tue Sep 4 20:51:25 2012 New Revision: 240103 URL: http://svn.freebsd.org/changeset/base/240103 Log: Failure to open netmap device is unrecoverable. There's no reason to "fail later" since there's nothing this tool can do in netmap mode without /dev/netmap open. Modified: head/tools/tools/netmap/pkt-gen.c Modified: head/tools/tools/netmap/pkt-gen.c == --- head/tools/tools/netmap/pkt-gen.c Tue Sep 4 20:45:59 2012 (r240102) +++ head/tools/tools/netmap/pkt-gen.c Tue Sep 4 20:51:25 2012 (r240103) @@ -892,7 +892,7 @@ main(int arc, char **argv) fd = open("/dev/netmap", O_RDWR); if (fd == -1) { D("Unable to open /dev/netmap"); - // fail later + exit(1); } else { if ((ioctl(fd, NIOCGINFO, &nmr)) == -1) { D("Unable to get if info without name"); ___ 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: r240104 - in head/sys: amd64/conf i386/conf
Author: delphij Date: Tue Sep 4 21:02:57 2012 New Revision: 240104 URL: http://svn.freebsd.org/changeset/base/240104 Log: Add hpt27xx to GENERIC kernel for amd64 and i386 systems. MFC after:2 weeks Modified: head/sys/amd64/conf/GENERIC head/sys/i386/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC == --- head/sys/amd64/conf/GENERIC Tue Sep 4 20:51:25 2012(r240103) +++ head/sys/amd64/conf/GENERIC Tue Sep 4 21:02:57 2012(r240104) @@ -148,6 +148,7 @@ device ciss# Compaq Smart RAID 5* device dpt # DPT Smartcache III, IV - See NOTES for options device hptmv # Highpoint RocketRAID 182x device hptrr # Highpoint RocketRAID 17xx, 22xx, 23xx, 25xx +device hpt27xx # Highpoint RocketRAID 27xx device iir # Intel Integrated RAID device ips # IBM (Adaptec) ServeRAID device mly # Mylex AcceleRAID/eXtremeRAID Modified: head/sys/i386/conf/GENERIC == --- head/sys/i386/conf/GENERIC Tue Sep 4 20:51:25 2012(r240103) +++ head/sys/i386/conf/GENERIC Tue Sep 4 21:02:57 2012(r240104) @@ -154,6 +154,7 @@ device ciss# Compaq Smart RAID 5* device dpt # DPT Smartcache III, IV - See NOTES for options device hptmv # Highpoint RocketRAID 182x device hptrr # Highpoint RocketRAID 17xx, 22xx, 23xx, 25xx +device hpt27xx # Highpoint RocketRAID 27xx device iir # Intel Integrated RAID device ips # IBM (Adaptec) ServeRAID device mly # Mylex AcceleRAID/eXtremeRAID ___ 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: r240105 - head/sys/vm
Author: des Date: Tue Sep 4 21:06:53 2012 New Revision: 240105 URL: http://svn.freebsd.org/changeset/base/240105 Log: Revert previous commit, which was performed in the wrong tree. Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cTue Sep 4 21:02:57 2012(r240104) +++ head/sys/vm/swap_pager.cTue Sep 4 21:06:53 2012(r240105) @@ -50,7 +50,7 @@ * * - on the fly reallocation of swap during putpages. The new system * does not try to keep previously allocated swap blocks for dirty - * pages. + * pages. * * - on the fly deallocation of swap * @@ -154,21 +154,15 @@ int swap_pager_avail; static int swdev_syscall_active = 0; /* serialize swap(on|off) */ static vm_ooffset_t swap_total; -SYSCTL_QUAD(_vm, OID_AUTO, swap_total, CTLFLAG_RD, &swap_total, 0, +SYSCTL_QUAD(_vm, OID_AUTO, swap_total, CTLFLAG_RD, &swap_total, 0, "Total amount of available swap storage."); static vm_ooffset_t swap_reserved; -SYSCTL_QUAD(_vm, OID_AUTO, swap_reserved, CTLFLAG_RD, &swap_reserved, 0, +SYSCTL_QUAD(_vm, OID_AUTO, swap_reserved, CTLFLAG_RD, &swap_reserved, 0, "Amount of swap storage needed to back all allocated anonymous memory."); static int overcommit = 0; -SYSCTL_INT(_vm, OID_AUTO, overcommit, CTLFLAG_RW, &overcommit, 0, +SYSCTL_INT(_vm, OID_AUTO, overcommit, CTLFLAG_RW, &overcommit, 0, "Configure virtual memory overcommit behavior. See tuning(7) " "for details."); -static unsigned long swzone; -SYSCTL_ULONG(_vm, OID_AUTO, swzone, CTLFLAG_RD, &swzone, 0, -"Actual size of swap metadata zone"); -static unsigned long swap_maxpages; -SYSCTL_ULONG(_vm, OID_AUTO, swap_maxpages, CTLFLAG_RD, &swap_maxpages, 0, -"Maximum amount of swap supported"); /* bits from overcommit */ #defineSWAP_RESERVE_FORCE_ON (1 << 0) @@ -190,7 +184,7 @@ swap_reserve_by_cred(vm_ooffset_t incr, static int curfail; static struct timeval lastfail; struct uidinfo *uip; - + uip = cred->cr_ruidinfo; if (incr & PAGE_MASK) @@ -291,7 +285,7 @@ void swap_release_by_cred(vm_ooffset_t decr, struct ucred *cred) { struct uidinfo *uip; - + uip = cred->cr_ruidinfo; if (decr & PAGE_MASK) @@ -334,7 +328,7 @@ static struct sx sw_alloc_sx; SYSCTL_INT(_vm, OID_AUTO, swap_async_max, - CTLFLAG_RW, &swap_async_max, 0, "Maximum running async swap ops"); +CTLFLAG_RW, &swap_async_max, 0, "Maximum running async swap ops"); /* * "named" and "unnamed" anon region objects. Try to reduce the overhead @@ -346,7 +340,7 @@ SYSCTL_INT(_vm, OID_AUTO, swap_async_max #define NOBJLIST(handle) \ (&swap_pager_object_list[((int)(intptr_t)handle >> 4) & (NOBJLISTS-1)]) -static struct mtx sw_alloc_mtx;/* protect list manipulation */ +static struct mtx sw_alloc_mtx;/* protect list manipulation */ static struct pagerlst swap_pager_object_list[NOBJLISTS]; static uma_zone_t swap_zone; static struct vm_objectswap_zone_obj; @@ -425,7 +419,7 @@ swp_pager_free_nrpage(vm_page_t m) /* * SWP_SIZECHECK() - update swap_pager_full indication - * + * * update the swap_pager_almost_full indication and warn when we are * about to run out of swap space, using lowat/hiwat hysteresis. * @@ -480,7 +474,7 @@ swp_pager_hash(vm_object_t object, vm_pi /* * SWAP_PAGER_INIT() - initialize the swap pager! * - * Expected to be started from system init. NOTE: This code is run + * Expected to be started from system init. NOTE: This code is run * before much else so be careful what you depend on. Most of the VM * system has yet to be initialized at this point. */ @@ -512,7 +506,7 @@ swap_pager_init(void) void swap_pager_swap_init(void) { - unsigned long n, n2; + int n, n2; /* * Number of in-transit swap bp operations. Don't @@ -525,7 +519,7 @@ swap_pager_swap_init(void) * MAX_PAGEOUT_CLUSTER. Also be aware that swap ops are * constrained by the swap device interleave stripe size. * -* Currently we hardwire nsw_wcount_async to 4. This limit is +* Currently we hardwire nsw_wcount_async to 4. This limit is * designed to prevent other I/O from having high latencies due to * our pageout I/O. The value 4 works well for one or two active swap * devices but is probably a little low if you have more. Even so, @@ -554,11 +548,11 @@ swap_pager_swap_init(void) n = cnt.v_page_count / 2; if (maxswzone && n > maxswzone / sizeof(struct swblock)) n = maxswzone / sizeof(struct swblock); + n2 = n; swap_zone = uma_zcreate("SWAPMETA", sizeof(struct swblock), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE | UMA_ZONE
Re: svn commit: r240096 - head/sys/vm
John Baldwin writes: > Humm, this seemed to have a lot of unrelated changes? *frak* Thanks for noticing. I committed from the wrong tree. DES -- Dag-Erling Smørgrav - d...@des.no ___ 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: r239679 - head/sys/mips/conf
On Saturday, August 25, 2012 8:02:14 am Robert Watson wrote: > Author: rwatson > Date: Sat Aug 25 12:02:13 2012 > New Revision: 239679 > URL: http://svn.freebsd.org/changeset/base/239679 > > Log: > Add reference kernel configurations for FreeBSD/beri in simulation, on the > Terasic DE-4, and Terasic tPad Altera-based boards. > > Sponsored by: DARPA, AFRL I'm not sure why the tinderbox isn't reporting this, but this breaks 'make tinderbox' for me due to the hardcoded MFS paths in the _MDROOT configs: -- >>> make universe started on Fri Aug 31 17:26:08 EDT 2012 -- >> amd64 started on Fri Aug 31 17:26:08 EDT 2012 >> amd64 completed on Fri Aug 31 18:49:29 EDT 2012 >> arm started on Fri Aug 31 18:49:29 EDT 2012 >> arm completed on Fri Aug 31 19:27:59 EDT 2012 >> i386 started on Fri Aug 31 19:27:59 EDT 2012 >> i386 completed on Fri Aug 31 20:55:27 EDT 2012 >> ia64 started on Fri Aug 31 20:55:27 EDT 2012 >> ia64 completed on Fri Aug 31 21:13:10 EDT 2012 >> mips started on Fri Aug 31 21:13:10 EDT 2012 mips BERI_DE4_MDROOT kernel failed, check _.mips.BERI_DE4_MDROOT for details mips BERI_SIM_MDROOT kernel failed, check _.mips.BERI_SIM_MDROOT for details >> mips completed on Fri Aug 31 21:55:59 EDT 2012 >> pc98 started on Fri Aug 31 21:55:59 EDT 2012 >> pc98 completed on Fri Aug 31 22:22:36 EDT 2012 >> powerpc started on Fri Aug 31 22:22:36 EDT 2012 >> powerpc completed on Fri Aug 31 22:44:48 EDT 2012 >> sparc64 started on Fri Aug 31 22:44:48 EDT 2012 >> sparc64 completed on Fri Aug 31 23:00:01 EDT 2012 -- >>> make universe completed on Fri Aug 31 23:00:01 EDT 2012 (started Fri Aug 31 17:26:08 EDT 2012) -- Tinderbox failed: mips BERI_DE4_MDROOT kernel failed, check _.mips.BERI_DE4_MDROOT for details mips BERI_SIM_MDROOT kernel failed, check _.mips.BERI_SIM_MDROOT for details > tail _.mips.BERI_DE4_MDROOT ... make: don't know how to make /local/scratch/rnw24/mdroot.img. Stop Hmm, the tinderbox skips the BERI configs: TB --- 2012-09-04 10:38:06 - cd /src/sys/mips/conf TB --- 2012-09-04 10:38:06 - /usr/sbin/config -m BERI_DE4_MDROOT TB --- 2012-09-04 10:38:06 - skipping BERI_DE4_MDROOT kernel TB --- 2012-09-04 10:38:06 - cd /src/sys/mips/conf TB --- 2012-09-04 10:38:06 - /usr/sbin/config -m BERI_DE4_SDROOT TB --- 2012-09-04 10:38:06 - skipping BERI_DE4_SDROOT kernel TB --- 2012-09-04 10:38:06 - cd /src/sys/mips/conf TB --- 2012-09-04 10:38:06 - /usr/sbin/config -m BERI_SIM_MDROOT TB --- 2012-09-04 10:38:06 - skipping BERI_SIM_MDROOT kernel TB --- 2012-09-04 10:38:06 - cd /src/sys/mips/conf TB --- 2012-09-04 10:38:06 - /usr/sbin/config -m BERI_TEMPLATE TB --- 2012-09-04 10:38:06 - skipping BERI_TEMPLATE kernel -- 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: r239679 - head/sys/mips/conf
On Tue, Sep 04, 2012 at 03:17:52PM -0400, John Baldwin wrote: > On Saturday, August 25, 2012 8:02:14 am Robert Watson wrote: > > Author: rwatson > > Date: Sat Aug 25 12:02:13 2012 > > New Revision: 239679 > > URL: http://svn.freebsd.org/changeset/base/239679 > > > > Log: > > Add reference kernel configurations for FreeBSD/beri in simulation, on the > > Terasic DE-4, and Terasic tPad Altera-based boards. > > > > Sponsored by: DARPA, AFRL > > I'm not sure why the tinderbox isn't reporting this, but this breaks 'make > tinderbox' for me due to the hardcoded MFS paths in the _MDROOT configs: Oops, we should remove those from the versions in the base system. The change that causes the nonexistence of the images to be fatal is fairly recent so I suppose it's possible that tinderbox hasn't picked it up. -- Brooks > > -- > >>> make universe started on Fri Aug 31 17:26:08 EDT 2012 > -- > >> amd64 started on Fri Aug 31 17:26:08 EDT 2012 > >> amd64 completed on Fri Aug 31 18:49:29 EDT 2012 > >> arm started on Fri Aug 31 18:49:29 EDT 2012 > >> arm completed on Fri Aug 31 19:27:59 EDT 2012 > >> i386 started on Fri Aug 31 19:27:59 EDT 2012 > >> i386 completed on Fri Aug 31 20:55:27 EDT 2012 > >> ia64 started on Fri Aug 31 20:55:27 EDT 2012 > >> ia64 completed on Fri Aug 31 21:13:10 EDT 2012 > >> mips started on Fri Aug 31 21:13:10 EDT 2012 > mips BERI_DE4_MDROOT kernel failed, check _.mips.BERI_DE4_MDROOT for details > mips BERI_SIM_MDROOT kernel failed, check _.mips.BERI_SIM_MDROOT for details > >> mips completed on Fri Aug 31 21:55:59 EDT 2012 > >> pc98 started on Fri Aug 31 21:55:59 EDT 2012 > >> pc98 completed on Fri Aug 31 22:22:36 EDT 2012 > >> powerpc started on Fri Aug 31 22:22:36 EDT 2012 > >> powerpc completed on Fri Aug 31 22:44:48 EDT 2012 > >> sparc64 started on Fri Aug 31 22:44:48 EDT 2012 > >> sparc64 completed on Fri Aug 31 23:00:01 EDT 2012 > -- > >>> make universe completed on Fri Aug 31 23:00:01 EDT 2012 > (started Fri Aug 31 17:26:08 EDT 2012) > -- > Tinderbox failed: > mips BERI_DE4_MDROOT kernel failed, check _.mips.BERI_DE4_MDROOT for details > mips BERI_SIM_MDROOT kernel failed, check _.mips.BERI_SIM_MDROOT for details > > > tail _.mips.BERI_DE4_MDROOT > ... > make: don't know how to make /local/scratch/rnw24/mdroot.img. Stop > > Hmm, the tinderbox skips the BERI configs: > > TB --- 2012-09-04 10:38:06 - cd /src/sys/mips/conf > TB --- 2012-09-04 10:38:06 - /usr/sbin/config -m BERI_DE4_MDROOT > TB --- 2012-09-04 10:38:06 - skipping BERI_DE4_MDROOT kernel > TB --- 2012-09-04 10:38:06 - cd /src/sys/mips/conf > TB --- 2012-09-04 10:38:06 - /usr/sbin/config -m BERI_DE4_SDROOT > TB --- 2012-09-04 10:38:06 - skipping BERI_DE4_SDROOT kernel > TB --- 2012-09-04 10:38:06 - cd /src/sys/mips/conf > TB --- 2012-09-04 10:38:06 - /usr/sbin/config -m BERI_SIM_MDROOT > TB --- 2012-09-04 10:38:06 - skipping BERI_SIM_MDROOT kernel > TB --- 2012-09-04 10:38:06 - cd /src/sys/mips/conf > TB --- 2012-09-04 10:38:06 - /usr/sbin/config -m BERI_TEMPLATE > TB --- 2012-09-04 10:38:06 - skipping BERI_TEMPLATE kernel > > -- > John Baldwin > pgpbwdMl71W4a.pgp Description: PGP signature
svn commit: r240107 - head/lib/libc/stdlib
Author: des Date: Tue Sep 4 21:40:53 2012 New Revision: 240107 URL: http://svn.freebsd.org/changeset/base/240107 Log: Add a prominent warning about these functions' unsuitability for cryptographic purposes, and recommend using arc4random(3) instead. Modified: head/lib/libc/stdlib/rand.3 head/lib/libc/stdlib/random.3 Modified: head/lib/libc/stdlib/rand.3 == --- head/lib/libc/stdlib/rand.3 Tue Sep 4 21:38:31 2012(r240106) +++ head/lib/libc/stdlib/rand.3 Tue Sep 4 21:40:53 2012(r240107) @@ -55,9 +55,15 @@ .Fn rand_r "unsigned *ctx" .Sh DESCRIPTION .Bf -symbolic +The functions described in this manual page are not cryptographically +secure. +Cryptographic applications should use +.Xr arc4random 3 +instead. +.Ef +.Pp These interfaces are obsoleted by .Xr random 3 . -.Ef .Pp The .Fn rand @@ -88,9 +94,6 @@ The function initializes a seed using the .Xr random 4 random number device which returns good random numbers. -However, the -.Fn rand -function still remains unsuitable for cryptographic use. .Pp The .Fn rand_r @@ -105,8 +108,6 @@ For better generator quality, use .Xr random 3 or .Xr lrand48 3 . -Applications requiring cryptographic quality randomness should use -.Xr arc4random 3 . .Sh SEE ALSO .Xr arc4random 3 , .Xr lrand48 3 , Modified: head/lib/libc/stdlib/random.3 == --- head/lib/libc/stdlib/random.3 Tue Sep 4 21:38:31 2012 (r240106) +++ head/lib/libc/stdlib/random.3 Tue Sep 4 21:40:53 2012 (r240107) @@ -53,6 +53,14 @@ .Ft char * .Fn setstate "char *state" .Sh DESCRIPTION +.Bf -symbolic +The functions described in this manual page are not cryptographically +secure. +Cryptographic applications should use +.Xr arc4random 3 +instead. +.Ef +.Pp The .Fn random function @@ -98,10 +106,8 @@ as the seed. .Pp The .Fn srandomdev -routine initializes a state array using the -.Xr random 4 -random number device which returns good random numbers, -suitable for cryptographic use. +routine initializes a state array using data from +.Xr random 4 . Note that this particular seeding procedure can generate states which are impossible to reproduce by calling @@ -191,6 +197,3 @@ The historical implementation used to ha random sequence did not vary much with the seed. The current implementation employs a better pseudo-random number generator for the initial state calculation. -.Pp -Applications requiring cryptographic quality randomness should use -.Xr arc4random 3 . ___ 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: r240108 - head/etc/rc.d
Author: obrien Date: Tue Sep 4 21:47:09 2012 New Revision: 240108 URL: http://svn.freebsd.org/changeset/base/240108 Log: * Rather than run the same 'ps' command twice, add 'kenv' which often gives machine unique values from the firmware. * The kernel is more likely to be unique than /bin/ls (but no need to stuff many megabytes into /dev/random, so hash it). * Change ordering to give larger variance across reboots to reduce predictability. Modified: head/etc/rc.d/initrandom Modified: head/etc/rc.d/initrandom == --- head/etc/rc.d/initrandomTue Sep 4 21:40:53 2012(r240107) +++ head/etc/rc.d/initrandomTue Sep 4 21:47:09 2012(r240108) @@ -27,9 +27,11 @@ better_than_nothing() # harvesting rate. # Entropy below is not great, but better than nothing. # This unblocks the generator at startup - ( ps -fauxww; sysctl -a; date; df -ib; dmesg; ps -fauxww ) \ + # Note: commands are ordered to cause the most variance across reboots. + ( kenv; dmesg; df -ib; ps -fauxww; date; sysctl -a ) \ + | dd of=/dev/random bs=8k 2>/dev/null + /sbin/sha256 -q `sysctl -n kern.bootfile` \ | dd of=/dev/random bs=8k 2>/dev/null - cat /bin/ls | dd of=/dev/random bs=8k 2>/dev/null } initrandom_start() ___ 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: r239679 - head/sys/mips/conf
John Baldwin writes: > Hmm, the tinderbox skips the BERI configs: It doesn't build the BERI kernels because they're mips64/mips, and it only builds mips/mips. DES -- Dag-Erling Smørgrav - d...@des.no ___ 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: r239679 - head/sys/mips/conf
On Tue, Sep 4, 2012 at 2:50 PM, Dag-Erling Smørgrav wrote: > John Baldwin writes: >> Hmm, the tinderbox skips the BERI configs: > > It doesn't build the BERI kernels because they're mips64/mips, and it > only builds mips/mips. Does it sanitize TARGETS and KERNCONFs properly? -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"
svn commit: r240109 - head/etc/rc.d
Author: des Date: Tue Sep 4 21:56:16 2012 New Revision: 240109 URL: http://svn.freebsd.org/changeset/base/240109 Log: Add a configtest command. Submitted by: gjb@ MFC after:1 week Modified: head/etc/rc.d/sshd Modified: head/etc/rc.d/sshd == --- head/etc/rc.d/sshd Tue Sep 4 21:47:09 2012(r240108) +++ head/etc/rc.d/sshd Tue Sep 4 21:56:16 2012(r240109) @@ -14,8 +14,9 @@ rcvar="sshd_enable" command="/usr/sbin/${name}" keygen_cmd="sshd_keygen" start_precmd="sshd_precmd" +configtest_cmd="sshd_configtest" pidfile="/var/run/${name}.pid" -extra_commands="keygen reload" +extra_commands="configtest keygen reload" timeout=300 @@ -87,6 +88,12 @@ sshd_keygen() ) } +sshd_configtest() +{ + echo "Performing sanity check on ${name} configuration." + eval ${command} ${sshd_flags} -t +} + sshd_precmd() { if [ ! -f /etc/ssh/ssh_host_key -o \ @@ -96,6 +103,7 @@ sshd_precmd() user_reseed run_rc_command keygen fi + sshd_configtest } load_rc_config $name ___ 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: r239679 - head/sys/mips/conf
Garrett Cooper writes: > Dag-Erling Smørgrav writes: > > It doesn't build the BERI kernels because they're mips64/mips, and > > it only builds mips/mips. > Does it sanitize TARGETS and KERNCONFs properly? I have no idea what that even means. DES -- Dag-Erling Smørgrav - d...@des.no ___ 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: r240111 - head/lib/libc/stdlib
Author: des Date: Tue Sep 4 22:03:16 2012 New Revision: 240111 URL: http://svn.freebsd.org/changeset/base/240111 Log: Bump dates. Reminded by: bz@ Modified: head/lib/libc/stdlib/rand.3 head/lib/libc/stdlib/random.3 Modified: head/lib/libc/stdlib/rand.3 == --- head/lib/libc/stdlib/rand.3 Tue Sep 4 21:58:22 2012(r240110) +++ head/lib/libc/stdlib/rand.3 Tue Sep 4 22:03:16 2012(r240111) @@ -32,7 +32,7 @@ .\" @(#)rand.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd October 6, 2010 +.Dd September 4, 2012 .Dt RAND 3 .Os .Sh NAME Modified: head/lib/libc/stdlib/random.3 == --- head/lib/libc/stdlib/random.3 Tue Sep 4 21:58:22 2012 (r240110) +++ head/lib/libc/stdlib/random.3 Tue Sep 4 22:03:16 2012 (r240111) @@ -28,7 +28,7 @@ .\" @(#)random.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd September 4, 2012 .Dt RANDOM 3 .Os .Sh NAME ___ 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: r240112 - head/sys/net
Author: melifaro Date: Tue Sep 4 22:17:33 2012 New Revision: 240112 URL: http://svn.freebsd.org/changeset/base/240112 Log: Fix the build broken by r240099. Hide link_pfil_hook under _KERNEL macro. MFC after:3 weeks Modified: head/sys/net/if_var.h Modified: head/sys/net/if_var.h == --- head/sys/net/if_var.h Tue Sep 4 22:03:16 2012(r240111) +++ head/sys/net/if_var.h Tue Sep 4 22:17:33 2012(r240112) @@ -99,8 +99,10 @@ TAILQ_HEAD(ifaddrhead, ifaddr); /* insta TAILQ_HEAD(ifmultihead, ifmultiaddr); TAILQ_HEAD(ifgrouphead, ifg_group); +#ifdef _KERNEL VNET_DECLARE(struct pfil_head, link_pfil_hook);/* packet filter hooks */ #defineV_link_pfil_hookVNET(link_pfil_hook) +#endif /* _KERNEL */ /* * Structure defining a queue for a network 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"
svn commit: r240113 - head/sys/vm
Author: des Date: Tue Sep 4 22:19:33 2012 New Revision: 240113 URL: http://svn.freebsd.org/changeset/base/240113 Log: No memory barrier is required. This was pointed out by kib@ a while ago, but I got distracted by other matters. (for real this time) Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cTue Sep 4 22:17:33 2012(r240112) +++ head/sys/vm/swap_pager.cTue Sep 4 22:19:33 2012(r240113) @@ -1848,7 +1848,7 @@ retry: mtx_unlock(&swhash_mtx); VM_OBJECT_UNLOCK(object); if (uma_zone_exhausted(swap_zone)) { - if (atomic_cmpset_rel_int(&exhausted, 0, 1)) + if (atomic_cmpset_int(&exhausted, 0, 1)) printf("swap zone exhausted, " "increase kern.maxswzone\n"); vm_pageout_oom(VM_OOM_SWAPZ); @@ -1859,7 +1859,7 @@ retry: goto retry; } - if (atomic_cmpset_rel_int(&exhausted, 1, 0)) + if (atomic_cmpset_int(&exhausted, 1, 0)) printf("swap zone ok\n"); swap->swb_hnext = 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: r240114 - head/sys/netinet
Author: tuexen Date: Tue Sep 4 22:40:49 2012 New Revision: 240114 URL: http://svn.freebsd.org/changeset/base/240114 Log: Whitespace change. MFC after: 3 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c == --- head/sys/netinet/sctputil.c Tue Sep 4 22:19:33 2012(r240113) +++ head/sys/netinet/sctputil.c Tue Sep 4 22:40:49 2012(r240114) @@ -2385,7 +2385,7 @@ sctp_calculate_rto(struct sctp_tcb *stcb timevalsub(&now, old); /* store the current RTT in us */ net->rtt = (uint64_t) 100 *(uint64_t) now.tv_sec + -(uint64_t) now.tv_usec; + (uint64_t) now.tv_usec; /* computer rtt in ms */ rtt = net->rtt / 1000; ___ 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: r240115 - head/sys/netinet
Author: tuexen Date: Tue Sep 4 22:45:00 2012 New Revision: 240115 URL: http://svn.freebsd.org/changeset/base/240115 Log: Use the consistenly the size of a variable. This helps to keep the code simpler for the userland implementation. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Tue Sep 4 22:40:49 2012 (r240114) +++ head/sys/netinet/sctp_output.c Tue Sep 4 22:45:00 2012 (r240115) @@ -3371,7 +3371,7 @@ sctp_find_cmsg(int c_type, void *data, s return (found); } m_copydata(control, at, sizeof(cmh), (caddr_t)&cmh); - if (cmh.cmsg_len < CMSG_ALIGN(sizeof(struct cmsghdr))) { + if (cmh.cmsg_len < CMSG_ALIGN(sizeof(cmh))) { /* We dont't have a complete CMSG header. */ return (found); } @@ -3386,11 +3386,11 @@ sctp_find_cmsg(int c_type, void *data, s (cmh.cmsg_type == SCTP_PRINFO) || (cmh.cmsg_type == SCTP_AUTHINFO) { if (c_type == cmh.cmsg_type) { - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < cpsize) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < cpsize) { return (found); } /* It is exactly what we want. Copy it out. */ - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), cpsize, (caddr_t)data); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), cpsize, (caddr_t)data); return (1); } else { struct sctp_sndrcvinfo *sndrcvinfo; @@ -3404,10 +3404,10 @@ sctp_find_cmsg(int c_type, void *data, s } switch (cmh.cmsg_type) { case SCTP_SNDINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < sizeof(struct sctp_sndinfo)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_sndinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct sctp_sndinfo), (caddr_t)&sndinfo); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_sndinfo), (caddr_t)&sndinfo); sndrcvinfo->sinfo_stream = sndinfo.snd_sid; sndrcvinfo->sinfo_flags = sndinfo.snd_flags; sndrcvinfo->sinfo_ppid = sndinfo.snd_ppid; @@ -3415,18 +3415,18 @@ sctp_find_cmsg(int c_type, void *data, s sndrcvinfo->sinfo_assoc_id = sndinfo.snd_assoc_id; break; case SCTP_PRINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < sizeof(struct sctp_prinfo)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_prinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct sctp_prinfo), (caddr_t)&prinfo); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_prinfo), (caddr_t)&prinfo); sndrcvinfo->sinfo_timetolive = prinfo.pr_value; sndrcvinfo->sinfo_flags |= prinfo.pr_policy; break; case SCTP_AUTHINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) < sizeof(struct sctp_authinfo)) { + if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_authinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct sctp_authinfo), (caddr_t)&authinfo); + m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_authinfo), (caddr_t)&authin
svn commit: r240118 - in head/sys/dev/usb: . serial
Author: gavin Date: Tue Sep 4 23:13:24 2012 New Revision: 240118 URL: http://svn.freebsd.org/changeset/base/240118 Log: Support another uchcom(4) device. MFC after:1 week Modified: head/sys/dev/usb/serial/uchcom.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/uchcom.c == --- head/sys/dev/usb/serial/uchcom.cTue Sep 4 23:08:52 2012 (r240117) +++ head/sys/dev/usb/serial/uchcom.cTue Sep 4 23:13:24 2012 (r240118) @@ -207,6 +207,7 @@ static const struct uchcom_divider_recor static const STRUCT_USB_HOST_ID uchcom_devs[] = { {USB_VPI(USB_VENDOR_WCH, USB_PRODUCT_WCH_CH341SER, 0)}, {USB_VPI(USB_VENDOR_WCH2, USB_PRODUCT_WCH2_CH341SER, 0)}, + {USB_VPI(USB_VENDOR_WCH2, USB_PRODUCT_WCH2_CH341SER_2, 0)}, }; /* protypes */ Modified: head/sys/dev/usb/usbdevs == --- head/sys/dev/usb/usbdevsTue Sep 4 23:08:52 2012(r240117) +++ head/sys/dev/usb/usbdevsTue Sep 4 23:13:24 2012(r240118) @@ -4163,6 +4163,7 @@ product WAVESENSE JAZZ0x Jazz bloo /* WCH products */ product WCH CH341SER 0x5523 CH341/CH340 USB-Serial Bridge product WCH2 DUMMY 0x Dummy product +product WCH2 CH341SER_20x5523 CH341/CH340 USB-Serial Bridge product WCH2 CH341SER 0x7523 CH341/CH340 USB-Serial Bridge product WCH2 U2M 0X752d CH345 USB2.0-MIDI ___ 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: r240119 - head/sys/kern
Author: ray Date: Tue Sep 4 23:16:55 2012 New Revision: 240119 URL: http://svn.freebsd.org/changeset/base/240119 Log: Style fixes. Suggested by: mdf Approved by: adrian (menthor) Modified: head/sys/kern/subr_hints.c Modified: head/sys/kern/subr_hints.c == --- head/sys/kern/subr_hints.c Tue Sep 4 23:13:24 2012(r240118) +++ head/sys/kern/subr_hints.c Tue Sep 4 23:16:55 2012(r240119) @@ -31,8 +31,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include +#include #include /* @@ -52,9 +52,9 @@ static char *hintp; static int sysctl_hintmode(SYSCTL_HANDLER_ARGS) { - int error, i, from_kenv, value, eqidx; const char *cp; char *line, *eq; + int eqidx, error, from_kenv, i, value; from_kenv = 0; cp = kern_envp; @@ -62,7 +62,7 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) /* Fetch candidate for new hintmode value */ error = sysctl_handle_int(oidp, &value, 0, req); - if (error || !req->newptr) + if (error || req->newptr == NULL) return (error); if (value != 2) @@ -73,8 +73,11 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) switch (hintmode) { case 0: if (dynamic_kenv) { - /* Already here */ - hintmode = value; /* XXX: Need we switch or not ? */ + /* +* Already here. But assign hintmode to 2, to not +* check it in the future. +*/ + hintmode = 2; return (0); } from_kenv = 1; @@ -98,7 +101,7 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) continue; } eq = strchr(cp, '='); - if (!eq) + if (eq == NULL) /* Bad hint value */ continue; eqidx = eq - cp; ___ 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: r240120 - head/contrib/atf
Author: marcel Date: Tue Sep 4 23:16:58 2012 New Revision: 240120 URL: http://svn.freebsd.org/changeset/base/240120 Log: Merge ATF 0.16 from vendor/atf/dist. Provenance: http://code.google.com/p/kyua Discussed with: gibbs, gnn, keramida, mdf, mlaier, Discussed with: Garrett Cooper Added: head/contrib/atf/ - copied from r240117, vendor/atf/dist/ ___ 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: r240122 - in head/contrib/atf: . atf-c
Author: marcel Date: Tue Sep 4 23:27:07 2012 New Revision: 240122 URL: http://svn.freebsd.org/changeset/base/240122 Log: Add headers created by running configure. Added: head/contrib/atf/atf-c/defs.h head/contrib/atf/bconfig.h Added: head/contrib/atf/atf-c/defs.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/atf/atf-c/defs.h Tue Sep 4 23:27:07 2012 (r240122) @@ -0,0 +1,37 @@ +/* + * Automated Testing Framework (atf) + * + * Copyright (c) 2008 The NetBSD Foundation, Inc. + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#if !defined(ATF_C_DEFS_H) +#define ATF_C_DEFS_H + +#define ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(a, b) __attribute__((__format__(__printf__, a, b))) +#define ATF_DEFS_ATTRIBUTE_NORETURN __attribute__((__noreturn__)) +#define ATF_DEFS_ATTRIBUTE_UNUSED __attribute__((__unused__)) + +#endif /* !defined(ATF_C_DEFS_H) */ Added: head/contrib/atf/bconfig.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/atf/bconfig.h Tue Sep 4 23:27:07 2012(r240122) @@ -0,0 +1,114 @@ +/* bconfig.h. Generated from bconfig.h.in by configure. */ +/* bconfig.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if basename takes a constant pointer */ +#define HAVE_CONST_BASENAME 1 + +/* Define to 1 if dirname takes a constant pointer */ +#define HAVE_CONST_DIRNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if getcwd(NULL, 0) works */ +#define HAVE_GETCWD_DYN 1 + +/* Define to 1 if getopt allows a + sign for POSIX behavior */ +/* #undef HAVE_GNU_GETOPT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if getopt has optreset */ +/* #undef HAVE_OPTRESET */ + +/* Define to 1 if you have the `putenv' function. */ +#define HAVE_PUTENV 1 + +/* Define to 1 if putenv is in std */ +/* #undef HAVE_PUTENV_IN_STD */ + +/* Define to 1 if you have the `setenv' function. */ +#define HAVE_SETENV 1 + +/* Define to 1 if setenv is in std */ +/* #undef HAVE_SETENV_IN_STD */ + +/* Define to 1 if snprintf is in std */ +/* #undef HAVE_SNPRINTF_IN_STD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unmount' function. */ +#define HAVE_UNMOUNT 1 + +/* Define to 1 if you have the `unsetenv' function. */ +#define HAVE_UNSETENV 1 + +/* Define to 1 if unsetenv is in std */ +/* #undef HAVE_UNSETENV_IN_STD */ + +/* Define to 1 if vsnprintf is in std */ +/* #undef HAVE_VSNPRINTF_IN_STD */ + +/* Define to the last valid signal number */ +#define LAST_SIGNO 128 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Name of package */ +#define PACKAGE "atf" + +/* Define to the address where bug reports for this package
Re: svn commit: r239679 - head/sys/mips/conf
On Tue, Sep 4, 2012 at 3:01 PM, Dag-Erling Smørgrav wrote: > Garrett Cooper writes: >> Dag-Erling Smørgrav writes: >> > It doesn't build the BERI kernels because they're mips64/mips, and >> > it only builds mips/mips. >> Does it sanitize TARGETS and KERNCONFs properly? > > I have no idea what that even means. Answering myself, it should if TARGET isn't explicitly defined to something that the conversion logic wouldn't create collisions for (from .../Makefile in stable/9): 405 KERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 406 find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \ 407 ! -name DEFAULTS ! -name NOTES 408 universe_kernconfs: 409 .for kernel in ${KERNCONFS} 410 TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \ 411 config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \ 412 grep -v WARNING: | cut -f 2 413 .if empty(TARGET_ARCH_${kernel}) 414 .error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old." 415 .endif In particular TARGETS_ARCHS=mips64:mips might not work in all cases, right? $ make -VKERNCONFS TARGET=mips TARGET_ARCH=mips64 tinderbox ADM5120 ALCHEMY AP91 AP93 AP94 AP96 AR71XX_BASE AR724X_BASE AR91XX_BASE BERI_DE4_MDROOT BERI_DE4_SDROOT BERI_SIM_MDROOT BERI_TEMPLATE DIR-825 GXEMUL IDT MALTA MALTA64 OCTEON1 PB47 PB92 QEMU ROUTERSTATION ROUTERSTATION_MFS RSPRO RSPRO_MFS RSPRO_STANDALONE RT305X SENTRY5 SWARM SWARM64 SWARM64_SMP SWARM_SMP TP-WN1043ND XLP XLP64 XLPN32 XLR XLR64 XLRN32 $ make -VKERNCONFS TARGET=mips TARGET_ARCH=mips tinderbox ADM5120 ALCHEMY AP91 AP93 AP94 AP96 AR71XX_BASE AR724X_BASE AR91XX_BASE BERI_DE4_MDROOT BERI_DE4_SDROOT BERI_SIM_MDROOT BERI_TEMPLATE DIR-825 GXEMUL IDT MALTA MALTA64 OCTEON1 PB47 PB92 QEMU ROUTERSTATION ROUTERSTATION_MFS RSPRO RSPRO_MFS RSPRO_STANDALONE RT305X SENTRY5 SWARM SWARM64 SWARM64_SMP SWARM_SMP TP-WN1043ND XLP XLP64 XLPN32 XLR XLR64 XLRN32 You have to explicitly set the machine directive in the KERNCONF in order for it to only compile on one TARGET_ARCH: $ egrep -r 'machine.*64' sys/mips/conf/ sys/mips/conf/XLP64:machine mips mips64 sys/mips/conf/BERI_TEMPLATE:machine mips mips64 sys/mips/conf/GXEMUL:machinemips mips64 sys/mips/conf/XLR64:machine mips mips64 sys/mips/conf/SWARM64:machine mips mips64 sys/mips/conf/SWARM64_SMP:machine mips mips64 sys/mips/conf/MALTA64:machine mips mips64el # Malta supports both, so it isn't in std.malta Thanks! -Garrett PS I think brooks@ is aware of what needs to be fixed and is working on the solution. ___ 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: r239679 - head/sys/mips/conf
Garrett Cooper writes: > Dag-Erling Smørgrav writes: > > Garrett Cooper writes: > > > Does it sanitize TARGETS and KERNCONFs properly? > > I have no idea what that even means. > Answering myself, it should if TARGET isn't explicitly defined to > something that the conversion logic wouldn't create collisions for > [...] I still have no idea what you mean. DES -- Dag-Erling Smørgrav - d...@des.no ___ 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: r239679 - head/sys/mips/conf
On Tue, Sep 4, 2012 at 4:39 PM, Dag-Erling Smørgrav wrote: > Garrett Cooper writes: >> Dag-Erling Smørgrav writes: >> > Garrett Cooper writes: >> > > Does it sanitize TARGETS and KERNCONFs properly? >> > I have no idea what that even means. >> Answering myself, it should if TARGET isn't explicitly defined to >> something that the conversion logic wouldn't create collisions for >> [...] > > I still have no idea what you mean. tl;dr: I [very briefly] thought someone could set KERNCONF in /etc/src.conf or on the command line and it would screw things up, but I quickly realized that assumption was incorrect. 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: r239679 - head/sys/mips/conf
Garrett Cooper writes: > I [very briefly] thought someone could set KERNCONF in /etc/src.conf > or on the command line and it would screw things up, but I quickly > realized that assumption was incorrect. The tinderbox points both __MAKE_CONF and SRCCONF at /dev/null anyway. DES -- Dag-Erling Smørgrav - d...@des.no ___ 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: r240119 - head/sys/kern
On Tue, 4 Sep 2012, Aleksandr Rybalko wrote: Log: Style fixes. Suggested by: mdf Approved by: adrian (menthor) The following style bugs remain. (The density of style bugs is low enough for them to be easy to fix.) Modified: head/sys/kern/subr_hints.c == --- head/sys/kern/subr_hints.c Tue Sep 4 23:13:24 2012(r240118) +++ head/sys/kern/subr_hints.c Tue Sep 4 23:16:55 2012(r240119) @@ -31,8 +31,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include +#include Sorting this correctly would be an unrelated fix (it is a prerequisite for most headers, since almost any header may use KASSERT()). #include Sorting this correctly woruld be an unrelated fix. /* @@ -52,9 +52,9 @@ static char *hintp; Sorting and indenting the static variables would be an unrelated fix. static int sysctl_hintmode(SYSCTL_HANDLER_ARGS) A bug in svn diff is visible. The variable declaration is worse than useless as a header for this block of code. { - int error, i, from_kenv, value, eqidx; const char *cp; char *line, *eq; + int eqidx, error, from_kenv, i, value; from_kenv = 0; cp = kern_envp; @@ -62,7 +62,7 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) /* Fetch candidate for new hintmode value */ Comments (except possibly ones at the right of code) should be real sentences. This one is missing a ".", unlike all older comments (not at the right of code) in this file. error = sysctl_handle_int(oidp, &value, 0, req); - if (error || !req->newptr) + if (error || req->newptr == NULL) return (error); if (value != 2) This still has a boolean test for the non-boolean `error'. Now the older code sets a bad example in all cases where `error' is tested. @@ -73,8 +73,11 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) switch (hintmode) { case 0: if (dynamic_kenv) { - /* Already here */ - hintmode = value; /* XXX: Need we switch or not ? */ + /* +* Already here. But assign hintmode to 2, to not +* check it in the future. +*/ Sentence breaks should be 2 spaces, as in all older comments in this file, starting as usual with the copyright. But outside of the copyright, the style bug of single-space sentence breaks was avoided in this file mostly by using the larger style bug of using a new line for most new sentences. + hintmode = 2; return (0); } from_kenv = 1; @@ -98,7 +101,7 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS) continue; } eq = strchr(cp, '='); - if (!eq) + if (eq == NULL) /* Bad hint value */ continue; eqidx = eq - cp; 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: r240026 - head/sys/kern
On Mon, 3 Sep 2012, Andrey Zonov wrote: On 9/3/12 1:20 AM, Garrett Cooper wrote: On Sun, Sep 2, 2012 at 2:16 PM, Garrett Cooper wrote: On Sun, Sep 2, 2012 at 10:39 AM, Andrey Zonov wrote: Author: zont Date: Sun Sep 2 17:39:02 2012 New Revision: 240026 URL: http://svn.freebsd.org/changeset/base/240026 Log: - Make kern.maxtsiz, kern.dfldsiz, kern.maxdsiz, kern.dflssiz, kern.maxssiz and kern.sgrowsiz sysctls writable. Approved by: kib (mentor) Modified: head/sys/kern/subr_param.c ... Please add some basic sanity checking to init_param1 -- there's absolutely nothing preventing me from passing in values <= 0 or other Isn't that an old feature, not affected by this commit? init_param1() runs long before sysctl(8) can run to use the new feature, so it is not affected by this commit. And it is a feature, not a bug, for it to use the values passed in -- the user is the sysadmin, who never makes misteaks and knows what is sane better than init_param1(). Correction: values == 0 with little effort (missed the part where it was using TUNABLE_ULONG_FETCH). Hopefully it only uses TUNABLE_ULONG_FETCH() for u_longs. It starts by using TUNABLE_INT_FIX() for hz. hz == -1 is in-band but is abused to check for the tunable not being passed in, though hz = -1 can be passed in. Zero, and other negative values of hz are silently accepted. This is a feature (unless you want kernel bloat), since it is too hard for init_param() to tell what a sane value is. To do so, it would have to know all about the subsystems that use the variables, and the interactions of the subsystems with each other and with the system's resources, since sane values of the variables depend on the other variables and the system's resources. For hz, it happens to be easy to know that hz = 0 is insane. hz = 0 will in fact be detected and reported immediately as a fatal trap (division by 0). hz < 0 is just insane. Large values of hz may or may not be insane, depending on timecounter and other system capabilities (except hz > 100 is obviously insane, since the same immediate division that gives the fatal trap when hz = 0 also gives tick = 0 when hz > 100, and tick = 0 can't work). Next, init_param1() uses some TUNABLE_LONG_FETCH()es for variables not touched in this commit. Most of the older parameters use plain int or long. There is sanity checking only for the newer tunable ngroups_max. This mainly breaks the ability of the user to create a non-POSIX system for testing. This sanity checking has a comment about not allowing values greater than INT_MAX - 1. This comment is wrong and not just irrelevant. TUNABLE_INT_FETCH() automatically disallows values larger than INT_MAX. But it allows a value of INT_MAX, and the code does nothing extra to disallow that. This is probably related to old off-by-1 bugs near {NGROUPS_MAX} (it is unclear if the effective gid is "supplementary"). Hopefully we now count the extra 1 in {NGROUPS_MAX}, so never need to add 1 to {NGROUPS_MAX}. You could get negative values though if you overflow the value passed in -- in part because the getenv* functions in kern_environment.c don't check for/handle overflow gracefully .. I had a patch out for this a while ago that never made it in. The unsigned long variables mainly break any possibility of detecting overflow, since overflow and negative values can't really happen for unsigned longs. But it is a feature for init_param1() to not limit values to say LONG_MAX, since such a limit is almost useless for preventing overflow when the variables are combined, and limits small enough to prevent overflow for all possible reasonable combinations of the variables would probably prevent useful combinations of the variables (when some of the variables can be larger than usual provided others are smaller than usual). The limits related to packing of kva are most interesting here -- even adding up the sizes of the pieces is not easy. The above discussion of {NGROUPS_MAX} shows that even adding 1 is not easy. non-performant (non-multiple of PAGE_SIZE, whacky ratios, etc) values. Since we have to trust users to pack kva delicately (if they want to change the defaults at all), why not trust them to know PAGE_SIZE? I thought of sanity checking here, but there weren't for tunables and I did't want to add any "magic numbers" in this code. I don't think that we should check for multiple of PAGE_SIZE, may be only for sgrowsiz and even not checking, just rounding up. Indeed. It is possible for sysctl() to do more sanity checking, but even less useful, since doing so mainly breaks testing of the limits. If you have those "magic numbers" I would love to add it. The limits can't be static magic numbers, since they (should) depend on things like kva size and packing which depend on other limits. Bruce ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-s
svn commit: r240126 - in head/sys: amd64/amd64 i386/i386 i386/xen mips/mips
Author: alc Date: Wed Sep 5 06:02:54 2012 New Revision: 240126 URL: http://svn.freebsd.org/changeset/base/240126 Log: Rename {_,}pmap_unwire_pte_hold() to {_,}pmap_unwire_ptp() and update the comment describing them. Both the function names and the comment had grown stale. Quite some time has passed since these pmap implementations last used the page's hold count to track the number of valid mapping within a page table page. Also, returning TRUE from pmap_unwire_ptp() rather than _pmap_unwire_ptp() eliminates a few instructions from callers like pmap_enter_quick_locked() where pmap_unwire_ptp()'s return value is used directly by a conditional statement. Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c head/sys/mips/mips/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Wed Sep 5 04:50:20 2012(r240125) +++ head/sys/amd64/amd64/pmap.c Wed Sep 5 06:02:54 2012(r240126) @@ -323,8 +323,8 @@ static vm_page_t pmap_allocpde(pmap_t pm static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, struct rwlock **lockp); -static int _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, -vm_page_t* free); +static void _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, +vm_page_t *free); static int pmap_unuse_pt(pmap_t, vm_offset_t, pd_entry_t, vm_page_t *); static vm_offset_t pmap_kmem_choose(vm_offset_t addr); @@ -1557,23 +1557,25 @@ pmap_remove_pt_page(pmap_t pmap, vm_page } /* - * This routine unholds page table pages, and if the hold count - * drops to zero, then it decrements the wire count. + * Decrements a page table page's wire count, which is used to record the + * number of valid page table entries within the page. If the wire count + * drops to zero, then the page table page is unmapped. Returns TRUE if the + * page table page was unmapped and FALSE otherwise. */ -static __inline int -pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t *free) +static inline boolean_t +pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t *free) { --m->wire_count; - if (m->wire_count == 0) - return (_pmap_unwire_pte_hold(pmap, va, m, free)); - else - return (0); + if (m->wire_count == 0) { + _pmap_unwire_ptp(pmap, va, m, free); + return (TRUE); + } else + return (FALSE); } -static int -_pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m, -vm_page_t *free) +static void +_pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t *free) { PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -1602,14 +1604,14 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_of vm_page_t pdpg; pdpg = PHYS_TO_VM_PAGE(*pmap_pdpe(pmap, va) & PG_FRAME); - pmap_unwire_pte_hold(pmap, va, pdpg, free); + pmap_unwire_ptp(pmap, va, pdpg, free); } if (m->pindex >= NUPDE && m->pindex < (NUPDE + NUPDPE)) { /* We just released a PD, unhold the matching PDP */ vm_page_t pdppg; pdppg = PHYS_TO_VM_PAGE(*pmap_pml4e(pmap, va) & PG_FRAME); - pmap_unwire_pte_hold(pmap, va, pdppg, free); + pmap_unwire_ptp(pmap, va, pdppg, free); } /* @@ -1624,8 +1626,6 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_of * *ALL* TLB shootdown is done */ pmap_add_delayed_free_list(m, free, TRUE); - - return (1); } /* @@ -1641,7 +1641,7 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t v return (0); KASSERT(ptepde != 0, ("pmap_unuse_pt: ptepde != 0")); mpte = PHYS_TO_VM_PAGE(ptepde & PG_FRAME); - return (pmap_unwire_pte_hold(pmap, va, mpte, free)); + return (pmap_unwire_ptp(pmap, va, mpte, free)); } void @@ -3666,7 +3666,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t if (!pmap_pv_insert_pde(pmap, va, VM_PAGE_TO_PHYS(m), lockp)) { free = NULL; - if (pmap_unwire_pte_hold(pmap, va, mpde, &free)) { + if (pmap_unwire_ptp(pmap, va, mpde, &free)) { pmap_invalidate_page(pmap, va); pmap_free_zero_pages(free); } @@ -3842,7 +3842,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ !pmap_try_insert_pv_entry(pmap, va, m, lockp)) { if (mpte != NULL) { free = NULL; - if (pmap_unwire_pte_hold(pmap, va, mpte, &free)) { + if (pmap_unwire_ptp(pmap, va, mpte, &free)) { pmap_invalidate_page(pmap, va); pm
Re: svn commit: r239587 - head/sys/kern
on 22/08/2012 23:02 John Baldwin said the following: > Author: jhb > Date: Wed Aug 22 20:02:42 2012 > New Revision: 239587 > URL: http://svn.freebsd.org/changeset/base/239587 > > Log: > Assert that system calls do not leak a pinned thread (via sched_pin()) to > userland. > > Modified: > head/sys/kern/subr_syscall.c > > Modified: head/sys/kern/subr_syscall.c > == > --- head/sys/kern/subr_syscall.c Wed Aug 22 20:01:57 2012 > (r239586) > +++ head/sys/kern/subr_syscall.c Wed Aug 22 20:02:42 2012 > (r239587) > @@ -188,6 +188,9 @@ syscallret(struct thread *td, int error, I wonder if userret() would be a better place for this assert as well as the asserts that were already there. userret seems to cover more cases and includes the syscallret case. > KASSERT((td->td_pflags & TDP_NOSLEEPING) == 0, > ("System call %s returning with sleep disabled", >syscallname(p, sa->code))); > + KASSERT(td->td_pinned == 0, > + ("System call %s returning with pinned thread", > + syscallname(p, sa->code))); > > /* >* Handle reschedule and other end-of-syscall issues > -- Andriy Gapon ___ 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: r240128 - head/sys/dev/bxe
Author: silby Date: Wed Sep 5 06:51:28 2012 New Revision: 240128 URL: http://svn.freebsd.org/changeset/base/240128 Log: Only stop the BXE controller if it was first started. Stopping an uninitialized controller can cause IPMI bus errors on some systems. Reviewed by: yongari Obtained from:McAfee, Inc. MFC after:2 weeks Modified: head/sys/dev/bxe/if_bxe.c Modified: head/sys/dev/bxe/if_bxe.c == --- head/sys/dev/bxe/if_bxe.c Wed Sep 5 06:15:15 2012(r240127) +++ head/sys/dev/bxe/if_bxe.c Wed Sep 5 06:51:28 2012(r240128) @@ -3554,8 +3554,14 @@ bxe_shutdown(device_t dev) sc = device_get_softc(dev); DBENTER(BXE_INFO_LOAD | BXE_INFO_RESET | BXE_INFO_UNLOAD); + /* Stop the controller, but only if it was ever started. +* Stopping an uninitialized controller can cause +* IPMI bus errors on some systems. +*/ BXE_CORE_LOCK(sc); - bxe_stop_locked(sc, UNLOAD_NORMAL); + if (sc->state != BXE_STATE_CLOSED) { + bxe_stop_locked(sc, UNLOAD_NORMAL); + } BXE_CORE_UNLOCK(sc); DBEXIT(BXE_INFO_LOAD | BXE_INFO_RESET | BXE_INFO_UNLOAD); ___ 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"