Re: svn commit: r214118 - in head: sbin/geom/class/eli sys/geom/eli
Great work. Might be worth adding the geli commands to /etc/rc.suspend /etc/rc.resume. You could do something that requires the minimum user configuration, like: --- geli list 21 /dev/null if [ $? -eq 0 ]; then geli suspend -a fi --- Regards, -- Rui Paulo ___ 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: r214124 - head/usr.sbin/lpr/lpr
Author: edwin Date: Thu Oct 21 06:52:14 2010 New Revision: 214124 URL: http://svn.freebsd.org/changeset/base/214124 Log: Fix printing of files located on ZFS filesystem with an st_dev or st_ino larger than 2**31. From the PR: Printing from a ZFS filesystem using 'lp' fails and returns an email reporting Your printer job was not printed because it was not linked to the original file. In order to protect against files being switched when files are printed using 'lp' or 'lpr -s', the st_dev and st_ino values for the original file are saved by lpr and verified by lpd before the file is printed. Unfortunately, lpr prints both values using '%d' (although both fields are unsigned) and lpd(8) assumes a string of decimal digits. ZFS (at least) generates st_dev values greater than 2^31-1, resulting in negative values being printed - which lpd cannot parse, leading it to report that the file has been switched. A similar problem would occur with large inode numbers. How-To-Repeat: Find a file with either st_dev or st_ino greater than 2^31-1 (stat(1) will report both numbers) and print it with 'lpq -s'. This should generate an email reporting that the file could not be printed because it was not linked to the original file PR: bin/151567 Submitted by: Peter Jeremy peter.jer...@alcatel-lucent.com MFC after:1 week Modified: head/usr.sbin/lpr/lpr/lpr.c Modified: head/usr.sbin/lpr/lpr/lpr.c == --- head/usr.sbin/lpr/lpr/lpr.c Thu Oct 21 01:13:41 2010(r214123) +++ head/usr.sbin/lpr/lpr/lpr.c Thu Oct 21 06:52:14 2010(r214124) @@ -386,7 +386,7 @@ main(int argc, char *argv[]) continue; /* file unreasonable */ if (sflag (cp = linked(arg)) != NULL) { - (void) snprintf(buf, sizeof(buf), %d %d, statb.st_dev, + (void) snprintf(buf, sizeof(buf), %u %u, statb.st_dev, statb.st_ino); card('S', buf); if (format == 'p') ___ 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: r214118 - in head: sbin/geom/class/eli sys/geom/eli
On Thu, Oct 21, 2010 at 07:25:53AM +0100, Rui Paulo wrote: Great work. Might be worth adding the geli commands to /etc/rc.suspend /etc/rc.resume. You could do something that requires the minimum user configuration, like: --- geli list 21 /dev/null if [ $? -eq 0 ]; then geli suspend -a fi Well, this is not always safe. As I mentioned in the commit message this will cause deadlock if geli(8) command is stored on encrypted file system (you won't be able to resume). Good example of such situation is when you encrypt even your root file system. -- Pawel Jakub Dawidek http://www.wheelsystems.com p...@freebsd.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! pgpMq0CrEoNBR.pgp Description: PGP signature
svn commit: r214125 - head/sys/kern
Author: delphij Date: Thu Oct 21 08:57:25 2010 New Revision: 214125 URL: http://svn.freebsd.org/changeset/base/214125 Log: In syscall_module_handler(): all switch branches return, remove unreached code as pointed out in a Chinese forum [1]. [1] http://www.freebsdchina.org/forum/viewtopic.php?t=50619 Pointed out by: btw616 btw s qq com MFC after:1 month Modified: head/sys/kern/kern_syscalls.c Modified: head/sys/kern/kern_syscalls.c == --- head/sys/kern/kern_syscalls.c Thu Oct 21 06:52:14 2010 (r214124) +++ head/sys/kern/kern_syscalls.c Thu Oct 21 08:57:25 2010 (r214125) @@ -184,10 +184,7 @@ syscall_module_handler(struct module *mo return EOPNOTSUPP; } - if (data-chainevh) - return (data-chainevh(mod, what, data-chainarg)); - else - return (0); + /* NOTREACHED */ } int ___ 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: r214118 - in head: sbin/geom/class/eli sys/geom/eli
On Thu, Oct 21, 2010 at 1:55 AM, Pawel Jakub Dawidek p...@freebsd.org wrote: On Thu, Oct 21, 2010 at 07:25:53AM +0100, Rui Paulo wrote: Great work. Might be worth adding the geli commands to /etc/rc.suspend /etc/rc.resume. You could do something that requires the minimum user configuration, like: --- geli list 21 /dev/null if [ $? -eq 0 ]; then geli suspend -a fi Well, this is not always safe. As I mentioned in the commit message this will cause deadlock if geli(8) command is stored on encrypted file system (you won't be able to resume). Good example of such situation is when you encrypt even your root file system. I think it's pretty safe to say that if the user understands this limitation that they can add the relevant code to the end of rc.resume. Maybe rc.{resume,suspend}.local script hooks should be added for user-defined commands like this? Thanks, -Garrett ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r214128 - head/lib/libgeom
Author: pjd Date: Thu Oct 21 10:36:36 2010 New Revision: 214128 URL: http://svn.freebsd.org/changeset/base/214128 Log: - Simplify gctl_get_handle() a bit. - Prefer 'unsigned int' over 'u_int' in userland code. Modified: head/lib/libgeom/geom_ctl.c Modified: head/lib/libgeom/geom_ctl.c == --- head/lib/libgeom/geom_ctl.c Thu Oct 21 10:13:52 2010(r214127) +++ head/lib/libgeom/geom_ctl.c Thu Oct 21 10:36:36 2010(r214128) @@ -54,7 +54,7 @@ static char nomemmsg[] = Could not allo void gctl_dump(struct gctl_req *req, FILE *f) { - u_int i; + unsigned int i; int j; struct gctl_req_arg *ap; @@ -126,10 +126,8 @@ gctl_check_alloc(struct gctl_req *req, v struct gctl_req * gctl_get_handle(void) { - struct gctl_req *rp; - rp = calloc(1, sizeof *rp); - return (rp); + return (calloc(1, sizeof(struct gctl_req))); } /* @@ -233,7 +231,7 @@ gctl_issue(struct gctl_req *req) void gctl_free(struct gctl_req *req) { - u_int i; + unsigned int i; if (req == NULL) return; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r214129 - head/lib/libgeom
Author: pjd Date: Thu Oct 21 10:38:14 2010 New Revision: 214129 URL: http://svn.freebsd.org/changeset/base/214129 Log: Remove code duplication by introducing static gctl_param_add() function which is now used by both gctl_ro_param() and gctl_rw_param(). Modified: head/lib/libgeom/geom_ctl.c Modified: head/lib/libgeom/geom_ctl.c == --- head/lib/libgeom/geom_ctl.c Thu Oct 21 10:36:36 2010(r214128) +++ head/lib/libgeom/geom_ctl.c Thu Oct 21 10:38:14 2010(r214129) @@ -150,8 +150,9 @@ gctl_new_arg(struct gctl_req *req) return (ap); } -void -gctl_ro_param(struct gctl_req *req, const char *name, int len, const void* value) +static void +gctl_param_add(struct gctl_req *req, const char *name, int len, void *value, +int flag) { struct gctl_req_arg *ap; @@ -165,8 +166,8 @@ gctl_ro_param(struct gctl_req *req, cons if (ap-name == NULL) return; ap-nlen = strlen(ap-name) + 1; - ap-value = __DECONST(void *, value); - ap-flag = GCTL_PARAM_RD; + ap-value = value; + ap-flag = flag; if (len = 0) ap-len = len; else if (len 0) { @@ -176,26 +177,17 @@ gctl_ro_param(struct gctl_req *req, cons } void -gctl_rw_param(struct gctl_req *req, const char *name, int len, void* value) +gctl_ro_param(struct gctl_req *req, const char *name, int len, const void* value) { - struct gctl_req_arg *ap; - if (req == NULL || req-error != NULL) - return; - ap = gctl_new_arg(req); - if (ap == NULL) - return; - ap-name = strdup(name); - gctl_check_alloc(req, ap-name); - if (ap-name == NULL) - return; - ap-nlen = strlen(ap-name) + 1; - ap-value = value; - ap-flag = GCTL_PARAM_RW; - if (len = 0) - ap-len = len; - else if (len 0) - ap-len = strlen(value) + 1; + gctl_param_add(req, name, len, __DECONST(void *, value), GCTL_PARAM_RD); +} + +void +gctl_rw_param(struct gctl_req *req, const char *name, int len, void *value) +{ + + gctl_param_add(req, name, len, value, GCTL_PARAM_RW); } const char * ___ 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: r214130 - head/sys/dev/mfi
Author: pluknet Date: Thu Oct 21 10:38:52 2010 New Revision: 214130 URL: http://svn.freebsd.org/changeset/base/214130 Log: Update PD state firmware definitions: add copyback, system. Reviewed by: jhb Approved by: avg (mentor) MFC after:1 week Modified: head/sys/dev/mfi/mfireg.h Modified: head/sys/dev/mfi/mfireg.h == --- head/sys/dev/mfi/mfireg.h Thu Oct 21 10:38:14 2010(r214129) +++ head/sys/dev/mfi/mfireg.h Thu Oct 21 10:38:52 2010(r214130) @@ -975,7 +975,9 @@ enum mfi_pd_state { MFI_PD_STATE_OFFLINE = 0x10, MFI_PD_STATE_FAILED = 0x11, MFI_PD_STATE_REBUILD = 0x14, - MFI_PD_STATE_ONLINE = 0x18 + MFI_PD_STATE_ONLINE = 0x18, + MFI_PD_STATE_COPYBACK = 0x20, + MFI_PD_STATE_SYSTEM = 0x40 }; union mfi_ld_ref { ___ 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: r214131 - head/usr.sbin/mfiutil
Author: pluknet Date: Thu Oct 21 10:46:18 2010 New Revision: 214131 URL: http://svn.freebsd.org/changeset/base/214131 Log: Enable copyback and system PD states. Reviewed by: jhb Approved by: avg (mentor) MFC after:1 week X-MFC-After: r214130 Modified: head/usr.sbin/mfiutil/mfi_drive.c Modified: head/usr.sbin/mfiutil/mfi_drive.c == --- head/usr.sbin/mfiutil/mfi_drive.c Thu Oct 21 10:38:52 2010 (r214130) +++ head/usr.sbin/mfiutil/mfi_drive.c Thu Oct 21 10:46:18 2010 (r214131) @@ -65,6 +65,10 @@ mfi_pdstate(enum mfi_pd_state state) return (REBUILD); case MFI_PD_STATE_ONLINE: return (ONLINE); + case MFI_PD_STATE_COPYBACK: + return (COPYBACK); + case MFI_PD_STATE_SYSTEM: + return (SYSTEM); default: sprintf(buf, PSTATE 0x%04x, state); return (buf); ___ 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: r214125 - head/sys/kern
On Thursday, October 21, 2010 4:57:25 am Xin LI wrote: Author: delphij Date: Thu Oct 21 08:57:25 2010 New Revision: 214125 URL: http://svn.freebsd.org/changeset/base/214125 Log: In syscall_module_handler(): all switch branches return, remove unreached code as pointed out in a Chinese forum [1]. [1] http://www.freebsdchina.org/forum/viewtopic.php?t=50619 Pointed out by: btw616 btw s qq com MFC after: 1 month I think this exposes a bug though in that the default case doesn't pass through to chainevh. The default case should look more like the removed code (except returning EOPNOTSUPP instead of 0 if there is no chainevh). -- 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: r214132 - in head: lib/libc/sys sbin/fsirand sbin/ipfw sbin/restore share/man/man4 share/man/man5 share/man/man9 usr.bin/mesg usr.sbin/mtest
Author: uqs Date: Thu Oct 21 12:27:13 2010 New Revision: 214132 URL: http://svn.freebsd.org/changeset/base/214132 Log: mdoc: make pages render with mandoc It's a bit more pedantic regarding .Bl list elements. This has an added benefit of unbreaking the ipfw(8) manpage, where groff was silently skipping one list element. Modified: head/lib/libc/sys/getpriority.2 head/lib/libc/sys/pathconf.2 head/lib/libc/sys/stat.2 head/sbin/fsirand/fsirand.8 head/sbin/ipfw/ipfw.8 head/sbin/restore/restore.8 head/share/man/man4/iscsi_initiator.4 head/share/man/man5/elf.5 head/share/man/man9/sysctl_add_oid.9 head/usr.bin/mesg/mesg.1 head/usr.sbin/mtest/mtest.8 Modified: head/lib/libc/sys/getpriority.2 == --- head/lib/libc/sys/getpriority.2 Thu Oct 21 10:46:18 2010 (r214131) +++ head/lib/libc/sys/getpriority.2 Thu Oct 21 12:27:13 2010 (r214132) @@ -129,10 +129,10 @@ or .Dv PRIO_USER . .El .Pp -.Bl -tag -width Er In addition to the errors indicated above, .Fn setpriority will fail if: +.Bl -tag -width Er .It Bq Er EPERM A process was located, but neither its effective nor real user ID matched the effective user ID of the caller. Modified: head/lib/libc/sys/pathconf.2 == --- head/lib/libc/sys/pathconf.2Thu Oct 21 10:46:18 2010 (r214131) +++ head/lib/libc/sys/pathconf.2Thu Oct 21 12:27:13 2010 (r214132) @@ -89,7 +89,6 @@ returns information about the file the l The available values are as follows: .Pp .Bl -tag -width 6n -.Pp .It Li _PC_LINK_MAX The maximum file link count. .It Li _PC_MAX_CANON @@ -234,11 +233,11 @@ Too many symbolic links were encountered An I/O error occurred while reading from or writing to the file system. .El .Pp -.Bl -tag -width Er The .Fn fpathconf system call will fail if: +.Bl -tag -width Er .It Bq Er EBADF The .Fa fd Modified: head/lib/libc/sys/stat.2 == --- head/lib/libc/sys/stat.2Thu Oct 21 10:46:18 2010(r214131) +++ head/lib/libc/sys/stat.2Thu Oct 21 12:27:13 2010(r214132) @@ -345,10 +345,10 @@ represented correctly in the structure p .Fa sb . .El .Pp -.Bl -tag -width Er The .Fn fstat system call will fail if: +.Bl -tag -width Er .It Bq Er EBADF The .Fa fd Modified: head/sbin/fsirand/fsirand.8 == --- head/sbin/fsirand/fsirand.8 Thu Oct 21 10:46:18 2010(r214131) +++ head/sbin/fsirand/fsirand.8 Thu Oct 21 12:27:13 2010(r214132) @@ -73,8 +73,8 @@ The utility may be used on the root file system in single-user mode but the system should be rebooted via ``reboot -n'' afterwards. .Sh OPTIONS -.Bl -tag -width indent The available options are as follows: +.Bl -tag -width indent .It Fl b Use the default block size (usually 512 bytes) instead of the value gleaned from the disklabel. Modified: head/sbin/ipfw/ipfw.8 == --- head/sbin/ipfw/ipfw.8 Thu Oct 21 10:46:18 2010(r214131) +++ head/sbin/ipfw/ipfw.8 Thu Oct 21 12:27:13 2010(r214132) @@ -1009,11 +1009,11 @@ The second format with multiple addresses) is provided for convenience only and its use is discouraged. .It Ar addr : Oo Cm not Oc Bro -.Bl -tag -width indent .Cm any | me | me6 | .Cm table Ns Pq Ar number Ns Op , Ns Ar value .Ar | addr-list | addr-set .Brc +.Bl -tag -width indent .It Cm any matches any IP address. .It Cm me @@ -2176,7 +2176,6 @@ Finally, the following parameters can be pipes and queues: .Pp .Bl -tag -width -compact -.Pp .It Cm buckets Ar hash-table-size Specifies the size of the hash table used for storing the various queues. Modified: head/sbin/restore/restore.8 == --- head/sbin/restore/restore.8 Thu Oct 21 10:46:18 2010(r214131) +++ head/sbin/restore/restore.8 Thu Oct 21 12:27:13 2010(r214132) @@ -412,7 +412,6 @@ Most checks are self-explanatory or can Common errors are given below. .Pp .Bl -tag -width Ds -compact -.Pp .It filename: not found on tape The specified file name was listed in the tape directory, but was not found on the tape. Modified: head/share/man/man4/iscsi_initiator.4 == --- head/share/man/man4/iscsi_initiator.4 Thu Oct 21 10:46:18 2010 (r214131) +++ head/share/man/man4/iscsi_initiator.4 Thu Oct 21 12:27:13 2010 (r214132) @@ -90,8 +90,8 @@ see The .Nm driver creates the following: -.Bl -tag -width .Pa /dev/iscsi%dxx -compact .Pp +.Bl -tag -width .Pa /dev/iscsi%dxx -compact .It Pa /dev/iscsi used to create new
svn commit: r214133 - head/sys/geom/eli
Author: pjd Date: Thu Oct 21 12:58:26 2010 New Revision: 214133 URL: http://svn.freebsd.org/changeset/base/214133 Log: Fix a bug introduced in r213067 where we use authentication key before initializing it. Modified: head/sys/geom/eli/g_eli.c Modified: head/sys/geom/eli/g_eli.c == --- head/sys/geom/eli/g_eli.c Thu Oct 21 12:27:13 2010(r214132) +++ head/sys/geom/eli/g_eli.c Thu Oct 21 12:58:26 2010(r214133) @@ -686,14 +686,6 @@ g_eli_create(struct gctl_req *req, struc sc-sc_bytes_per_sector = (md-md_sectorsize - 1) / sc-sc_data_per_sector + 1; sc-sc_bytes_per_sector *= bpp-sectorsize; - /* -* Precalculate SHA256 for HMAC key generation. -* This is expensive operation and we can do it only once now or -* for every access to sector, so now will be much better. -*/ - SHA256_Init(sc-sc_akeyctx); - SHA256_Update(sc-sc_akeyctx, sc-sc_akey, - sizeof(sc-sc_akey)); } gp-softc = sc; @@ -753,7 +745,16 @@ g_eli_create(struct gctl_req *req, struc */ g_eli_mkey_propagate(sc, mkey); sc-sc_ekeylen = md-md_keylen; - + if (sc-sc_flags G_ELI_FLAG_AUTH) { + /* +* Precalculate SHA256 for HMAC key generation. +* This is expensive operation and we can do it only once now or +* for every access to sector, so now will be much better. +*/ + SHA256_Init(sc-sc_akeyctx); + SHA256_Update(sc-sc_akeyctx, sc-sc_akey, + sizeof(sc-sc_akey)); + } /* * Precalculate SHA256 for IV generation. * This is expensive operation and we can do it only once now or for ___ 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: r214134 - head/lib/libc/gen
Author: ed Date: Thu Oct 21 15:10:35 2010 New Revision: 214134 URL: http://svn.freebsd.org/changeset/base/214134 Log: Fix error handling logic of pututxline(3). Instead of only returning NULL when the entry is invalid and can't be matched against the current database, also return it when it cannot open the log files properly. Modified: head/lib/libc/gen/pututxline.c Modified: head/lib/libc/gen/pututxline.c == --- head/lib/libc/gen/pututxline.c Thu Oct 21 12:58:26 2010 (r214133) +++ head/lib/libc/gen/pututxline.c Thu Oct 21 15:10:35 2010 (r214134) @@ -65,7 +65,7 @@ futx_open(const char *file) return (fp); } -static void +static int utx_active_add(const struct futx *fu) { FILE *fp; @@ -78,7 +78,7 @@ utx_active_add(const struct futx *fu) */ fp = futx_open(_PATH_UTX_ACTIVE); if (fp == NULL) - return; + return (1); while (fread(fe, sizeof fe, 1, fp) == 1) { switch (fe.fu_type) { case USER_PROCESS: @@ -110,6 +110,7 @@ utx_active_add(const struct futx *fu) exact: fwrite(fu, sizeof *fu, 1, fp); fclose(fp); + return (0); } static int @@ -123,7 +124,7 @@ utx_active_remove(struct futx *fu) */ fp = futx_open(_PATH_UTX_ACTIVE); if (fp == NULL) - return (0); + return (1); while (fread(fe, sizeof fe, 1, fp) == 1) { switch (fe.fu_type) { case USER_PROCESS: @@ -151,7 +152,7 @@ utx_active_purge(void) truncate(_PATH_UTX_ACTIVE, 0); } -static void +static int utx_lastlogin_add(const struct futx *fu) { FILE *fp; @@ -164,7 +165,7 @@ utx_lastlogin_add(const struct futx *fu) */ fp = futx_open(_PATH_UTX_LASTLOGIN); if (fp == NULL) - return; + return (1); while (fread(fe, sizeof fe, 1, fp) == 1) { if (strncmp(fu-fu_user, fe.fu_user, sizeof fe.fu_user) != 0) continue; @@ -175,6 +176,7 @@ utx_lastlogin_add(const struct futx *fu) } fwrite(fu, sizeof *fu, 1, fp); fclose(fp); + return (0); } static void @@ -197,7 +199,7 @@ utx_lastlogin_upgrade(void) _close(fd); } -static void +static int utx_log_add(const struct futx *fu) { int fd; @@ -219,15 +221,17 @@ utx_log_add(const struct futx *fu) fd = _open(_PATH_UTX_LOG, O_CREAT|O_WRONLY|O_APPEND, 0644); if (fd 0) - return; + return (1); _writev(fd, vec, 2); _close(fd); + return (0); } struct utmpx * pututxline(const struct utmpx *utmpx) { struct futx fu; + int bad = 0; utx_to_futx(utmpx, fu); @@ -241,16 +245,21 @@ pututxline(const struct utmpx *utmpx) case NEW_TIME: break; case USER_PROCESS: - utx_active_add(fu); - utx_lastlogin_add(fu); + bad |= utx_active_add(fu); + bad |= utx_lastlogin_add(fu); break; #if 0 /* XXX: Are these records of any use to us? */ case INIT_PROCESS: case LOGIN_PROCESS: - utx_active_add(fu); + bad |= utx_active_add(fu); break; #endif case DEAD_PROCESS: + /* +* In case writing a logout entry fails, never attempt +* to write it to utx.log. The logout entry's ut_id +* might be invalid. +*/ if (utx_active_remove(fu) != 0) return (NULL); break; @@ -258,6 +267,6 @@ pututxline(const struct utmpx *utmpx) return (NULL); } - utx_log_add(fu); - return (futx_to_utx(fu)); + bad |= utx_log_add(fu); + return (bad ? NULL : futx_to_utx(fu)); } ___ 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: r214135 - head/tools/tools/syscall_timing
Author: rwatson Date: Thu Oct 21 16:08:31 2010 New Revision: 214135 URL: http://svn.freebsd.org/changeset/base/214135 Log: Improve the structure and implementation of the syscall_timing microbenchmark suite: - Use common benchmark_start/benchmark_stop routines to simplify individual benchmarks. - Add a central table of tests with names, where new tests can be hooked in easily. - Add new benchmarks for dup, shm_open, shm_open + fstat, fork, vfork, vfork + exec, chroot, setuid. - Accept a number of loops, not just a number of iterations. - Report results more usefully in a table. Sponsored by: Google, Inc. MFC after:2 weeks Modified: head/tools/tools/syscall_timing/syscall_timing.c Modified: head/tools/tools/syscall_timing/syscall_timing.c == --- head/tools/tools/syscall_timing/syscall_timing.cThu Oct 21 15:10:35 2010(r214134) +++ head/tools/tools/syscall_timing/syscall_timing.cThu Oct 21 16:08:31 2010(r214135) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003-2004 Robert N. M. Watson + * Copyright (c) 2003-2004, 2010 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,26 +27,48 @@ */ #include sys/types.h +#include sys/mman.h #include sys/socket.h +#include sys/stat.h #include sys/time.h +#include sys/wait.h #include assert.h +#include err.h +#include fcntl.h +#include inttypes.h #include stdio.h #include stdlib.h #include string.h #include unistd.h -#define timespecsub(vvp, uvp) \ -do {\ -(vvp)-tv_sec -= (uvp)-tv_sec; \ -(vvp)-tv_nsec -= (uvp)-tv_nsec; \ -if ((vvp)-tv_nsec 0) { \ -(vvp)-tv_sec--;\ -(vvp)-tv_nsec += 10; \ -} \ -} while (0) +static struct timespec ts_start, ts_end; -inline void +#define timespecsub(vvp, uvp) \ + do {\ + (vvp)-tv_sec -= (uvp)-tv_sec; \ + (vvp)-tv_nsec -= (uvp)-tv_nsec; \ + if ((vvp)-tv_nsec 0) { \ + (vvp)-tv_sec--;\ + (vvp)-tv_nsec += 10; \ + } \ + } while (0) + +static void +benchmark_start(void) +{ + + assert(clock_gettime(CLOCK_REALTIME, ts_start) == 0); +} + +static void +benchmark_stop(void) +{ + + assert(clock_gettime(CLOCK_REALTIME, ts_end) == 0); +} + +void test_getuid(int num) { int i; @@ -55,11 +77,13 @@ test_getuid(int num) * Thread-local data should require no locking if system * call is MPSAFE. */ + benchmark_start(); for (i = 0; i num; i++) getuid(); + benchmark_stop(); } -inline void +void test_getppid(int num) { int i; @@ -68,28 +92,28 @@ test_getppid(int num) * This is process-local, but can change, so will require a * lock. */ + benchmark_start(); for (i = 0; i num; i++) getppid(); + benchmark_stop(); } -inline void +void test_clock_gettime(int num) { struct timespec ts; int i; - for (i = 0; i num; i++) { - if (clock_gettime(CLOCK_REALTIME, ts) == -1) { - perror(clock_gettime); - exit(-1); - } - } + benchmark_start(); + for (i = 0; i num; i++) + (void)clock_gettime(CLOCK_REALTIME, ts); + benchmark_stop(); } -inline void +void test_pipe(int num) { - int i; + int fd[2], i; /* * pipe creation is expensive, as it will allocate a new file @@ -97,153 +121,397 @@ test_pipe(int num) * Destroying is also expensive, as we now have to free up * the file descriptors and return the pipe. */ + if (pipe(fd) 0) + err(-1, test_pipe: pipe); + close(fd[0]); + close(fd[1]); + benchmark_start(); for (i = 0; i num; i++) { - int fd[2]; - if (pipe(fd) == -1) { - perror(pipe); - exit(-1); - } - + if (pipe(fd) == -1) + err(-1, test_pipe: pipe); close(fd[0]); close(fd[1]); } +
svn commit: r214136 - in head/sys: net sys
Author: pluknet Date: Thu Oct 21 16:20:48 2010 New Revision: 214136 URL: http://svn.freebsd.org/changeset/base/214136 Log: Reshuffle SIOCGIFCONF32 handler from r155224. - move all the chunks into one file, which allows to hide SIOCGIFCONF32 global definition as well. - replace __amd64__ with proper COMPAT_FREEBSD32 around. - handle 32bit capacity before going into the handler itself instead of doing internal 32bit specific changes within it (e.g. as it's done for SIOCGDEFIFACE32_IN6). - use explicitely sized types for ABI compat. Approved by: kib (mentor) MFC after:2 weeks Modified: head/sys/net/if.c head/sys/net/if.h head/sys/sys/sockio.h Modified: head/sys/net/if.c == --- head/sys/net/if.c Thu Oct 21 16:08:31 2010(r214135) +++ head/sys/net/if.c Thu Oct 21 16:20:48 2010(r214136) @@ -92,6 +92,11 @@ #include security/mac/mac_framework.h +#ifdef COMPAT_FREEBSD32 +#include sys/mount.h +#include compat/freebsd32/freebsd32.h +#endif + struct ifindex_entry { struct ifnet *ife_ifnet; }; @@ -2402,6 +2407,17 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, return (error); } +#ifdef COMPAT_FREEBSD32 +struct ifconf32 { + int32_t ifc_len; + union { + uint32_tifcu_buf; + uint32_tifcu_req; + } ifc_ifcu; +}; +#defineSIOCGIFCONF32 _IOWR('i', 36, struct ifconf32) +#endif + /* * Interface ioctls. */ @@ -2416,10 +2432,21 @@ ifioctl(struct socket *so, u_long cmd, c switch (cmd) { case SIOCGIFCONF: case OSIOCGIFCONF: -#ifdef __amd64__ + return (ifconf(cmd, data)); + +#ifdef COMPAT_FREEBSD32 case SIOCGIFCONF32: + { + struct ifconf32 *ifc32; + struct ifconf ifc; + + ifc32 = (struct ifconf32 *)data; + ifc.ifc_len = ifc32-ifc_len; + ifc.ifc_buf = PTRIN(ifc32-ifc_buf); + + return (ifconf(SIOCGIFCONF, (void *)ifc)); + } #endif - return (ifconf(cmd, data)); } ifr = (struct ifreq *)data; @@ -2646,23 +2673,12 @@ static int ifconf(u_long cmd, caddr_t data) { struct ifconf *ifc = (struct ifconf *)data; -#ifdef __amd64__ - struct ifconf32 *ifc32 = (struct ifconf32 *)data; - struct ifconf ifc_swab; -#endif struct ifnet *ifp; struct ifaddr *ifa; struct ifreq ifr; struct sbuf *sb; int error, full = 0, valid_len, max_len; -#ifdef __amd64__ - if (cmd == SIOCGIFCONF32) { - ifc_swab.ifc_len = ifc32-ifc_len; - ifc_swab.ifc_buf = (caddr_t)(uintptr_t)ifc32-ifc_buf; - ifc = ifc_swab; - } -#endif /* Limit initial buffer size to MAXPHYS to avoid DoS from userspace. */ max_len = MAXPHYS - 1; @@ -2752,10 +2768,6 @@ again: } ifc-ifc_len = valid_len; -#ifdef __amd64__ - if (cmd == SIOCGIFCONF32) - ifc32-ifc_len = valid_len; -#endif sbuf_finish(sb); error = copyout(sbuf_data(sb), ifc-ifc_req, ifc-ifc_len); sbuf_delete(sb); Modified: head/sys/net/if.h == --- head/sys/net/if.h Thu Oct 21 16:08:31 2010(r214135) +++ head/sys/net/if.h Thu Oct 21 16:20:48 2010(r214136) @@ -391,16 +391,6 @@ struct ifconf { #defineifc_req ifc_ifcu.ifcu_req /* array of structures returned */ }; -#if defined (__amd64__) -struct ifconf32 { - int ifc_len;/* size of associated buffer */ - union { - u_int ifcu_buf; - u_int ifcu_req; - } ifc_ifcu; -}; -#endif - /* * interface groups */ Modified: head/sys/sys/sockio.h == --- head/sys/sys/sockio.h Thu Oct 21 16:08:31 2010(r214135) +++ head/sys/sys/sockio.h Thu Oct 21 16:20:48 2010(r214136) @@ -62,9 +62,6 @@ #defineSIOCSIFBRDADDR _IOW('i', 19, struct ifreq)/* set broadcast addr */ #defineOSIOCGIFCONF_IOWR('i', 20, struct ifconf) /* get ifnet list */ #defineSIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ -#if defined (__amd64__) -#defineSIOCGIFCONF32 _IOWR('i', 36, struct ifconf32) /* get ifnet list */ -#endif #defineOSIOCGIFNETMASK _IOWR('i', 21, struct ifreq)/* get net addr mask */ #defineSIOCGIFNETMASK _IOWR('i', 37, struct ifreq)/* get net addr mask */ #defineSIOCSIFNETMASK _IOW('i', 22, struct ifreq)/* set net addr mask */ ___ svn-src-head@freebsd.org mailing list
svn commit: r214137 - head/usr.bin/unzip
Author: glebius Date: Thu Oct 21 17:05:15 2010 New Revision: 214137 URL: http://svn.freebsd.org/changeset/base/214137 Log: Make it possible to read input from stdin. Without this change I don't see a way to unpack a multivolume archive without wasting disk space for a temporary file. Modified: head/usr.bin/unzip/unzip.c Modified: head/usr.bin/unzip/unzip.c == --- head/usr.bin/unzip/unzip.c Thu Oct 21 16:20:48 2010(r214136) +++ head/usr.bin/unzip/unzip.c Thu Oct 21 17:05:15 2010(r214137) @@ -859,7 +859,9 @@ unzip(const char *fn) int fd, ret; uintmax_t total_size, file_count, error_count; - if ((fd = open(fn, O_RDONLY)) 0) + if (strcmp(fn, -) == 0) + fd = STDIN_FILENO; + else if ((fd = open(fn, O_RDONLY)) 0) error(%s, fn); if ((a = archive_read_new()) == NULL) @@ -913,7 +915,7 @@ unzip(const char *fn) ac(archive_read_close(a)); (void)archive_read_finish(a); - if (close(fd) != 0) + if (fd != STDIN_FILENO close(fd) != 0) error(%s, fn); if (t_opt) { ___ 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: r214138 - head/usr.sbin/pc-sysinstall/backend
Author: imp Date: Thu Oct 21 17:14:44 2010 New Revision: 214138 URL: http://svn.freebsd.org/changeset/base/214138 Log: This small patch updates the geli setkey flags pc-sysinstall uses when saving a users passphrase, to make it work in HEAD with recent geli improvements. Submitted by: Kris Moore PR: 151002 Modified: head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh == --- head/usr.sbin/pc-sysinstall/backend/functions-cleanup.shThu Oct 21 17:05:15 2010(r214137) +++ head/usr.sbin/pc-sysinstall/backend/functions-cleanup.shThu Oct 21 17:14:44 2010(r214138) @@ -296,7 +296,7 @@ setup_geli_loading() # If we have a passphrase, set it up now if [ -e ${PARTDIR}-enc/${PART}-encpass ] ; then - cat ${PARTDIR}-enc/${PART}-encpass | geli setkey -S -n 0 -p -k ${KEYFILE} -K ${KEYFILE} ${PART} + geli setkey -J ${PARTDIR}-enc/${PART}-encpass -n 0 -p -k ${KEYFILE} -K ${KEYFILE} ${PART} geli configure -b ${PART} fi ___ 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: r214139 - head/usr.sbin/pc-sysinstall/backend
Author: imp Date: Thu Oct 21 17:20:37 2010 New Revision: 214139 URL: http://svn.freebsd.org/changeset/base/214139 Log: This is an updated patch to the last patch to do this which fixes a local variable issue. This patch decompresses compressed images to the stdout when writing to a device to avoid running out of space issues. Submitted by: John Hixson Pr: 151049 Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh == --- head/usr.sbin/pc-sysinstall/backend/functions.shThu Oct 21 17:14:44 2010(r214138) +++ head/usr.sbin/pc-sysinstall/backend/functions.shThu Oct 21 17:20:37 2010(r214139) @@ -325,64 +325,8 @@ get_compression_type() export VAL } -decompress_file() -{ - local FILE - local COMPRESSION - - FILE=$1 - COMPRESSION=$2 - - if [ -n ${COMPRESSION} ] - then -case ${COMPRESSION} in - lzw) -rc_halt uncompress ${FILE} -VAL=${FILE%.Z} -;; - - lzo) -rc_halt lzop -d ${FILE} -VAL=${FILE%.lzo} -;; - - lzma) -rc_halt lzma -d ${FILE} -VAL=${FILE%.lzma} -;; - - gzip) -rc_halt gunzip ${FILE} -VAL=${FILE%.gz} -;; - - bzip2) -rc_halt bunzip2 ${FILE} -VAL=${FILE%.bz2} -;; - - xz) -rc_halt xz -d ${FILE} -VAL=${FILE%.xz} -;; - - zip) -rc_halt unzip ${FILE} -VAL=${FILE%.zip} -;; - - *) -exit_err ERROR: ${COMPRESSION} compression is not supported -;; -esac - fi - - export VAL -} - write_image() { - local IMAGE_FILE local DEVICE_FILE IMAGE_FILE=$1 @@ -418,11 +362,51 @@ write_image() get_compression_type ${IMAGE_FILE} COMPRESSION=${VAL} - decompress_file ${IMAGE_FILE} ${COMPRESSION} - IMAGE_FILE=${VAL} - fi +case ${COMPRESSION} in + lzw) +rc_halt uncompress ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k +IMAGE_FILE=${IMAGE_FILE%.Z} +;; + + lzo) +rc_halt lzop -d $IMAGE_{FILE} -c | dd of=${DEVICE_FILE} bs=128k +IMAGE_FILE=${IMAGE_FILE%.lzo} +;; + + lzma) +rc_halt lzma -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k +IMAGE_FILE=${IMAGE_FILE%.lzma} +;; + + gzip) +rc_halt gunzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k +IMAGE_FILE=${IMAGE_FILE%.gz} +;; - rc_halt dd if=${IMAGE_FILE} of=${DEVICE_FILE} bs=128k + bzip2) +rc_halt bunzip2 ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k +IMAGE_FILE=${IMAGE_FILE%.bz2} +;; + + xz) +rc_halt xz -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k +IMAGE_FILE=${IMAGE_FILE%.xz} +;; + + zip) +rc_halt unzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k +IMAGE_FILE=${IMAGE_FILE%.zip} +;; + + *) +exit_err ERROR: ${COMPRESSION} compression is not supported +;; +esac + + else +rc_halt dd if=${IMAGE_FILE} of=${DEVICE_FILE} bs=128k + + fi }; install_fresh() ___ 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: r214141 - head/usr.sbin/pc-sysinstall/backend-query
Author: imp Date: Thu Oct 21 17:23:48 2010 New Revision: 214141 URL: http://svn.freebsd.org/changeset/base/214141 Log: This patch will only list components if the directory exists. The directory exist on PC-BSD but not FreeBSD, so an extra check is made. Submitted by: John Hixson PR: 151461 Modified: head/usr.sbin/pc-sysinstall/backend-query/list-components.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/list-components.sh == --- head/usr.sbin/pc-sysinstall/backend-query/list-components.shThu Oct 21 17:23:09 2010(r214140) +++ head/usr.sbin/pc-sysinstall/backend-query/list-components.shThu Oct 21 17:23:48 2010(r214141) @@ -32,23 +32,24 @@ echo Available Components: -cd ${COMPDIR} -for i in `ls -d *` -do - if [ -e ${i}/component.cfg -a -e ${i}/install.sh -a -e ${i}/distfiles ] - then -NAME=`grep 'name:' ${i}/component.cfg | cut -d ':' -f 2` -DESC=`grep 'description:' ${i}/component.cfg | cut -d ':' -f 2` -TYPE=`grep 'type:' ${i}/component.cfg | cut -d ':' -f 2` -echo -echo name: ${i} -echo desc:${DESC} -echo type:${TYPE} -if [ -e ${i}/component.png ] +if [ -d ${COMPDIR} ] +then + cd ${COMPDIR} + for i in `ls -d *` + do +if [ -e ${i}/component.cfg -a -e ${i}/install.sh -a -e ${i}/distfiles ] then - echo icon: ${COMPDIR}/${i}/component.png + NAME=`grep 'name:' ${i}/component.cfg | cut -d ':' -f 2` + DESC=`grep 'description:' ${i}/component.cfg | cut -d ':' -f 2` + TYPE=`grep 'type:' ${i}/component.cfg | cut -d ':' -f 2` + echo + echo name: ${i} + echo desc:${DESC} + echo type:${TYPE} + if [ -e ${i}/component.png ] + then +echo icon: ${COMPDIR}/${i}/component.png + fi fi - fi - -done - + done +fi ___ 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: r214142 - head/tools/tools/syscall_timing
Author: rwatson Date: Thu Oct 21 17:27:39 2010 New Revision: 214142 URL: http://svn.freebsd.org/changeset/base/214142 Log: Further enhancements to syscall_timing: - Use getopt rather than hand-parsed arguments - Allow iterations to be specified and/or a new number of seconds bound on the number of iterations - Fix printout of timer resolution - Add new tests, such as TCP and UDP socket creation, and open/read/close of /dev/zero and /dev/null. Sponsored by: Google, Inc. MFC after:2 weeks Modified: head/tools/tools/syscall_timing/syscall_timing.c Modified: head/tools/tools/syscall_timing/syscall_timing.c == --- head/tools/tools/syscall_timing/syscall_timing.cThu Oct 21 17:23:48 2010(r214141) +++ head/tools/tools/syscall_timing/syscall_timing.cThu Oct 21 17:27:39 2010(r214142) @@ -37,12 +37,16 @@ #include err.h #include fcntl.h #include inttypes.h +#include limits.h +#include signal.h #include stdio.h #include stdlib.h #include string.h #include unistd.h static struct timespec ts_start, ts_end; +static int alarm_timeout; +static volatile int alarm_fired; #define timespecsub(vvp, uvp) \ do {\ @@ -55,9 +59,21 @@ static struct timespec ts_start, ts_end; } while (0) static void +alarm_handler(int signum) +{ + + alarm_fired = 1; +} + +static void benchmark_start(void) { + alarm_fired = 0; + if (alarm_timeout) { + signal(SIGALRM, alarm_handler); + alarm(alarm_timeout); + } assert(clock_gettime(CLOCK_REALTIME, ts_start) == 0); } @@ -68,50 +84,62 @@ benchmark_stop(void) assert(clock_gettime(CLOCK_REALTIME, ts_end) == 0); } -void -test_getuid(int num) +uint64_t +test_getuid(uint64_t num, uint64_t int_arg, const char *string_arg) { - int i; + uint64_t i; /* * Thread-local data should require no locking if system * call is MPSAFE. */ benchmark_start(); - for (i = 0; i num; i++) + for (i = 0; i num; i++) { + if (alarm_fired) + break; getuid(); + } benchmark_stop(); + return (i); } -void -test_getppid(int num) +uint64_t +test_getppid(uint64_t num, uint64_t int_arg, const char *string_arg) { - int i; + uint64_t i; /* * This is process-local, but can change, so will require a * lock. */ benchmark_start(); - for (i = 0; i num; i++) + for (i = 0; i num; i++) { + if (alarm_fired) + break; getppid(); + } benchmark_stop(); + return (i); } -void -test_clock_gettime(int num) +uint64_t +test_clock_gettime(uint64_t num, uint64_t int_arg, const char *string_arg) { struct timespec ts; - int i; + uint64_t i; benchmark_start(); - for (i = 0; i num; i++) + for (i = 0; i num; i++) { + if (alarm_fired) + break; (void)clock_gettime(CLOCK_REALTIME, ts); + } benchmark_stop(); + return (i); } -void -test_pipe(int num) +uint64_t +test_pipe(uint64_t num, uint64_t int_arg, const char *string_arg) { int fd[2], i; @@ -127,56 +155,66 @@ test_pipe(int num) close(fd[1]); benchmark_start(); for (i = 0; i num; i++) { + if (alarm_fired) + break; if (pipe(fd) == -1) err(-1, test_pipe: pipe); close(fd[0]); close(fd[1]); } benchmark_stop(); + return (i); } -void -test_socket_stream(int num) +uint64_t +test_socket_stream(uint64_t num, uint64_t int_arg, const char *string_arg) { - int i, so; + uint64_t i, so; - so = socket(PF_LOCAL, SOCK_STREAM, 0); + so = socket(int_arg, SOCK_STREAM, 0); if (so 0) err(-1, test_socket_stream: socket); close(so); benchmark_start(); for (i = 0; i num; i++) { - so = socket(PF_LOCAL, SOCK_STREAM, 0); + if (alarm_fired) + break; + so = socket(int_arg, SOCK_STREAM, 0); if (so == -1) err(-1, test_socket_stream: socket); close(so); } benchmark_stop(); + return (i); } -void -test_socket_dgram(int num) +uint64_t +test_socket_dgram(uint64_t num, uint64_t int_arg, const char *string_arg) { - int i, so; + uint64_t i, so; - so = socket(PF_LOCAL, SOCK_DGRAM, 0); + so = socket(int_arg, SOCK_DGRAM, 0); if (so 0) err(-1, test_socket_dgram: socket);
svn commit: r214143 - head/usr.sbin/pc-sysinstall/backend
Author: imp Date: Thu Oct 21 17:29:18 2010 New Revision: 214143 URL: http://svn.freebsd.org/changeset/base/214143 Log: Left over from prior patch removed. Submitted by: John Hixon PR: 151442 (but the patch was backwards there) Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh == --- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Thu Oct 21 17:27:39 2010(r214142) +++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Thu Oct 21 17:29:18 2010(r214143) @@ -507,17 +507,6 @@ setup_disk_slice() DEST=${DISK} fi - if iscompressed ${IMAGE} - then -local COMPRESSION - -get_compression_type ${IMAGE} -COMPRESSION=${VAL} - -decompress_file ${IMAGE} ${COMPRESSION} -IMAGE=${VAL} - fi - write_image ${IMAGE} ${DEST} check_disk_layout ${DEST} fi ___ 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: r214144 - head/sys/vm
Author: jhb Date: Thu Oct 21 17:29:32 2010 New Revision: 214144 URL: http://svn.freebsd.org/changeset/base/214144 Log: - Make 'vm_refcnt' volatile so that compilers won't be tempted to treat its value as a loop invariant. Currently this is a no-op because 'atomic_cmpset_int()' clobbers all memory on current architectures. - Use atomic_fetchadd_int() instead of an atomic_cmpset_int() loop to drop a reference in vmspace_free(). Reviewed by: alc MFC after:1 month Modified: head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cThu Oct 21 17:29:18 2010(r214143) +++ head/sys/vm/vm_map.cThu Oct 21 17:29:32 2010(r214144) @@ -339,15 +339,11 @@ vmspace_dofree(struct vmspace *vm) void vmspace_free(struct vmspace *vm) { - int refcnt; if (vm-vm_refcnt == 0) panic(vmspace_free: attempt to free already freed vmspace); - do - refcnt = vm-vm_refcnt; - while (!atomic_cmpset_int(vm-vm_refcnt, refcnt, refcnt - 1)); - if (refcnt == 1) + if (atomic_fetchadd_int(vm-vm_refcnt, -1) == 1) vmspace_dofree(vm); } Modified: head/sys/vm/vm_map.h == --- head/sys/vm/vm_map.hThu Oct 21 17:29:18 2010(r214143) +++ head/sys/vm/vm_map.hThu Oct 21 17:29:32 2010(r214144) @@ -236,7 +236,7 @@ struct vmspace { caddr_t vm_taddr; /* (c) user virtual address of text */ caddr_t vm_daddr; /* (c) user virtual address of data */ caddr_t vm_maxsaddr;/* user VA at max stack growth */ - int vm_refcnt; /* number of references */ + volatile int vm_refcnt; /* number of references */ /* * Keep the PMAP last, so that CPU-specific variations of that * structure on a single architecture don't result in offset ___ 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: r214145 - head/tools/tools/syscall_timing
Author: rwatson Date: Thu Oct 21 17:35:08 2010 New Revision: 214145 URL: http://svn.freebsd.org/changeset/base/214145 Log: Fix bug in recent syscall_timing change: measure the number of iterations each loop, rather than once up front. The distinction is unimportant when doing a fix iteration count, but when using a timer, it should vary. Sponsored by: Google, Inc. MFC after:2 weeks Modified: head/tools/tools/syscall_timing/syscall_timing.c Modified: head/tools/tools/syscall_timing/syscall_timing.c == --- head/tools/tools/syscall_timing/syscall_timing.cThu Oct 21 17:29:32 2010(r214144) +++ head/tools/tools/syscall_timing/syscall_timing.cThu Oct 21 17:35:08 2010(r214145) @@ -671,11 +671,12 @@ main(int argc, char *argv[]) /* * Run one warmup, then do the real thing (loops) times. */ - calls = the_test-t_func(iterations, the_test-t_int, + the_test-t_func(iterations, the_test-t_int, the_test-t_string); + calls = 0; for (k = 0; k loops; k++) { - the_test-t_func(iterations, the_test-t_int, - the_test-t_string); + calls = the_test-t_func(iterations, + the_test-t_int, the_test-t_string); timespecsub(ts_end, ts_start); printf(%s\t%d\t, the_test-t_name, k); printf(%ju.%09ju\t%d\t, (uintmax_t)ts_end.tv_sec, ___ 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: r214146 - head/sys/dev/pci
Author: jhb Date: Thu Oct 21 17:46:23 2010 New Revision: 214146 URL: http://svn.freebsd.org/changeset/base/214146 Log: Clarify a misleading comment. The test in pci_reserve_map() was meant to ignore BARs that are invalid due to having a size of zero, not to ignore BARs with an existing base of zero. While here, reorganize the code slightly to make the intent clearer. Reported by: avg MFC after:1 week Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c == --- head/sys/dev/pci/pci.c Thu Oct 21 17:35:08 2010(r214145) +++ head/sys/dev/pci/pci.c Thu Oct 21 17:46:23 2010(r214146) @@ -3664,9 +3664,15 @@ pci_reserve_map(device_t dev, device_t c res = NULL; pci_read_bar(child, *rid, map, testval); - /* Ignore a BAR with a base of 0. */ - if ((*rid == PCIR_BIOS pci_rombase(testval) == 0) || - pci_mapbase(testval) == 0) + /* +* Determine the size of the BAR and ignore BARs with a size +* of 0. Device ROM BARs use a different mask value. +*/ + if (*rid == PCIR_BIOS) + mapsize = pci_romsize(testval); + else + mapsize = pci_mapsize(testval); + if (mapsize == 0) goto out; if (PCI_BAR_MEM(testval) || *rid == PCIR_BIOS) { @@ -3695,13 +3701,7 @@ pci_reserve_map(device_t dev, device_t c * actually uses and we would otherwise have a * situation where we might allocate the excess to * another driver, which won't work. -* -* Device ROM BARs use a different mask value. */ - if (*rid == PCIR_BIOS) - mapsize = pci_romsize(testval); - else - mapsize = pci_mapsize(testval); count = 1UL mapsize; if (RF_ALIGNMENT(flags) mapsize) flags = (flags ~RF_ALIGNMENT_MASK) | RF_ALIGNMENT_LOG2(mapsize); ___ 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: r214144 - head/sys/vm
Hi John, * John Baldwin j...@freebsd.org, 20101021 19:29: + if (atomic_fetchadd_int(vm-vm_refcnt, -1) == 1) vmspace_dofree(vm); Not that it's that useful, but maybe it would be good to use refcount_release() here? -- Ed Schouten e...@80386.nl WWW: http://80386.nl/ pgpZWtA2gScwF.pgp Description: PGP signature
svn commit: r214147 - head/lib/libc/stdlib
Author: bcr (doc committer) Date: Thu Oct 21 18:21:19 2010 New Revision: 214147 URL: http://svn.freebsd.org/changeset/base/214147 Log: Sync with OpenBSD rev. 1.13: strtonum does not require limits.h Obtained from: OpenBSD Discussed with: ru@ MFC after: 5 days Modified: head/lib/libc/stdlib/strtonum.3 Modified: head/lib/libc/stdlib/strtonum.3 == --- head/lib/libc/stdlib/strtonum.3 Thu Oct 21 17:46:23 2010 (r214146) +++ head/lib/libc/stdlib/strtonum.3 Thu Oct 21 18:21:19 2010 (r214147) @@ -12,7 +12,7 @@ .\ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\ -.\ $OpenBSD: strtonum.3,v 1.12 2005/10/26 11:37:58 jmc Exp $ +.\ $OpenBSD: strtonum.3,v 1.13 2006/04/25 05:15:42 tedu Exp $ .\ $FreeBSD$ .\ .Dd April 29, 2004 @@ -23,7 +23,6 @@ .Nd reliably convert string value to an integer .Sh SYNOPSIS .In stdlib.h -.In limits.h .Ft long long .Fo strtonum .Fa const char *nptr ___ 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: r214148 - head/lib/libc/stdlib
Author: bcr (doc committer) Date: Thu Oct 21 18:30:48 2010 New Revision: 214148 URL: http://svn.freebsd.org/changeset/base/214148 Log: Document strtonum()s behavior of setting errno to 0 when no error is found. PR: docs/143330 Submitted by: Efstratios Karatzas (gpf dot kira at gmail dot com) Discussed with: ru@ MFC after: 7 days Modified: head/lib/libc/stdlib/strtonum.3 Modified: head/lib/libc/stdlib/strtonum.3 == --- head/lib/libc/stdlib/strtonum.3 Thu Oct 21 18:21:19 2010 (r214147) +++ head/lib/libc/stdlib/strtonum.3 Thu Oct 21 18:30:48 2010 (r214148) @@ -83,6 +83,8 @@ is set, and .Fa errstr will point to an error message. On success, +.Va errno +is set to 0 and .Fa *errstr will be set to .Dv NULL ; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r214144 - head/sys/vm
On Thursday, October 21, 2010 2:19:21 pm Ed Schouten wrote: Hi John, * John Baldwin j...@freebsd.org, 20101021 19:29: + if (atomic_fetchadd_int(vm-vm_refcnt, -1) == 1) vmspace_dofree(vm); Not that it's that useful, but maybe it would be good to use refcount_release() here? Not in this case because the other places do not use the refcount API. Specifically, the code in vmspace_exit() is a bit tortuous. I'd rather code only use the refcount API if it is going to always use it. -- 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: r214149 - head/sys/fs/nfsserver
Author: rmacklem Date: Thu Oct 21 18:49:12 2010 New Revision: 214149 URL: http://svn.freebsd.org/changeset/base/214149 Log: Modify the experimental NFS server in a manner analagous to r214049 for the regular NFS server, so that it will not do a VOP_LOOKUP() of .. when at the root of a file system when performing a ReaddirPlus RPC. MFC after:10 days Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cThu Oct 21 18:30:48 2010 (r214148) +++ head/sys/fs/nfsserver/nfs_nfsdport.cThu Oct 21 18:49:12 2010 (r214149) @@ -1933,7 +1933,15 @@ again: vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - r = VOP_LOOKUP(vp, nvp, cn); + if ((vp-v_vflag VV_ROOT) != 0 +(cn.cn_flags ISDOTDOT) + != 0) { + vref(vp); + nvp = vp; + r = 0; + } else + r = VOP_LOOKUP(vp, nvp, + cn); } } if (!r) { ___ 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: r214151 - head/tools/tools/syscall_timing
Author: rwatson Date: Thu Oct 21 19:01:59 2010 New Revision: 214151 URL: http://svn.freebsd.org/changeset/base/214151 Log: Further syscall_timing improvements: allow an arbitrary path string argument to be passed on the command line, allowing file-related tests to be pointed at wherever desired. Sponsored by: Google, Inc. MFC after:2 weeks Modified: head/tools/tools/syscall_timing/syscall_timing.c Modified: head/tools/tools/syscall_timing/syscall_timing.c == --- head/tools/tools/syscall_timing/syscall_timing.cThu Oct 21 18:59:05 2010(r214150) +++ head/tools/tools/syscall_timing/syscall_timing.cThu Oct 21 19:01:59 2010(r214151) @@ -85,7 +85,7 @@ benchmark_stop(void) } uint64_t -test_getuid(uint64_t num, uint64_t int_arg, const char *string_arg) +test_getuid(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i; @@ -104,7 +104,7 @@ test_getuid(uint64_t num, uint64_t int_a } uint64_t -test_getppid(uint64_t num, uint64_t int_arg, const char *string_arg) +test_getppid(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i; @@ -123,7 +123,7 @@ test_getppid(uint64_t num, uint64_t int_ } uint64_t -test_clock_gettime(uint64_t num, uint64_t int_arg, const char *string_arg) +test_clock_gettime(uint64_t num, uint64_t int_arg, const char *path) { struct timespec ts; uint64_t i; @@ -139,7 +139,7 @@ test_clock_gettime(uint64_t num, uint64_ } uint64_t -test_pipe(uint64_t num, uint64_t int_arg, const char *string_arg) +test_pipe(uint64_t num, uint64_t int_arg, const char *path) { int fd[2], i; @@ -167,7 +167,7 @@ test_pipe(uint64_t num, uint64_t int_arg } uint64_t -test_socket_stream(uint64_t num, uint64_t int_arg, const char *string_arg) +test_socket_stream(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i, so; @@ -189,7 +189,7 @@ test_socket_stream(uint64_t num, uint64_ } uint64_t -test_socket_dgram(uint64_t num, uint64_t int_arg, const char *string_arg) +test_socket_dgram(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i, so; @@ -211,7 +211,7 @@ test_socket_dgram(uint64_t num, uint64_t } uint64_t -test_socketpair_stream(uint64_t num, uint64_t int_arg, const char *string_arg) +test_socketpair_stream(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i; int so[2]; @@ -234,7 +234,7 @@ test_socketpair_stream(uint64_t num, uin } uint64_t -test_socketpair_dgram(uint64_t num, uint64_t int_arg, const char *string_arg) +test_socketpair_dgram(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i; int so[2]; @@ -257,9 +257,8 @@ test_socketpair_dgram(uint64_t num, uint } uint64_t -test_open_close(uint64_t num, uint64_t int_arg, const char *string_arg) +test_open_close(uint64_t num, uint64_t int_arg, const char *path) { - const char *path = string_arg; uint64_t i; int fd; @@ -282,15 +281,15 @@ test_open_close(uint64_t num, uint64_t i } uint64_t -test_open_read_close(uint64_t num, uint64_t int_arg, const char *string_arg) +test_open_read_close(uint64_t num, uint64_t int_arg, const char *path) { char buf[int_arg]; uint64_t i; int fd; - fd = open(string_arg, O_RDONLY); + fd = open(path, O_RDONLY); if (fd 0) - err(-1, test_open_close: %s, string_arg); + err(-1, test_open_close: %s, path); (void)read(fd, buf, int_arg); close(fd); @@ -298,9 +297,9 @@ test_open_read_close(uint64_t num, uint6 for (i = 0; i num; i++) { if (alarm_fired) break; - fd = open(string_arg, O_RDONLY); + fd = open(path, O_RDONLY); if (fd 0) - err(-1, test_open_close: %s, string_arg); + err(-1, test_open_close: %s, path); (void)read(fd, buf, int_arg); close(fd); } @@ -309,7 +308,7 @@ test_open_read_close(uint64_t num, uint6 } uint64_t -test_dup(uint64_t num, uint64_t int_arg, const char *string_arg) +test_dup(uint64_t num, uint64_t int_arg, const char *path) { int fd, i, shmfd; @@ -333,7 +332,7 @@ test_dup(uint64_t num, uint64_t int_arg, } uint64_t -test_shmfd(uint64_t num, uint64_t int_arg, const char *string_arg) +test_shmfd(uint64_t num, uint64_t int_arg, const char *path) { uint64_t i, shmfd; @@ -355,7 +354,7 @@ test_shmfd(uint64_t num, uint64_t int_ar } uint64_t -test_fstat_shmfd(uint64_t num, uint64_t int_arg, const char *string_arg) +test_fstat_shmfd(uint64_t num, uint64_t int_arg, const char *path) { struct stat sb; uint64_t i, shmfd; @@ -377,7 +376,7 @@ test_fstat_shmfd(uint64_t num, uint64_t } uint64_t -test_fork(uint64_t num, uint64_t int_arg, const char *string_arg)
svn commit: r214154 - head/tools/tools/syscall_timing
Author: rwatson Date: Thu Oct 21 19:03:24 2010 New Revision: 214154 URL: http://svn.freebsd.org/changeset/base/214154 Log: Add Cambridge/Google tag since the copyright has been updated. MFC after:2 weeks Modified: head/tools/tools/syscall_timing/syscall_timing.c Modified: head/tools/tools/syscall_timing/syscall_timing.c == --- head/tools/tools/syscall_timing/syscall_timing.cThu Oct 21 19:03:13 2010(r214153) +++ head/tools/tools/syscall_timing/syscall_timing.cThu Oct 21 19:03:24 2010(r214154) @@ -2,6 +2,9 @@ * Copyright (c) 2003-2004, 2010 Robert N. M. Watson * All rights reserved. * + * Portions of this software were developed at the University of Cambridge + * Computer Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: ___ 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: r214125 - head/sys/kern
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 10/21/10 04:46, John Baldwin wrote: On Thursday, October 21, 2010 4:57:25 am Xin LI wrote: Author: delphij Date: Thu Oct 21 08:57:25 2010 New Revision: 214125 URL: http://svn.freebsd.org/changeset/base/214125 Log: In syscall_module_handler(): all switch branches return, remove unreached code as pointed out in a Chinese forum [1]. [1] http://www.freebsdchina.org/forum/viewtopic.php?t=50619 Pointed out by:btw616 btw s qq com MFC after: 1 month I think this exposes a bug though in that the default case doesn't pass through to chainevh. The default case should look more like the removed code (except returning EOPNOTSUPP instead of 0 if there is no chainevh). Hmm... It sounds reasonable in theory (so that modules can handle events other than MOD_LOAD/UNLOAD) at least, while I don't think it's really being used anywhere. Will the attached patch look reasonable? (If data-chainevh is NULL then operation is not supported, if not then delegate to the module). Cheers, - -- Xin LI delp...@delphij.nethttp://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.16 (FreeBSD) iQEcBAEBCAAGBQJMwI+cAAoJEATO+BI/yjfBADUH/21dtdgSziij8hNi8ef5xOZH QMbGRoHNUREVfuAnAevGNDotSonaRv+VEs5k9raRqqYFdtst6KzNjVQuumJsskmq +6j7rSPXQvAmgEf6JgEZmjU/WzRbs4lozMjUOx0TW6ZSTtiXq+PSvmMe7q9iydiT YKOj8E/itVFjKY2qMGNkAQ893qzIWvptDR9QGJP+m+8usTnYvAlk8vQw3XhfR/ws MNE726rDNwD2sblH2IZI0dt/xy8i6mD5Ef1aM4KEkeussBjGlLAktSS6qFB71lql JpGC9SCelhJRci6gLTvAbAyIe9hoFf8C7P+AbFXgVNMQxYWIHSzQr5BktwxSpc0= =C6jc -END PGP SIGNATURE- Index: sys/kern/kern_syscalls.c === --- sys/kern/kern_syscalls.c(revision 214146) +++ sys/kern/kern_syscalls.c(working copy) @@ -181,7 +181,9 @@ error = syscall_deregister(data-offset, data-old_sysent); return (error); default: - return EOPNOTSUPP; + if (data-chainevh) + return (data-chainevh(mod, what, data-chainarg)); + return (EOPNOTSUPP); } /* NOTREACHED */ ___ 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: r214158 - in head/sys: kern sys
Author: jhb Date: Thu Oct 21 19:17:40 2010 New Revision: 214158 URL: http://svn.freebsd.org/changeset/base/214158 Log: - When disabling ktracing on a process, free any pending requests that may be left. This fixes a memory leak that can occur when tracing is disabled on a process via disabling tracing of a specific file (or if an I/O error occurs with the tracefile) if the process's next system call is exit(). The trace disabling code clears p_traceflag, so exit1() doesn't do any KTRACE-related cleanup leading to the leak. I chose to make the free'ing of pending records synchronous rather than patching exit1(). - Move KTRACE-specific logic out of kern_(exec|exit|fork).c and into kern_ktrace.c instead. Make ktrace_mtx private to kern_ktrace.c as a result. MFC after:1 month Modified: head/sys/kern/kern_exec.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_ktrace.c head/sys/sys/ktrace.h Modified: head/sys/kern/kern_exec.c == --- head/sys/kern/kern_exec.c Thu Oct 21 19:11:14 2010(r214157) +++ head/sys/kern/kern_exec.c Thu Oct 21 19:17:40 2010(r214158) @@ -655,16 +655,8 @@ interpret: setsugid(p); #ifdef KTRACE - if (p-p_tracevp != NULL - priv_check_cred(oldcred, PRIV_DEBUG_DIFFCRED, 0)) { - mtx_lock(ktrace_mtx); - p-p_traceflag = 0; - tracevp = p-p_tracevp; - p-p_tracevp = NULL; - tracecred = p-p_tracecred; - p-p_tracecred = NULL; - mtx_unlock(ktrace_mtx); - } + if (priv_check_cred(oldcred, PRIV_DEBUG_DIFFCRED, 0)) + ktrprocexec(p, tracecred, tracevp); #endif /* * Close any file descriptors 0..2 that reference procfs, Modified: head/sys/kern/kern_exit.c == --- head/sys/kern/kern_exit.c Thu Oct 21 19:11:14 2010(r214157) +++ head/sys/kern/kern_exit.c Thu Oct 21 19:17:40 2010(r214158) @@ -121,10 +121,6 @@ exit1(struct thread *td, int rv) struct proc *p, *nq, *q; struct vnode *vtmp; struct vnode *ttyvp = NULL; -#ifdef KTRACE - struct vnode *tracevp; - struct ucred *tracecred; -#endif struct plimit *plim; int locked; @@ -356,33 +352,7 @@ exit1(struct thread *td, int rv) if (ttyvp != NULL) vrele(ttyvp); #ifdef KTRACE - /* -* Disable tracing, then drain any pending records and release -* the trace file. -*/ - if (p-p_traceflag != 0) { - PROC_LOCK(p); - mtx_lock(ktrace_mtx); - p-p_traceflag = 0; - mtx_unlock(ktrace_mtx); - PROC_UNLOCK(p); - ktrprocexit(td); - PROC_LOCK(p); - mtx_lock(ktrace_mtx); - tracevp = p-p_tracevp; - p-p_tracevp = NULL; - tracecred = p-p_tracecred; - p-p_tracecred = NULL; - mtx_unlock(ktrace_mtx); - PROC_UNLOCK(p); - if (tracevp != NULL) { - locked = VFS_LOCK_GIANT(tracevp-v_mount); - vrele(tracevp); - VFS_UNLOCK_GIANT(locked); - } - if (tracecred != NULL) - crfree(tracecred); - } + ktrprocexit(td); #endif /* * Release reference to text vnode Modified: head/sys/kern/kern_fork.c == --- head/sys/kern/kern_fork.c Thu Oct 21 19:11:14 2010(r214157) +++ head/sys/kern/kern_fork.c Thu Oct 21 19:17:40 2010(r214158) @@ -645,21 +645,7 @@ again: callout_init(p2-p_itcallout, CALLOUT_MPSAFE); #ifdef KTRACE - /* -* Copy traceflag and tracefile if enabled. -*/ - mtx_lock(ktrace_mtx); - KASSERT(p2-p_tracevp == NULL, (new process has a ktrace vnode)); - if (p1-p_traceflag KTRFAC_INHERIT) { - p2-p_traceflag = p1-p_traceflag; - if ((p2-p_tracevp = p1-p_tracevp) != NULL) { - VREF(p2-p_tracevp); - KASSERT(p1-p_tracecred != NULL, - (ktrace vnode with no cred)); - p2-p_tracecred = crhold(p1-p_tracecred); - } - } - mtx_unlock(ktrace_mtx); + ktrprocfork(p1, p2); #endif /* Modified: head/sys/kern/kern_ktrace.c == --- head/sys/kern/kern_ktrace.c Thu Oct 21 19:11:14 2010(r214157) +++ head/sys/kern/kern_ktrace.c
svn commit: r214160 - head/sys/dev/iwi
Author: bschmidt Date: Thu Oct 21 19:28:52 2010 New Revision: 214160 URL: http://svn.freebsd.org/changeset/base/214160 Log: Instead of calling return when reaching the end of the assoc notification break the loop instead. We want to run the code after the while loop to set an associd and capinfo. If we don't do this net80211 will drop frames because it assumes the node has not yet been associated. MFC after:1 week Modified: head/sys/dev/iwi/if_iwi.c Modified: head/sys/dev/iwi/if_iwi.c == --- head/sys/dev/iwi/if_iwi.c Thu Oct 21 19:27:27 2010(r214159) +++ head/sys/dev/iwi/if_iwi.c Thu Oct 21 19:28:52 2010(r214160) @@ -1356,7 +1356,7 @@ iwi_checkforqos(struct ieee80211vap *vap wme = NULL; while (frm efrm) { - IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1], return); + IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1], break); switch (*frm) { case IEEE80211_ELEMID_VENDOR: if (iswmeoui(frm)) ___ 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: r214162 - head/sys/dev/iwi
Author: bschmidt Date: Thu Oct 21 19:30:55 2010 New Revision: 214162 URL: http://svn.freebsd.org/changeset/base/214162 Log: The firmware always sets bit 14 and 15, to get the real associd we need to clear those bits. MFC after:1 week Modified: head/sys/dev/iwi/if_iwi.c Modified: head/sys/dev/iwi/if_iwi.c == --- head/sys/dev/iwi/if_iwi.c Thu Oct 21 19:29:20 2010(r214161) +++ head/sys/dev/iwi/if_iwi.c Thu Oct 21 19:30:55 2010(r214162) @@ -1368,7 +1368,7 @@ iwi_checkforqos(struct ieee80211vap *vap ni = vap-iv_bss; ni-ni_capinfo = capinfo; - ni-ni_associd = associd; + ni-ni_associd = associd 0x3fff; if (wme != NULL) ni-ni_flags |= IEEE80211_NODE_QOS; else ___ 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: r214163 - head/sys/geom/eli
Author: pjd Date: Thu Oct 21 19:44:28 2010 New Revision: 214163 URL: http://svn.freebsd.org/changeset/base/214163 Log: Free opencrypto sessions on suspend, as they also might keep encryption keys. Modified: head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h Modified: head/sys/geom/eli/g_eli.c == --- head/sys/geom/eli/g_eli.c Thu Oct 21 19:30:55 2010(r214162) +++ head/sys/geom/eli/g_eli.c Thu Oct 21 19:44:28 2010(r214163) @@ -314,6 +314,69 @@ g_eli_start(struct bio *bp) } } +static int +g_eli_newsession(struct g_eli_worker *wr) +{ + struct g_eli_softc *sc; + struct cryptoini crie, cria; + int error; + + sc = wr-w_softc; + + bzero(crie, sizeof(crie)); + crie.cri_alg = sc-sc_ealgo; + crie.cri_klen = sc-sc_ekeylen; + if (sc-sc_ealgo == CRYPTO_AES_XTS) + crie.cri_klen = 1; + crie.cri_key = sc-sc_ekeys[0]; + if (sc-sc_flags G_ELI_FLAG_AUTH) { + bzero(cria, sizeof(cria)); + cria.cri_alg = sc-sc_aalgo; + cria.cri_klen = sc-sc_akeylen; + cria.cri_key = sc-sc_akey; + crie.cri_next = cria; + } + + switch (sc-sc_crypto) { + case G_ELI_CRYPTO_SW: + error = crypto_newsession(wr-w_sid, crie, + CRYPTOCAP_F_SOFTWARE); + break; + case G_ELI_CRYPTO_HW: + error = crypto_newsession(wr-w_sid, crie, + CRYPTOCAP_F_HARDWARE); + break; + case G_ELI_CRYPTO_UNKNOWN: + error = crypto_newsession(wr-w_sid, crie, + CRYPTOCAP_F_HARDWARE); + if (error == 0) { + mtx_lock(sc-sc_queue_mtx); + if (sc-sc_crypto == G_ELI_CRYPTO_UNKNOWN) + sc-sc_crypto = G_ELI_CRYPTO_HW; + mtx_unlock(sc-sc_queue_mtx); + } else { + error = crypto_newsession(wr-w_sid, crie, + CRYPTOCAP_F_SOFTWARE); + mtx_lock(sc-sc_queue_mtx); + if (sc-sc_crypto == G_ELI_CRYPTO_UNKNOWN) + sc-sc_crypto = G_ELI_CRYPTO_SW; + mtx_unlock(sc-sc_queue_mtx); + } + break; + default: + panic(%s: invalid condition, __func__); + } + + return (error); +} + +static void +g_eli_freesession(struct g_eli_worker *wr) +{ + + crypto_freesession(wr-w_sid); +} + static void g_eli_cancel(struct g_eli_softc *sc) { @@ -361,6 +424,7 @@ g_eli_worker(void *arg) struct g_eli_softc *sc; struct g_eli_worker *wr; struct bio *bp; + int error; wr = arg; sc = wr-w_softc; @@ -388,7 +452,7 @@ again: if (sc-sc_flags G_ELI_FLAG_DESTROY) { g_eli_cancel(sc); LIST_REMOVE(wr, w_next); - crypto_freesession(wr-w_sid); + g_eli_freesession(wr); free(wr, M_ELI); G_ELI_DEBUG(1, Thread %s exiting., curthread-td_proc-p_comm); @@ -411,12 +475,21 @@ again: * Suspend requested, mark the worker as * suspended and go to sleep. */ - wr-w_active = 0; + if (wr-w_active) { + g_eli_freesession(wr); + wr-w_active = FALSE; + } wakeup(sc-sc_workers); msleep(sc, sc-sc_queue_mtx, PRIBIO, geli:suspend, 0); - if (!(sc-sc_flags G_ELI_FLAG_SUSPEND)) - wr-w_active = 1; + if (!wr-w_active + !(sc-sc_flags G_ELI_FLAG_SUSPEND)) { + error = g_eli_newsession(wr); + KASSERT(error == 0, + (g_eli_newsession() failed on resume (error=%d), + error)); + wr-w_active = TRUE; + } goto again; } msleep(sc, sc-sc_queue_mtx, PDROP, geli:w, 0); @@ -630,7 +703,6 @@ g_eli_create(struct gctl_req *req, struc struct g_geom *gp; struct g_provider *pp; struct g_consumer *cp; - struct cryptoini crie, cria; u_int i,
Re: svn commit: r214125 - head/sys/kern
On Thursday, October 21, 2010 3:08:12 pm Xin LI wrote: On 10/21/10 04:46, John Baldwin wrote: On Thursday, October 21, 2010 4:57:25 am Xin LI wrote: Author: delphij Date: Thu Oct 21 08:57:25 2010 New Revision: 214125 URL: http://svn.freebsd.org/changeset/base/214125 Log: In syscall_module_handler(): all switch branches return, remove unreached code as pointed out in a Chinese forum [1]. [1] http://www.freebsdchina.org/forum/viewtopic.php?t=50619 Pointed out by: btw616 btw s qq com MFC after: 1 month I think this exposes a bug though in that the default case doesn't pass through to chainevh. The default case should look more like the removed code (except returning EOPNOTSUPP instead of 0 if there is no chainevh). Hmm... It sounds reasonable in theory (so that modules can handle events other than MOD_LOAD/UNLOAD) at least, while I don't think it's really being used anywhere. Yes, I agree it probably isn't used, but it'd be a weird surprise if someone tried to make use of it in the future for MOD_QUIESCE or the like. Will the attached patch look reasonable? (If data-chainevh is NULL then operation is not supported, if not then delegate to the module). Yes, I think this is fine. -- 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: r214174 - head/usr.bin/unzip
Author: glebius Date: Thu Oct 21 20:22:00 2010 New Revision: 214174 URL: http://svn.freebsd.org/changeset/base/214174 Log: Fix typo in last commit. Submitted by: bcr Modified: head/usr.bin/unzip/unzip.1 Modified: head/usr.bin/unzip/unzip.1 == --- head/usr.bin/unzip/unzip.1 Thu Oct 21 20:21:36 2010(r214173) +++ head/usr.bin/unzip/unzip.1 Thu Oct 21 20:22:00 2010(r214174) @@ -111,7 +111,7 @@ Note that only one of and .Fl u may be specified. -Is specified filename is +If specified filename is .Va Qq - , then data is read from .Va stdin . ___ 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: r214181 - head/sys/kern
Author: delphij Date: Thu Oct 21 20:31:50 2010 New Revision: 214181 URL: http://svn.freebsd.org/changeset/base/214181 Log: Call chainevh callback when we are invoked with neither MOD_LOAD nor MOD_UNLOAD. This makes it possible to add custom hooks for other module events. Return EOPNOTSUPP when there is no callback available. Pointed out by: jhb Reviewed by: jhb MFC after:1 month Modified: head/sys/kern/kern_syscalls.c Modified: head/sys/kern/kern_syscalls.c == --- head/sys/kern/kern_syscalls.c Thu Oct 21 20:30:35 2010 (r214180) +++ head/sys/kern/kern_syscalls.c Thu Oct 21 20:31:50 2010 (r214181) @@ -181,7 +181,9 @@ syscall_module_handler(struct module *mo error = syscall_deregister(data-offset, data-old_sysent); return (error); default: - return EOPNOTSUPP; + if (data-chainevh) + return (data-chainevh(mod, what, data-chainarg)); + return (EOPNOTSUPP); } /* NOTREACHED */ ___ 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: r214185 - head/tools/tools/syscall_timing
Author: rwatson Date: Thu Oct 21 21:08:12 2010 New Revision: 214185 URL: http://svn.freebsd.org/changeset/base/214185 Log: Universally use uintmax_t in syscall_timing; rearrange arithmetic to suffer fewer rounding errors with smaller numbers; fix argc validation so multiple tests run on a single command line. Sponsored by: Google, Inc. MFC after:2 weeks Modified: head/tools/tools/syscall_timing/syscall_timing.c Modified: head/tools/tools/syscall_timing/syscall_timing.c == --- head/tools/tools/syscall_timing/syscall_timing.cThu Oct 21 20:34:29 2010(r214184) +++ head/tools/tools/syscall_timing/syscall_timing.cThu Oct 21 21:08:12 2010(r214185) @@ -87,10 +87,10 @@ benchmark_stop(void) assert(clock_gettime(CLOCK_REALTIME, ts_end) == 0); } -uint64_t -test_getuid(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_getuid(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i; + uintmax_t i; /* * Thread-local data should require no locking if system @@ -106,10 +106,10 @@ test_getuid(uint64_t num, uint64_t int_a return (i); } -uint64_t -test_getppid(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_getppid(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i; + uintmax_t i; /* * This is process-local, but can change, so will require a @@ -125,11 +125,11 @@ test_getppid(uint64_t num, uint64_t int_ return (i); } -uint64_t -test_clock_gettime(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_clock_gettime(uintmax_t num, uintmax_t int_arg, const char *path) { struct timespec ts; - uint64_t i; + uintmax_t i; benchmark_start(); for (i = 0; i num; i++) { @@ -141,8 +141,8 @@ test_clock_gettime(uint64_t num, uint64_ return (i); } -uint64_t -test_pipe(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_pipe(uintmax_t num, uintmax_t int_arg, const char *path) { int fd[2], i; @@ -169,10 +169,10 @@ test_pipe(uint64_t num, uint64_t int_arg return (i); } -uint64_t -test_socket_stream(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_socket_stream(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i, so; + uintmax_t i, so; so = socket(int_arg, SOCK_STREAM, 0); if (so 0) @@ -191,10 +191,10 @@ test_socket_stream(uint64_t num, uint64_ return (i); } -uint64_t -test_socket_dgram(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_socket_dgram(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i, so; + uintmax_t i, so; so = socket(int_arg, SOCK_DGRAM, 0); if (so 0) @@ -213,10 +213,10 @@ test_socket_dgram(uint64_t num, uint64_t return (i); } -uint64_t -test_socketpair_stream(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_socketpair_stream(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i; + uintmax_t i; int so[2]; if (socketpair(PF_LOCAL, SOCK_STREAM, 0, so) == -1) @@ -236,10 +236,10 @@ test_socketpair_stream(uint64_t num, uin return (i); } -uint64_t -test_socketpair_dgram(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_socketpair_dgram(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i; + uintmax_t i; int so[2]; if (socketpair(PF_LOCAL, SOCK_DGRAM, 0, so) == -1) @@ -259,10 +259,10 @@ test_socketpair_dgram(uint64_t num, uint return (i); } -uint64_t -test_open_close(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_open_close(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i; + uintmax_t i; int fd; fd = open(path, O_RDONLY); @@ -283,11 +283,11 @@ test_open_close(uint64_t num, uint64_t i return (i); } -uint64_t -test_open_read_close(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_open_read_close(uintmax_t num, uintmax_t int_arg, const char *path) { char buf[int_arg]; - uint64_t i; + uintmax_t i; int fd; fd = open(path, O_RDONLY); @@ -310,8 +310,8 @@ test_open_read_close(uint64_t num, uint6 return (i); } -uint64_t -test_dup(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_dup(uintmax_t num, uintmax_t int_arg, const char *path) { int fd, i, shmfd; @@ -334,10 +334,10 @@ test_dup(uint64_t num, uint64_t int_arg, return (i); } -uint64_t -test_shmfd(uint64_t num, uint64_t int_arg, const char *path) +uintmax_t +test_shmfd(uintmax_t num, uintmax_t int_arg, const char *path) { - uint64_t i, shmfd; + uintmax_t i, shmfd; shmfd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600);
svn commit: r214187 - head/usr.sbin/pc-sysinstall/backend
Author: imp Date: Thu Oct 21 22:33:50 2010 New Revision: 214187 URL: http://svn.freebsd.org/changeset/base/214187 Log: Minor tweaks in compression support: o We need an eval here to get the right expansion of the command o bs=128k doesn't work in some cases, so eliminate it and cope with the minor performance hit. Submitted by: john hixson Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh == --- head/usr.sbin/pc-sysinstall/backend/functions.shThu Oct 21 22:18:12 2010(r214186) +++ head/usr.sbin/pc-sysinstall/backend/functions.shThu Oct 21 22:33:50 2010(r214187) @@ -138,7 +138,7 @@ rc_halt() fi echo Running: ${CMD} ${LOGOUT} - ${CMD} ${LOGOUT} 2${LOGOUT} + eval ${CMD} ${LOGOUT} 2${LOGOUT} STATUS=$? if [ ${STATUS} != 0 ] then @@ -364,37 +364,37 @@ write_image() case ${COMPRESSION} in lzw) -rc_halt uncompress ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k +rc_halt uncompress ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} IMAGE_FILE=${IMAGE_FILE%.Z} ;; lzo) -rc_halt lzop -d $IMAGE_{FILE} -c | dd of=${DEVICE_FILE} bs=128k +rc_halt lzop -d $IMAGE_{FILE} -c | dd of=${DEVICE_FILE} IMAGE_FILE=${IMAGE_FILE%.lzo} ;; lzma) -rc_halt lzma -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k +rc_halt lzma -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} IMAGE_FILE=${IMAGE_FILE%.lzma} ;; gzip) -rc_halt gunzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k +rc_halt gunzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} IMAGE_FILE=${IMAGE_FILE%.gz} ;; bzip2) -rc_halt bunzip2 ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k +rc_halt bunzip2 ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} IMAGE_FILE=${IMAGE_FILE%.bz2} ;; xz) -rc_halt xz -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k +rc_halt xz -d ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} IMAGE_FILE=${IMAGE_FILE%.xz} ;; zip) -rc_halt unzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} bs=128k +rc_halt unzip ${IMAGE_FILE} -c | dd of=${DEVICE_FILE} IMAGE_FILE=${IMAGE_FILE%.zip} ;; @@ -404,7 +404,7 @@ write_image() esac else -rc_halt dd if=${IMAGE_FILE} of=${DEVICE_FILE} bs=128k +rc_halt dd if=${IMAGE_FILE} of=${DEVICE_FILE} fi }; ___ 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: r214188 - head/usr.sbin/pc-sysinstall/backend
Author: imp Date: Thu Oct 21 22:46:10 2010 New Revision: 214188 URL: http://svn.freebsd.org/changeset/base/214188 Log: More support for IMAGE installations Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh == --- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Thu Oct 21 22:33:50 2010(r214187) +++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Thu Oct 21 22:46:10 2010(r214188) @@ -219,9 +219,17 @@ setup_mbr_partitions() USINGENCROOT=0 ; export USINGENCROOT fi + if [ -n ${IMAGE} ] + then +FS=IMAGE +SIZE=`ls -l ${IMAGE} | awk '{ print $5 }'` +MNT=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2` + SIZE=`convert_byte_to_megabyte $SIZE` + fi + # Now check that these values are sane case $FS in -UFS|UFS+S|UFS+J|UFS+SUJ|ZFS|SWAP) ;; +UFS|UFS+S|UFS+J|UFS+SUJ|ZFS|SWAP|IMAGE) ;; *) exit_err ERROR: Invalid file system specified on $line ;; esac ___ 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: r214189 - head/usr.sbin/pc-sysinstall/backend
Author: imp Date: Thu Oct 21 23:08:42 2010 New Revision: 214189 URL: http://svn.freebsd.org/changeset/base/214189 Log: Fix two typos Submitted by: Benedict Reuschling Modified: head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh == --- head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Thu Oct 21 22:46:10 2010(r214188) +++ head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Thu Oct 21 23:08:42 2010(r214189) @@ -70,7 +70,7 @@ start_extract_uzip_tar() if [ $? != 0 ] then cd / -echo TAR failure occured: ${LOGOUT} +echo TAR failure occurred: ${LOGOUT} cat ${FSMNT}/.tar-extract.log | grep tar: ${LOGOUT} umount ${FSMNT}.uzip mdconfig -d -u ${MDDEVICE} @@ -275,7 +275,7 @@ EOF INSFILE=${OUTFILE} ; export INSFILE } -# Function which does the rsync download from the server specifed in cfg +# Function which does the rsync download from the server specified in cfg start_rsync_copy() { # Load our rsync config values ___ 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: r214191 - head/usr.sbin/pc-sysinstall/backend-query
Author: imp Date: Fri Oct 22 00:10:48 2010 New Revision: 214191 URL: http://svn.freebsd.org/changeset/base/214191 Log: Remove unnecessary variable. Submitted by: Alex Kozlov Modified: head/usr.sbin/pc-sysinstall/backend-query/query-langs.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/query-langs.sh == --- head/usr.sbin/pc-sysinstall/backend-query/query-langs.shThu Oct 21 23:45:57 2010(r214190) +++ head/usr.sbin/pc-sysinstall/backend-query/query-langs.shFri Oct 22 00:10:48 2010(r214191) @@ -25,8 +25,6 @@ # # $FreeBSD$ -FOUND=0 - cat ${PROGDIR}/conf/avail-langs exit 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: r214192 - head/usr.sbin/pc-sysinstall/backend-query
Author: imp Date: Fri Oct 22 00:11:55 2010 New Revision: 214192 URL: http://svn.freebsd.org/changeset/base/214192 Log: More simplifications Submitted by: Alex Kozlov Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh head/usr.sbin/pc-sysinstall/backend-query/test-live.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh == --- head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh Fri Oct 22 00:10:48 2010(r214191) +++ head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh Fri Oct 22 00:11:55 2010(r214192) @@ -26,25 +26,16 @@ # $FreeBSD$ # Query a disk for partitions and display them -# +# -. ${PROGDIR}/backend/functions.sh . ${PROGDIR}/backend/functions-disk.sh -if [ -z ${1} ] -then - echo Error: No disk specified! - exit 1 -fi - -if [ ! -e /dev/${1} ] -then - echo Error: Disk /dev/${1} does not exist! - exit 1 -fi - DISK=${1} +[ -z ${DISK} ] { echo 'Error: No disk specified!'; exit 1; } +[ ! -e /dev/${DISK} ] \ + { echo Error: Disk /dev/${DISK} does not exist!; exit 1; } + get_disk_cyl ${DISK} CYLS=${VAL} Modified: head/usr.sbin/pc-sysinstall/backend-query/test-live.sh == --- head/usr.sbin/pc-sysinstall/backend-query/test-live.sh Fri Oct 22 00:10:48 2010(r214191) +++ head/usr.sbin/pc-sysinstall/backend-query/test-live.sh Fri Oct 22 00:11:55 2010(r214192) @@ -28,13 +28,6 @@ # Script which checks if we are running from install media, or real system # -dmesg | grep md0: Preloaded image /dev/null 2/dev/null -if [ $? = 0 ] -then - echo INSTALL-MEDIA - exit 0 -else - echo REAL-DISK - exit 1 -fi +dmesg | grep -q 'md0: Preloaded image' || { echo 'REAL-DISK'; exit 1; } +echo 'INSTALL-MEDIA' ___ 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: r214137 - head/usr.bin/unzip
On Thu, 21 Oct 2010, Gleb Smirnoff wrote: Log: Make it possible to read input from stdin. Without this change I don't see a way to unpack a multivolume archive without wasting disk space for a temporary file. What's wrong with the canonical cat foo*.zip | unzip /dev/stdin? This is better for light use than engooping utilities with support for -. This failed for an old ports version of unzip because it stat'ed /dev/stdin.zip and /dev/stdin.ZIP and found neither. Bogus. Then I tried foo.zip where foo.zip is a symlink to /dev/stdin. (This hack is also useful for broken disk utilities that want disk names in /dev with special names.) This failed because unzip first tried to seek on the pipe (failure ignored), then tried to read 0 bytes from the pipe (the read succeeded but failure to find the central directory followed, apparently because it used st_size as the size of the file. These bugs seem to be missing in the current version. /dev/stdin works, and so does a symlink to /dev/stdin although it does some lstats which probably break in other cases for symlinks. The not-unused md5 utility is still broken on device files but not on pipes using similar techniques in its library (MDXFileChunk()). First it does an fstat to get st_size. Then it tries to seek, and if the seek fails it uses a method that actually works and necessarily doesn't use st_size. Old versions used a working method in all cases. So you have to use a hack like cat /dev/ad0 | md5 to checksum a disk device, else you get the same checksum for all disks as for all devices and all empty files. Bruce ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r214194 - in head/libexec/rtld-elf: . ia64
Author: marcel Date: Fri Oct 22 04:43:04 2010 New Revision: 214194 URL: http://svn.freebsd.org/changeset/base/214194 Log: Unbreak ia64. With r169630 I disabled symbol versioning because it broke rtld. With r211706 rtld got broken for ia64 powerpc64. It was fixed for powerpc64 with r212497. In between, r211749 removed the exports table because the version script handled the exports. But wait, symbol versioning was disabled on ia64. With exports controlled by the version script and symbol versioning disabled, all symbols are exported and too many symbols bind to the definition in rtld. Let's just say that waird things happen. So, enable symbol versioning on ia64 and apply a work-around for the SIGSEGV that triggered r169630 to begin with: when rtld relocates itself, it comes across r_debug_state and for some reason can't find the definition. This causes a failure, relocation aborts and null pointers galore. The work-around is to ignore the missing definition when rtld is relocating itself and keep going. Maybe with the next binutils this will all go away. Maybe not, in which case I still need to figure out why r_debug_state cannot be found. BTW: r_debug_state is in the symbol map -- I don't think any other rtld symbols that rtld references are in the symbol map... Modified: head/libexec/rtld-elf/Makefile head/libexec/rtld-elf/ia64/reloc.c Modified: head/libexec/rtld-elf/Makefile == --- head/libexec/rtld-elf/Makefile Fri Oct 22 03:05:34 2010 (r214193) +++ head/libexec/rtld-elf/Makefile Fri Oct 22 04:43:04 2010 (r214194) @@ -34,7 +34,6 @@ LDFLAGS+= -shared -Wl,-Bsymbolic DPADD= ${LIBC_PIC} LDADD= -lc_pic -lssp_nonshared -.if ${MACHINE_CPUARCH} != ia64 .if ${MK_SYMVER} == yes LIBCDIR= ${.CURDIR}/../../lib/libc VERSION_DEF= ${LIBCDIR}/Versions.def @@ -48,7 +47,6 @@ ${PROG}: ${VERSION_MAP} SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map .endif .endif -.endif .sinclude ${.CURDIR}/${RTLD_ARCH}/Makefile.inc Modified: head/libexec/rtld-elf/ia64/reloc.c == --- head/libexec/rtld-elf/ia64/reloc.c Fri Oct 22 03:05:34 2010 (r214193) +++ head/libexec/rtld-elf/ia64/reloc.c Fri Oct 22 04:43:04 2010 (r214194) @@ -195,9 +195,22 @@ reloc_non_plt_obj(Obj_Entry *obj_rtld, O int sym_index; def = find_symdef(ELF_R_SYM(rela-r_info), obj, defobj, - false, cache); - if (def == NULL) - return -1; + true, cache); + if (def == NULL) { + /* +* XXX r_debug_state is problematic and find_symdef() +* returns NULL for it. This probably has something to +* do with symbol versioning (r_debug_state is in the +* symbol map). If we return -1 in that case we abort +* relocating rtld, which typically is fatal. So, for +* now just skip the symbol when we're relocating +* rtld. We don't care about r_debug_state unless we +* are being debugged. +*/ + if (obj != obj_rtld) + return -1; + break; + } if (def-st_shndx != SHN_UNDEF) { target = (Elf_Addr)(defobj-relocbase + def-st_value); ___ 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