svn commit: r292746 - stable/10/sys/dev/md
Author: kib Date: Sat Dec 26 11:10:44 2015 New Revision: 292746 URL: https://svnweb.freebsd.org/changeset/base/292746 Log: MFC r292128: In md(4) over vnode, correct handling of the unaligned unmapped io requests which page alignment + size is greater than MAXPHYS. Split request up to the size of io which fits into pbuf KVA with alignment, and retry if a part of the bio is left unprocessed. Modified: stable/10/sys/dev/md/md.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/md/md.c == --- stable/10/sys/dev/md/md.c Sat Dec 26 09:16:05 2015(r292745) +++ stable/10/sys/dev/md/md.c Sat Dec 26 11:10:44 2015(r292746) @@ -825,8 +825,8 @@ mdstart_vnode(struct md_s *sc, struct bi struct buf *pb; bus_dma_segment_t *vlist; struct thread *td; - off_t len, zerosize; - int ma_offs; + off_t iolen, len, zerosize; + int ma_offs, npages; switch (bp->bio_cmd) { case BIO_READ: @@ -847,6 +847,7 @@ mdstart_vnode(struct md_s *sc, struct bi pb = NULL; piov = NULL; ma_offs = bp->bio_ma_offset; + len = bp->bio_length; /* * VNODE I/O @@ -879,7 +880,6 @@ mdstart_vnode(struct md_s *sc, struct bi auio.uio_iovcnt = howmany(bp->bio_length, zerosize); piov = malloc(sizeof(*piov) * auio.uio_iovcnt, M_MD, M_WAITOK); auio.uio_iov = piov; - len = bp->bio_length; while (len > 0) { piov->iov_base = __DECONST(void *, zero_region); piov->iov_len = len; @@ -893,7 +893,6 @@ mdstart_vnode(struct md_s *sc, struct bi piov = malloc(sizeof(*piov) * bp->bio_ma_n, M_MD, M_WAITOK); auio.uio_iov = piov; vlist = (bus_dma_segment_t *)bp->bio_data; - len = bp->bio_length; while (len > 0) { piov->iov_base = (void *)(uintptr_t)(vlist->ds_addr + ma_offs); @@ -909,11 +908,20 @@ mdstart_vnode(struct md_s *sc, struct bi piov = auio.uio_iov; } else if ((bp->bio_flags & BIO_UNMAPPED) != 0) { pb = getpbuf(&md_vnode_pbuf_freecnt); - pmap_qenter((vm_offset_t)pb->b_data, bp->bio_ma, bp->bio_ma_n); - aiov.iov_base = (void *)((vm_offset_t)pb->b_data + ma_offs); - aiov.iov_len = bp->bio_length; + bp->bio_resid = len; +unmapped_step: + npages = atop(min(MAXPHYS, round_page(len + (ma_offs & + PAGE_MASK; + iolen = min(ptoa(npages) - (ma_offs & PAGE_MASK), len); + KASSERT(iolen > 0, ("zero iolen")); + pmap_qenter((vm_offset_t)pb->b_data, + &bp->bio_ma[atop(ma_offs)], npages); + aiov.iov_base = (void *)((vm_offset_t)pb->b_data + + (ma_offs & PAGE_MASK)); + aiov.iov_len = iolen; auio.uio_iov = &aiov; auio.uio_iovcnt = 1; + auio.uio_resid = iolen; } else { aiov.iov_base = bp->bio_data; aiov.iov_len = bp->bio_length; @@ -937,15 +945,21 @@ mdstart_vnode(struct md_s *sc, struct bi vn_finished_write(mp); } - if (pb) { - pmap_qremove((vm_offset_t)pb->b_data, bp->bio_ma_n); + if (pb != NULL) { + pmap_qremove((vm_offset_t)pb->b_data, npages); + if (error == 0) { + len -= iolen; + bp->bio_resid -= iolen; + ma_offs += iolen; + if (len > 0) + goto unmapped_step; + } relpbuf(pb, &md_vnode_pbuf_freecnt); } - if (piov != NULL) - free(piov, M_MD); - - bp->bio_resid = auio.uio_resid; + free(piov, M_MD); + if (pb == NULL) + bp->bio_resid = auio.uio_resid; return (error); } ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r292747 - stable/10/lib/liblzma
Author: ume Date: Sat Dec 26 12:06:52 2015 New Revision: 292747 URL: https://svnweb.freebsd.org/changeset/base/292747 Log: MFC 276962: Do not regenerate and install liblzma.pc when only build libraries aka do not regenerate while generating 32bits libs Reported by: Shin-ichi Okano Modified: stable/10/lib/liblzma/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/liblzma/Makefile == --- stable/10/lib/liblzma/Makefile Sat Dec 26 11:10:44 2015 (r292746) +++ stable/10/lib/liblzma/Makefile Sat Dec 26 12:06:52 2015 (r292747) @@ -155,12 +155,13 @@ CFLAGS+= -DSYMBOL_VERSIONING CLEANFILES+= liblzma.pc +.if !defined(LIBRARIES_ONLY) all: liblzma.pc liblzma.pc: liblzma.pc.in @sed -e 's,@prefix@,/usr,g ; \ s,@exec_prefix@,/usr,g ; \ - s,@libdir@,${LIBDIR},g ; \ - s,@includedir@,${INCLUDEDIR},g ; \ + s,@libdir@,/usr/lib,g ; \ + s,@includedir@,/usr/include,g ; \ s,@PACKAGE_URL@,http://tukaani.org/xz/,g ; \ s,@PACKAGE_VERSION@,${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH},g ; \ s,@PTHREAD_CFLAGS@,,g ; \ @@ -169,5 +170,6 @@ liblzma.pc: liblzma.pc.in beforeinstall: @${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ liblzma.pc ${DESTDIR}${LIBDATADIR}/pkgconfig +.endif .include ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r292753 - stable/10/usr.bin/bc
Author: pfg Date: Sat Dec 26 18:26:44 2015 New Revision: 292753 URL: https://svnweb.freebsd.org/changeset/base/292753 Log: MFC r291155: bc: sync with OpenBSD tty.c Rev. 1.3 Avoid unintended problems with operator precedence when doing an assignment and comparison. bc.1, Rev. 1.31, 1.32 '.Ql Quit' -> '.Ql quit' because only the lowercase command is valid. Clarify sentence about `quit` in BUGS section. extern.h, Rev. 1.12 whitespace bc.y, Rev. 1.47 Prefer setvbuf() to setlinebuf() for portability Obtained from:OpenBSD Modified: stable/10/usr.bin/bc/bc.1 stable/10/usr.bin/bc/bc.y stable/10/usr.bin/bc/extern.h stable/10/usr.bin/bc/tty.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/bc/bc.1 == --- stable/10/usr.bin/bc/bc.1 Sat Dec 26 18:21:32 2015(r292752) +++ stable/10/usr.bin/bc/bc.1 Sat Dec 26 18:26:44 2015(r292753) @@ -1,5 +1,5 @@ .\"$FreeBSD$ -.\"$OpenBSD: bc.1,v 1.30 2014/01/14 07:42:42 jmc Exp $ +.\"$OpenBSD: bc.1,v 1.32 2015/11/17 05:45:35 mmcc Exp $ .\" .\" Copyright (C) Caldera International Inc. 2001-2002. .\" All rights reserved. @@ -35,7 +35,7 @@ .\" .\"@(#)bc.16.8 (Berkeley) 8/8/91 .\" -.Dd April 16, 2014 +.Dd November 21 2015 .Dt BC 1 .Os .Sh NAME @@ -407,8 +407,9 @@ The current version of the utility was written by .An Otto Moerbeek . .Sh BUGS -.Ql Quit -is interpreted when read, not when executed. +The +.Ql quit +statement is interpreted when read, not when executed. .Pp Some non-portable extensions, as found in the GNU version of the .Nm Modified: stable/10/usr.bin/bc/bc.y == --- stable/10/usr.bin/bc/bc.y Sat Dec 26 18:21:32 2015(r292752) +++ stable/10/usr.bin/bc/bc.y Sat Dec 26 18:26:44 2015(r292753) @@ -1125,7 +1125,7 @@ main(int argc, char *argv[]) int ch, i; init(); - setlinebuf(stdout); + setvbuf(stdout, NULL, _IOLBF, 0); sargv = malloc(argc * sizeof(char *)); if (sargv == NULL) Modified: stable/10/usr.bin/bc/extern.h == --- stable/10/usr.bin/bc/extern.h Sat Dec 26 18:21:32 2015 (r292752) +++ stable/10/usr.bin/bc/extern.h Sat Dec 26 18:26:44 2015 (r292753) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $OpenBSD: extern.h,v 1.10 2013/09/19 16:12:01 otto Exp $ */ +/* $OpenBSD: extern.h,v 1.12 2014/04/17 19:07:14 otto Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek @@ -39,9 +39,9 @@ extern intfileindex; extern int sargc; extern const char **sargv; extern const char *filename; -extern bool interactive; -extern EditLine*el; -extern History *hist; -extern HistEventhe; +extern bool interactive; +extern EditLine*el; +extern History *hist; +extern HistEvent he; extern char*cmdexpr; extern struct termios ttysaved; Modified: stable/10/usr.bin/bc/tty.c == --- stable/10/usr.bin/bc/tty.c Sat Dec 26 18:21:32 2015(r292752) +++ stable/10/usr.bin/bc/tty.c Sat Dec 26 18:26:44 2015(r292753) @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $OpenBSD: tty.c,v 1.2 2013/11/12 13:54:51 deraadt Exp $*/ +/* $OpenBSD: tty.c,v 1.3 2015/09/05 09:49:24 jsg Exp $*/ /* * Copyright (c) 2013, Otto Moerbeek @@ -30,7 +30,7 @@ settty(struct termios *t) { int ret; - while ((ret = tcsetattr(0, TCSADRAIN, t) == -1) && errno == EINTR) + while ((ret = tcsetattr(0, TCSADRAIN, t)) == -1 && errno == EINTR) continue; return ret; } @@ -40,7 +40,7 @@ gettty(struct termios *t) { int ret; - while ((ret = tcgetattr(0, t) == -1) && errno == EINTR) + while ((ret = tcgetattr(0, t)) == -1 && errno == EINTR) continue; return ret; } ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r292754 - stable/10/bin/ed
Author: pfg Date: Sat Dec 26 18:37:01 2015 New Revision: 292754 URL: https://svnweb.freebsd.org/changeset/base/292754 Log: MFC r292454, r292455 ed(1): Prevent possible string overflows Use strlcpy to guarantee NULL termination. With hint from: imp, cem, ngie CID: 1007252 Modified: stable/10/bin/ed/main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/ed/main.c == --- stable/10/bin/ed/main.c Sat Dec 26 18:26:44 2015(r292753) +++ stable/10/bin/ed/main.c Sat Dec 26 18:37:01 2015(r292754) @@ -505,7 +505,8 @@ exec_command(void) return ERR; else if (open_sbuf() < 0) return FATAL; - if (*fnp && *fnp != '!') strcpy(old_filename, fnp); + if (*fnp && *fnp != '!') +strlcpy(old_filename, fnp, PATH_MAX); #ifdef BACKWARDS if (*fnp == '\0' && *old_filename == '\0') { errmsg = "no current filename"; @@ -532,7 +533,8 @@ exec_command(void) return ERR; } GET_COMMAND_SUFFIX(); - if (*fnp) strcpy(old_filename, fnp); + if (*fnp) + strlcpy(old_filename, fnp, PATH_MAX); printf("%s\n", strip_escapes(old_filename)); break; case 'g': @@ -663,7 +665,7 @@ exec_command(void) GET_COMMAND_SUFFIX(); if (!isglobal) clear_undo_stack(); if (*old_filename == '\0' && *fnp != '!') - strcpy(old_filename, fnp); + strlcpy(old_filename, fnp, PATH_MAX); #ifdef BACKWARDS if (*fnp == '\0' && *old_filename == '\0') { errmsg = "no current filename"; @@ -797,7 +799,7 @@ exec_command(void) return ERR; GET_COMMAND_SUFFIX(); if (*old_filename == '\0' && *fnp != '!') - strcpy(old_filename, fnp); + strlcpy(old_filename, fnp, PATH_MAX); #ifdef BACKWARDS if (*fnp == '\0' && *old_filename == '\0') { errmsg = "no current filename"; ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r292760 - in stable/10: include lib/libc/net
Author: ume Date: Sun Dec 27 00:37:04 2015 New Revision: 292760 URL: https://svnweb.freebsd.org/changeset/base/292760 Log: MFC r292514: addrinfo.ai_family is an address family, not a protocol family. PR: 162434 Modified: stable/10/include/netdb.h stable/10/lib/libc/net/getaddrinfo.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/include/netdb.h == --- stable/10/include/netdb.h Sat Dec 26 23:01:34 2015(r292759) +++ stable/10/include/netdb.h Sun Dec 27 00:37:04 2015(r292760) @@ -122,7 +122,7 @@ struct protoent { struct addrinfo { int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ - int ai_family; /* PF_xxx */ + int ai_family; /* AF_xxx */ int ai_socktype;/* SOCK_xxx */ int ai_protocol;/* 0 or IPPROTO_xxx for IPv4 and IPv6 */ socklen_t ai_addrlen; /* length of ai_addr */ Modified: stable/10/lib/libc/net/getaddrinfo.3 == --- stable/10/lib/libc/net/getaddrinfo.3Sat Dec 26 23:01:34 2015 (r292759) +++ stable/10/lib/libc/net/getaddrinfo.3Sun Dec 27 00:37:04 2015 (r292760) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 19, 2015 +.Dd December 21, 2015 .Dt GETADDRINFO 3 .Os .Sh NAME @@ -78,7 +78,7 @@ as defined by .Bd -literal struct addrinfo { int ai_flags; /* input flags */ - int ai_family; /* protocol family for socket */ + int ai_family; /* address family for socket */ int ai_socktype;/* socket type */ int ai_protocol;/* protocol for socket */ socklen_t ai_addrlen; /* length of socket-address */ @@ -94,12 +94,12 @@ The caller can supply the following stru .Fa hints : .Bl -tag -width "ai_socktypeXX" .It Fa ai_family -The protocol family that should be used. +The address family that should be used. When .Fa ai_family is set to -.Dv PF_UNSPEC , -it means the caller will accept any protocol family supported by the +.Dv AF_UNSPEC , +it means the caller will accept any address family supported by the operating system. .It Fa ai_socktype Denotes the type of socket that is wanted: @@ -261,7 +261,7 @@ behaves as if the caller provided a with .Fa ai_family set to -.Dv PF_UNSPEC +.Dv AF_UNSPEC and all other elements set to zero or .Dv NULL . .Pp @@ -373,7 +373,7 @@ int s; const char *cause = NULL; memset(&hints, 0, sizeof(hints)); -hints.ai_family = PF_UNSPEC; +hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; error = getaddrinfo("www.kame.net", "http", &hints, &res0); if (error) { @@ -416,7 +416,7 @@ int nsock; const char *cause = NULL; memset(&hints, 0, sizeof(hints)); -hints.ai_family = PF_UNSPEC; +hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; error = getaddrinfo(NULL, "http", &hints, &res0); ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"
svn commit: r292762 - stable/10/lib/libc/gen
Author: kib Date: Sun Dec 27 00:42:13 2015 New Revision: 292762 URL: https://svnweb.freebsd.org/changeset/base/292762 Log: MFC r292510: Fix lockf(3) cancellation behaviour. Modified: stable/10/lib/libc/gen/lockf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/lockf.c == --- stable/10/lib/libc/gen/lockf.c Sun Dec 27 00:38:57 2015 (r292761) +++ stable/10/lib/libc/gen/lockf.c Sun Dec 27 00:42:13 2015 (r292762) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "un-namespace.h" +#include "libc_private.h" int lockf(int filedes, int function, off_t size) @@ -62,9 +63,12 @@ lockf(int filedes, int function, off_t s break; case F_TEST: fl.l_type = F_WRLCK; - if (_fcntl(filedes, F_GETLK, &fl) == -1) + if (((int (*)(int, int, ...)) + __libc_interposing[INTERPOS_fcntl])(filedes, F_GETLK, &fl) + == -1) return (-1); - if (fl.l_type == F_UNLCK || (fl.l_sysid == 0 && fl.l_pid == getpid())) + if (fl.l_type == F_UNLCK || (fl.l_sysid == 0 && + fl.l_pid == getpid())) return (0); errno = EAGAIN; return (-1); @@ -75,5 +79,6 @@ lockf(int filedes, int function, off_t s /* NOTREACHED */ } - return (_fcntl(filedes, cmd, &fl)); + return (((int (*)(int, int, ...)) + __libc_interposing[INTERPOS_fcntl])(filedes, cmd, &fl)); } ___ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"