svn commit: r303538 - head/usr.bin/sed
Author: ngie Date: Sat Jul 30 04:40:44 2016 New Revision: 303538 URL: https://svnweb.freebsd.org/changeset/base/303538 Log: Explicitly test for cu_fgets returning NULL or !NULL MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/usr.bin/sed/compile.c Modified: head/usr.bin/sed/compile.c == --- head/usr.bin/sed/compile.c Sat Jul 30 03:43:55 2016(r303537) +++ head/usr.bin/sed/compile.c Sat Jul 30 04:40:44 2016(r303538) @@ -546,7 +546,7 @@ compile_subst(const char *p, struct s_su if ((text = realloc(text, asize)) == NULL) err(1, "realloc"); } - } while ((p = cu_fgets())); + } while ((p = cu_fgets()) != NULL); errx(1, "%lu: %s: unterminated substitute in regular expression", linenum, fname); /* NOTREACHED */ @@ -733,7 +733,7 @@ compile_text(size_t *ptlen) if ((text = malloc(asize)) == NULL) err(1, "malloc"); size = 0; - while ((p = cu_fgets(NULL))) { + while ((p = cu_fgets(NULL)) != NULL) { op = s = text + size; for (esc_nl = 0; *p != '\0'; p++) { if (*p == '\\' && p[1] != '\0' && *++p == '\n') ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303530 - head/lib/libc/gen
On 30.07.2016 7:15, Bruce Evans wrote: > On Sat, 30 Jul 2016, Andrey A. Chernov wrote: > >> Log: >> Reset errno for readdirfunc() before contunue. > > In C99, library functions are not permitted to set errno to 0. The glob() > family shouldn't use a different (worse) convention, and POSIX doesn't > seem to have any special wording to allow different behaviour. This is historic practice for this function at least since GLOB_LIMIT was introduced (in 2001) and common across NetBSD/OpenBSD. Existent programs may relay on that to check that limit is reached and not allocation error, so with few additional overwriting from my side I add nothing new: Revision 80525 Modified Sun Jul 29 00:52:37 2001 UTC (15 years ago) by mikeh Rename the GLOB_MAXPATH flag of glob(3) to GLOB_LIMIT to be compatible with NetBSD and OpenBSD. glob(3) will now return GLOB_NOSPACE with errno set to 0 instead of GLOB_LIMIT when we match more than `gl_matchc' patterns. GLOB_MAXPATH has been left as an alias of GLOB_LIMIT to maintain backwards compatibility. errno = 0 is documented. See glob(3), GLOB_NOSPACE section too. The real problem is that glob(3) is very limited in error return codes, so they reuse existent codes with errno hack. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303530 - head/lib/libc/gen
On Sat, 30 Jul 2016, Andrey A. Chernov wrote: Log: Reset errno for readdirfunc() before contunue. In C99, library functions are not permitted to set errno to 0. The glob() family shouldn't use a different (worse) convention, and POSIX doesn't seem to have any special wording to allow different behaviour. Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303537 - head
Author: markj Date: Sat Jul 30 03:43:55 2016 New Revision: 303537 URL: https://svnweb.freebsd.org/changeset/base/303537 Log: Add libprocstat prebuild library dependencies. X-MFC-With: r303531 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Sat Jul 30 03:11:54 2016(r303536) +++ head/Makefile.inc1 Sat Jul 30 03:43:55 2016(r303537) @@ -2096,6 +2096,7 @@ cddl/lib/libctf__L: lib/libz__L # on select architectures though (see cddl/lib/Makefile) .if ${MACHINE_CPUARCH} != "sparc64" _prebuild_libs+= lib/libprocstat lib/libproc lib/librtld_db +lib/libprocstat__L: lib/libelf__L lib/libkvm__L lib/libutil__L lib/libproc__L: lib/libprocstat__L lib/librtld_db__L: lib/libprocstat__L .endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303535 - in head/sys/cddl/contrib/opensolaris/uts: common/dtrace intel/dtrace
Author: markj Date: Sat Jul 30 03:11:53 2016 New Revision: 303535 URL: https://svnweb.freebsd.org/changeset/base/303535 Log: Include fasttrap handling for DATAMODEL_ILP32 when compiling for amd64. MFC after:1 month Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c == --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat Jul 30 03:09:57 2016(r303534) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat Jul 30 03:11:53 2016(r303535) @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -930,6 +931,13 @@ again: ASSERT(0); } +#ifdef __FreeBSD__ + if (SV_PROC_FLAG(p, SV_LP64)) + p->p_model = DATAMODEL_LP64; + else + p->p_model = DATAMODEL_ILP32; +#endif + /* * If the ISA-dependent initialization goes to plan, go back to the * beginning and try to install this freshly made tracepoint. Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c == --- head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Sat Jul 30 03:09:57 2016(r303534) +++ head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Sat Jul 30 03:11:53 2016(r303535) @@ -43,11 +43,11 @@ #include #include #else -#include #include +#include #include #include -#include +#include #include #include #include @@ -283,12 +283,10 @@ fasttrap_anarg(struct reg *rp, int funct DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT | CPU_DTRACE_BADADDR); } else { #endif -#ifdef __i386 - uint32_t *stack = (uint32_t *)rp->r_esp; + uint32_t *stack = (uint32_t *)rp->r_rsp; DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); value = dtrace_fuword32([argno + shift]); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT | CPU_DTRACE_BADADDR); -#endif #ifdef __amd64 } #endif @@ -716,7 +714,6 @@ fasttrap_fulword_noerr(const void *uaddr } #endif -#ifdef __i386__ static uint32_t fasttrap_fuword32_noerr(const void *uaddr) { @@ -727,7 +724,6 @@ fasttrap_fuword32_noerr(const void *uadd return (0); } -#endif static void fasttrap_return_common(struct reg *rp, uintptr_t pc, pid_t pid, @@ -842,7 +838,6 @@ fasttrap_usdt_args64(fasttrap_probe_t *p } #endif -#ifdef __i386__ static void fasttrap_usdt_args32(fasttrap_probe_t *probe, struct reg *rp, int argc, uint32_t *argv) @@ -860,7 +855,6 @@ fasttrap_usdt_args32(fasttrap_probe_t *p argv[i] = 0; } } -#endif static int fasttrap_do_seg(fasttrap_tracepoint_t *tp, struct reg *rp, uintptr_t *addr) @@ -1094,7 +1088,6 @@ fasttrap_pid_probe(struct reg *rp) if (tp->ftt_ids != NULL) { fasttrap_id_t *id; -#ifdef __amd64 if (p->p_model == DATAMODEL_LP64) { for (id = tp->ftt_ids; id != NULL; id = id->fti_next) { fasttrap_probe_t *probe = id->fti_probe; @@ -1136,9 +1129,8 @@ fasttrap_pid_probe(struct reg *rp) } } } else { -#else /* __amd64 */ uintptr_t s0, s1, s2, s3, s4, s5; - uint32_t *stack = (uint32_t *)rp->r_esp; + uint32_t *stack = (uint32_t *)rp->r_rsp; /* * In 32-bit mode, all arguments are passed on the @@ -1191,10 +1183,7 @@ fasttrap_pid_probe(struct reg *rp) t[2], t[3], t[4]); } } -#endif /* __amd64 */ -#ifdef __amd64 } -#endif } /* @@ -1259,12 +1248,10 @@ fasttrap_pid_probe(struct reg *rp) addr = rp->r_rsp + sizeof (uintptr_t); } else { #endif -#ifdef __i386__ uint32_t dst32; - ret = dst32 = fasttrap_fuword32((void *)rp->r_esp); + ret = dst32 = fasttrap_fuword32((void *)rp->r_rsp); dst = dst32; - addr = rp->r_esp + sizeof (uint32_t); -#endif + addr = rp->r_rsp + sizeof (uint32_t); #ifdef __amd64 } #endif @@ -1409,10 +1396,8 @@ fasttrap_pid_probe(struct reg *rp) ret = fasttrap_sulword((void *)rp->r_rsp, rp->r_rbp); } else { #endif -#ifdef __i386__ rp->r_rsp -= sizeof (uint32_t); ret = fasttrap_suword32((void
svn commit: r303536 - head/lib/libc/gen
Author: ache Date: Sat Jul 30 03:11:54 2016 New Revision: 303536 URL: https://svnweb.freebsd.org/changeset/base/303536 Log: Rework r303074 case 4. Don't immediatelly skip directory entries which cause MAXPATHLEN exceeded. Process them first through gl_errfunc() and GLOB_ERR. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c == --- head/lib/libc/gen/glob.cSat Jul 30 03:11:53 2016(r303535) +++ head/lib/libc/gen/glob.cSat Jul 30 03:11:54 2016(r303536) @@ -803,6 +803,13 @@ glob3(Char *pathbuf, Char *pathend, Char } sc += clen; } + if (too_long && ((pglob->gl_errfunc != NULL && + pglob->gl_errfunc(buf, ENAMETOOLONG)) || + (pglob->gl_flags & GLOB_ERR))) { + errno = ENAMETOOLONG; + err = GLOB_ABORTED; + break; + } if (too_long || !match(pathend, pattern, restpattern)) { *pathend = EOS; errno = 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303534 - in head/cddl/contrib/opensolaris/lib/libdtrace: arm i386
Author: markj Date: Sat Jul 30 03:09:57 2016 New Revision: 303534 URL: https://svnweb.freebsd.org/changeset/base/303534 Log: libdtrace: Don't hard-code the native data model. MFC after:1 month Modified: head/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c == --- head/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c Sat Jul 30 03:09:23 2016(r303533) +++ head/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c Sat Jul 30 03:09:57 2016(r303534) @@ -38,9 +38,7 @@ #include #include -#if !defined(sun) -#define PR_MODEL_ILP32 1 -#define PR_MODEL_LP64 2 +#ifdef __FreeBSD__ #include #endif Modified: head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c == --- head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.cSat Jul 30 03:09:23 2016(r303533) +++ head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.cSat Jul 30 03:09:57 2016(r303534) @@ -39,9 +39,8 @@ #include -#ifndef illumos -#define PR_MODEL_ILP32 1 -#define PR_MODEL_LP64 2 +#ifdef __FreeBSD__ +#include #include #endif @@ -93,11 +92,7 @@ dt_pid_has_jump_table(struct ps_prochand char dmodel = Pstatus(P)->pr_dmodel; #else pid_t pid = proc_getpid(P); -#if __i386__ - char dmodel = PR_MODEL_ILP32; -#elif __amd64__ - char dmodel = PR_MODEL_LP64; -#endif + char dmodel = proc_getmodel(P); #endif /* @@ -149,11 +144,7 @@ dt_pid_create_return_probe(struct ps_pro char dmodel = Pstatus(P)->pr_dmodel; #else pid_t pid = proc_getpid(P); -#if __i386__ - char dmodel = PR_MODEL_ILP32; -#elif __amd64__ - char dmodel = PR_MODEL_LP64; -#endif + char dmodel = proc_getmodel(P); #endif /* @@ -310,11 +301,7 @@ dt_pid_create_offset_probe(struct ps_pro char dmodel = Pstatus(P)->pr_dmodel; #else pid_t pid = proc_getpid(P); -#if __i386__ - char dmodel = PR_MODEL_ILP32; -#elif __amd64__ - char dmodel = PR_MODEL_LP64; -#endif + char dmodel = proc_getmodel(P); #endif if ((text = malloc(symp->st_size)) == NULL) { @@ -393,11 +380,7 @@ dt_pid_create_glob_offset_probes(struct char dmodel = Pstatus(P)->pr_dmodel; #else pid_t pid = proc_getpid(P); -#if __i386__ - char dmodel = PR_MODEL_ILP32; -#elif __amd64__ - char dmodel = PR_MODEL_LP64; -#endif + char dmodel = proc_getmodel(P); #endif ftp->ftps_type = DTFTP_OFFSETS; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303533 - in head: lib/libproc share/mk
Author: markj Date: Sat Jul 30 03:09:23 2016 New Revision: 303533 URL: https://svnweb.freebsd.org/changeset/base/303533 Log: libproc: Add proc_getmodel(). This is used by libdtrace to determine the data model of target processes. This allows for the creation of pid provider probes in 32-bit processes on amd64. MFC after:1 month Modified: head/lib/libproc/Makefile head/lib/libproc/_libproc.h head/lib/libproc/libproc.h head/lib/libproc/proc_create.c head/lib/libproc/proc_rtld.c head/lib/libproc/proc_util.c head/share/mk/src.libnames.mk Modified: head/lib/libproc/Makefile == --- head/lib/libproc/Makefile Sat Jul 30 03:07:14 2016(r303532) +++ head/lib/libproc/Makefile Sat Jul 30 03:09:23 2016(r303533) @@ -24,7 +24,7 @@ LIBADD+= cxxrt LIBADD+= supcplusplus .endif -LIBADD+= elf rtld_db util +LIBADD+= elf procstat rtld_db util .if ${MK_CDDL} != "no" LIBADD+= ctf Modified: head/lib/libproc/_libproc.h == --- head/lib/libproc/_libproc.h Sat Jul 30 03:07:14 2016(r303532) +++ head/lib/libproc/_libproc.h Sat Jul 30 03:09:23 2016(r303533) @@ -33,18 +33,22 @@ #include "libproc.h" +struct procstat; + struct proc_handle { pid_t pid;/* Process ID. */ int flags; /* Process flags. */ int status; /* Process status (PS_*). */ int wstat; /* Process wait status. */ + int model; /* Process data model. */ rd_agent_t *rdap; /* librtld_db agent */ rd_loadobj_t *rdobjs; /* Array of loaded objects. */ size_t rdobjsz;/* Array size. */ size_t nobjs; /* Num. objects currently loaded. */ rd_loadobj_t *rdexec; /* rdobj for program executable. */ struct lwpstatus lwps; /* Process status. */ - charexecname[MAXPATHLEN]; /* Path to program executable. */ + struct procstat *procstat; /* libprocstat handle. */ + charexecpath[MAXPATHLEN]; /* Path to program executable. */ }; #ifdef DEBUG Modified: head/lib/libproc/libproc.h == --- head/lib/libproc/libproc.h Sat Jul 30 03:07:14 2016(r303532) +++ head/lib/libproc/libproc.h Sat Jul 30 03:09:23 2016(r303533) @@ -113,6 +113,9 @@ typedef struct lwpstatus { #define FLTBPT -1 } lwpstatus_t; +#definePR_MODEL_ILP32 1 +#definePR_MODEL_LP64 2 + /* Function prototype definitions. */ __BEGIN_DECLS @@ -136,6 +139,7 @@ int proc_name2sym(struct proc_handle *, struct ctf_file *proc_name2ctf(struct proc_handle *, const char *); intproc_setflags(struct proc_handle *, int); intproc_state(struct proc_handle *); +intproc_getmodel(struct proc_handle *); pid_t proc_getpid(struct proc_handle *); intproc_wstatus(struct proc_handle *); intproc_getwstat(struct proc_handle *); Modified: head/lib/libproc/proc_create.c == --- head/lib/libproc/proc_create.c Sat Jul 30 03:07:14 2016 (r303532) +++ head/lib/libproc/proc_create.c Sat Jul 30 03:09:23 2016 (r303533) @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -38,57 +39,103 @@ #include #include +#include +#include + #include "_libproc.h" -static int proc_init(pid_t, int, int, struct proc_handle *); +static int getelfclass(int); +static int proc_init(pid_t, int, int, struct proc_handle **); + +static int +getelfclass(int fd) +{ + GElf_Ehdr ehdr; + Elf *e; + int class; + + class = ELFCLASSNONE; + + if ((e = elf_begin(fd, ELF_C_READ, NULL)) == NULL) + goto out; + if (gelf_getehdr(e, ) == NULL) + goto out; + class = ehdr.e_ident[EI_CLASS]; +out: + (void)elf_end(e); + return (class); +} static int -proc_init(pid_t pid, int flags, int status, struct proc_handle *phdl) +proc_init(pid_t pid, int flags, int status, struct proc_handle **pphdl) { - int mib[4], error; - size_t len; + struct kinfo_proc *kp; + struct proc_handle *phdl; + int error, class, count, fd; + + *pphdl = NULL; + if ((phdl = malloc(sizeof(*phdl))) == NULL) + return (ENOMEM); memset(phdl, 0, sizeof(*phdl)); phdl->pid = pid; phdl->flags = flags; phdl->status = status; + phdl->procstat = procstat_open_sysctl(); + if (phdl->procstat == NULL) + return (ENOMEM); - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] =
svn commit: r303532 - head/lib/libproc
Author: markj Date: Sat Jul 30 03:07:14 2016 New Revision: 303532 URL: https://svnweb.freebsd.org/changeset/base/303532 Log: Add descriptions for fields in struct proc_handle. Remove the unused kq field and some unnecessary includes. MFC after:1 month Modified: head/lib/libproc/_libproc.h Modified: head/lib/libproc/_libproc.h == --- head/lib/libproc/_libproc.h Sat Jul 30 03:05:23 2016(r303531) +++ head/lib/libproc/_libproc.h Sat Jul 30 03:07:14 2016(r303532) @@ -26,27 +26,24 @@ * $FreeBSD$ */ -#include -#include #include -#include #include + #include #include "libproc.h" struct proc_handle { pid_t pid;/* Process ID. */ - int kq; /* Kernel event queue ID. */ int flags; /* Process flags. */ int status; /* Process status (PS_*). */ int wstat; /* Process wait status. */ rd_agent_t *rdap; /* librtld_db agent */ - rd_loadobj_t *rdobjs; - size_t rdobjsz; - size_t nobjs; - struct lwpstatus lwps; - rd_loadobj_t *rdexec; /* rdobj index of program executable. */ + rd_loadobj_t *rdobjs; /* Array of loaded objects. */ + size_t rdobjsz;/* Array size. */ + size_t nobjs; /* Num. objects currently loaded. */ + rd_loadobj_t *rdexec; /* rdobj for program executable. */ + struct lwpstatus lwps; /* Process status. */ charexecname[MAXPATHLEN]; /* Path to program executable. */ }; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303531 - in head: . lib/librtld_db share/mk
Author: markj Date: Sat Jul 30 03:05:23 2016 New Revision: 303531 URL: https://svnweb.freebsd.org/changeset/base/303531 Log: librtld_db: Use the auxv to figure out where to look up loader symbols. Previously, librtld_db just hardcoded /libexec/ld-elf.so, which isn't correct for processes that aren't using the native ABI. With this change, librtld_db can be used to inspect non-native processes; in particular, dtrace -c now works for 32-bit executables on amd64. MFC after:1 month Modified: head/Makefile.inc1 head/lib/librtld_db/Makefile head/lib/librtld_db/rtld_db.c head/lib/librtld_db/rtld_db.h head/share/mk/src.libnames.mk Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Sat Jul 30 02:09:11 2016(r303530) +++ head/Makefile.inc1 Sat Jul 30 03:05:23 2016(r303531) @@ -2095,7 +2095,9 @@ cddl/lib/libctf__L: lib/libz__L # cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built # on select architectures though (see cddl/lib/Makefile) .if ${MACHINE_CPUARCH} != "sparc64" -_prebuild_libs+= lib/libproc lib/librtld_db +_prebuild_libs+= lib/libprocstat lib/libproc lib/librtld_db +lib/libproc__L: lib/libprocstat__L +lib/librtld_db__L: lib/libprocstat__L .endif .if ${MK_CRYPT} != "no" Modified: head/lib/librtld_db/Makefile == --- head/lib/librtld_db/MakefileSat Jul 30 02:09:11 2016 (r303530) +++ head/lib/librtld_db/MakefileSat Jul 30 03:05:23 2016 (r303531) @@ -14,4 +14,6 @@ CFLAGS+= -I${.CURDIR} # Avoid circular dependency, we only need the libproc.h header here. CFLAGS+= -I${.CURDIR:H}/libproc +LIBADD+= elf procstat + .include Modified: head/lib/librtld_db/rtld_db.c == --- head/lib/librtld_db/rtld_db.c Sat Jul 30 02:09:11 2016 (r303530) +++ head/lib/librtld_db/rtld_db.c Sat Jul 30 03:05:23 2016 (r303531) @@ -25,20 +25,30 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - */ + */ + #include __FBSDID("$FreeBSD$"); -#include -#include +#include +#include +#include #include +#include #include +#include +#include #include #include #include -#include +#include + +#include + +#include #include +#include #include #include "rtld_db.h" @@ -55,6 +65,8 @@ void rd_delete(rd_agent_t *rdap) { + if (rdap->rda_procstat != NULL) + procstat_close(rdap->rda_procstat); free(rdap); } @@ -146,9 +158,10 @@ rd_init(int version) rd_err_e rd_loadobj_iter(rd_agent_t *rdap, rl_iter_f *cb, void *clnt_data) { - int cnt, i, lastvn = 0; - rd_loadobj_t rdl; struct kinfo_vmentry *kves, *kve; + rd_loadobj_t rdl; + rd_err_e ret; + int cnt, i, lastvn; DPRINTF("%s\n", __func__); @@ -156,6 +169,9 @@ rd_loadobj_iter(rd_agent_t *rdap, rl_ite warn("ERROR: kinfo_getvmmap() failed"); return (RD_ERR); } + + ret = RD_OK; + lastvn = 0; for (i = 0; i < cnt; i++) { kve = kves + i; if (kve->kve_type == KVME_TYPE_VNODE) @@ -174,12 +190,14 @@ rd_loadobj_iter(rd_agent_t *rdap, rl_ite if (kve->kve_protection & KVME_PROT_EXEC) rdl.rdl_prot |= RD_RDL_X; strlcpy(rdl.rdl_path, kves[lastvn].kve_path, - sizeof(rdl.rdl_path)); - (*cb)(, clnt_data); + sizeof(rdl.rdl_path)); + if ((*cb)(, clnt_data) != 0) { + ret = RD_ERR; + break; + } } free(kves); - - return (RD_OK); + return (ret); } void @@ -195,13 +213,18 @@ rd_new(struct proc_handle *php) { rd_agent_t *rdap; - rdap = malloc(sizeof(rd_agent_t)); - if (rdap) { - memset(rdap, 0, sizeof(rd_agent_t)); - rdap->rda_php = php; - rd_reset(rdap); + rdap = malloc(sizeof(*rdap)); + if (rdap == NULL) + return (NULL); + + memset(rdap, 0, sizeof(rd_agent_t)); + rdap->rda_php = php; + rdap->rda_procstat = procstat_open_sysctl(); + + if (rd_reset(rdap) != RD_OK) { + rd_delete(rdap); + rdap = NULL; } - return (rdap); } @@ -231,24 +254,136 @@ rd_plt_resolution(rd_agent_t *rdap, uint return (RD_ERR); } -rd_err_e -rd_reset(rd_agent_t *rdap) +static int +rtld_syms(rd_agent_t *rdap, const char *rtldpath, u_long base) { + GElf_Shdr shdr; GElf_Sym sym; + Elf *e; + Elf_Data *data; + Elf_Scn *scn; +
svn commit: r303530 - head/lib/libc/gen
Author: ache Date: Sat Jul 30 02:09:11 2016 New Revision: 303530 URL: https://svnweb.freebsd.org/changeset/base/303530 Log: Reset errno for readdirfunc() before contunue. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c == --- head/lib/libc/gen/glob.cSat Jul 30 01:16:06 2016(r303529) +++ head/lib/libc/gen/glob.cSat Jul 30 02:09:11 2016(r303530) @@ -781,8 +781,10 @@ glob3(Char *pathbuf, Char *pathend, Char } /* Initial DOT must be matched literally. */ - if (dp->d_name[0] == '.' && UNPROT(*pattern) != DOT) + if (dp->d_name[0] == '.' && UNPROT(*pattern) != DOT) { + errno = 0; continue; + } memset(, 0, sizeof(mbs)); dc = pathend; sc = dp->d_name; @@ -803,6 +805,7 @@ glob3(Char *pathbuf, Char *pathend, Char } if (too_long || !match(pathend, pattern, restpattern)) { *pathend = EOS; + errno = 0; continue; } err = glob2(pathbuf, --dc, pathend_last, restpattern, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303524 - in head: include lib/libc/stdio
On Sat, 30 Jul 2016, Baptiste Daroussin wrote: Log: Remove _WITH_GETLINE and _WITH_DPRINTF guards When adding getline(3) and dprintf(3) into libc, those guards were added to prevent breaking too many ports. 7 years later the ports tree have been fixed, it is time to remove this FreeBSDism This increases style bugs related to the ifdefs. While here remove the extra parenthesis surrounding dprintf(3) Perhaps they weren't extra. They allowed applications that to #define dprintf and still get the function if they also #define suitable magic _WITH* macros. Now that dprintf() is fully reserved for the implementation, they are just extra because the implementation doesn't have a macro version. Modified: head/include/stdio.h == --- head/include/stdio.hFri Jul 29 23:30:33 2016(r303523) +++ head/include/stdio.hSat Jul 30 01:00:16 2016(r303524) @@ -357,44 +357,8 @@ ssize_t getdelim(char ** __restrict, si FILE*open_memstream(char **, size_t *); int renameat(int, const char *, int, const char *); int vdprintf(int, const char * __restrict, __va_list); - -/* - * Every programmer and his dog wrote functions called getline() and dprintf() - * before POSIX.1-2008 came along and decided to usurp the names, so we - * don't prototype them by default unless one of the following is true: - * a) the app has requested them specifically by defining _WITH_GETLINE or - * _WITH_DPRINTF, respectively - * b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE - * c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE - */ -#ifndef _WITH_GETLINE -#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) -#define_WITH_GETLINE -#elif defined(_POSIX_C_SOURCE) -#if _POSIX_C_SOURCE >= 200809 -#define_WITH_GETLINE -#endif -#endif -#endif - -#ifdef _WITH_GETLINE ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); -#endif - -#ifndef _WITH_DPRINTF -#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) -#define_WITH_DPRINTF -#elif defined(_POSIX_C_SOURCE) -#if _POSIX_C_SOURCE >= 200809 -#define_WITH_DPRINTF -#endif -#endif -#endif - -#ifdef _WITH_DPRINTF -int (dprintf)(int, const char * __restrict, ...); -#endif - +int dprintf(int, const char * __restrict, ...); #endif /* __POSIX_VISIBLE >= 200809 */ getline and dprintf are still int this POSIX section, so they are not exposed to earlier POSIXes or C99 or C90, but they still are unsorted within this section. The unsorting made the ifdefs less unreadable (except g before d was just backwards). Now it is just an expecially bad historical order. Modified: head/lib/libc/stdio/printf.3 This man page is almost unreadable since it has many functions in it organised in a strange order that is approximately on decreasing age and standardness. So you need grep to find anything in it. Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303523 - head/usr.bin/indent
On Fri, 29 Jul 2016, Pedro F. Giffuni wrote: Log: indent(1): Attempt to preserve some consistent style. Remove the excessive braces from r303485 and align the comments to the right as done in the rest of the code. This is not nice but there is no clear way to make it nice (and KNF). Pointed out by:bde Thanks. Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303529 - in head: contrib/libexecinfo lib/libc/stdio sys/contrib/libnv
Author: bapt Date: Sat Jul 30 01:16:06 2016 New Revision: 303529 URL: https://svnweb.freebsd.org/changeset/base/303529 Log: Remove usage of _WITH_DPRINTF Modified: head/contrib/libexecinfo/backtrace.c head/lib/libc/stdio/dprintf.c head/sys/contrib/libnv/nvlist.c Modified: head/contrib/libexecinfo/backtrace.c == --- head/contrib/libexecinfo/backtrace.cSat Jul 30 01:13:54 2016 (r303528) +++ head/contrib/libexecinfo/backtrace.cSat Jul 30 01:16:06 2016 (r303529) @@ -33,7 +33,6 @@ __RCSID("$NetBSD: backtrace.c,v 1.3 2013 #include #include -#define _WITH_DPRINTF #include #include #include Modified: head/lib/libc/stdio/dprintf.c == --- head/lib/libc/stdio/dprintf.c Sat Jul 30 01:13:54 2016 (r303528) +++ head/lib/libc/stdio/dprintf.c Sat Jul 30 01:16:06 2016 (r303529) @@ -27,7 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#define_WITH_DPRINTF #include "namespace.h" #include #include Modified: head/sys/contrib/libnv/nvlist.c == --- head/sys/contrib/libnv/nvlist.c Sat Jul 30 01:13:54 2016 (r303528) +++ head/sys/contrib/libnv/nvlist.c Sat Jul 30 01:16:06 2016 (r303529) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define_WITH_DPRINTF #include #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303528 - in head: contrib/ofed/usr.lib/libibverbs lib/libc/stdio lib/libc/tests/stdio
Author: bapt Date: Sat Jul 30 01:13:54 2016 New Revision: 303528 URL: https://svnweb.freebsd.org/changeset/base/303528 Log: Remove last traces of _WITH_GETLINE Modified: head/contrib/ofed/usr.lib/libibverbs/config.h head/lib/libc/stdio/getline.c head/lib/libc/tests/stdio/getdelim_test.c Modified: head/contrib/ofed/usr.lib/libibverbs/config.h == --- head/contrib/ofed/usr.lib/libibverbs/config.h Sat Jul 30 01:10:05 2016(r303527) +++ head/contrib/ofed/usr.lib/libibverbs/config.h Sat Jul 30 01:13:54 2016(r303528) @@ -1,2 +1 @@ -#define _WITH_GETLINE #include Modified: head/lib/libc/stdio/getline.c == --- head/lib/libc/stdio/getline.c Sat Jul 30 01:10:05 2016 (r303527) +++ head/lib/libc/stdio/getline.c Sat Jul 30 01:13:54 2016 (r303528) @@ -27,7 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#define_WITH_GETLINE #include ssize_t Modified: head/lib/libc/tests/stdio/getdelim_test.c == --- head/lib/libc/tests/stdio/getdelim_test.c Sat Jul 30 01:10:05 2016 (r303527) +++ head/lib/libc/tests/stdio/getdelim_test.c Sat Jul 30 01:13:54 2016 (r303528) @@ -27,7 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#define_WITH_GETLINE #include #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303527 - in head/usr.sbin: autofs pkg pw services_mkdb
Author: bapt Date: Sat Jul 30 01:10:05 2016 New Revision: 303527 URL: https://svnweb.freebsd.org/changeset/base/303527 Log: Remove usage of _WITH_GETLINE from usr.sbin Modified: head/usr.sbin/autofs/common.c head/usr.sbin/pkg/pkg.c head/usr.sbin/pw/pw.h head/usr.sbin/pw/pw_vpw.c head/usr.sbin/services_mkdb/services_mkdb.c Modified: head/usr.sbin/autofs/common.c == --- head/usr.sbin/autofs/common.c Sat Jul 30 01:07:47 2016 (r303526) +++ head/usr.sbin/autofs/common.c Sat Jul 30 01:10:05 2016 (r303527) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define_WITH_GETLINE #include #include #include Modified: head/usr.sbin/pkg/pkg.c == --- head/usr.sbin/pkg/pkg.c Sat Jul 30 01:07:47 2016(r303526) +++ head/usr.sbin/pkg/pkg.c Sat Jul 30 01:10:05 2016(r303527) @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define _WITH_GETLINE #include #include #include Modified: head/usr.sbin/pw/pw.h == --- head/usr.sbin/pw/pw.h Sat Jul 30 01:07:47 2016(r303526) +++ head/usr.sbin/pw/pw.h Sat Jul 30 01:10:05 2016(r303527) @@ -28,7 +28,6 @@ #include -#define _WITH_GETLINE #include #include #include Modified: head/usr.sbin/pw/pw_vpw.c == --- head/usr.sbin/pw/pw_vpw.c Sat Jul 30 01:07:47 2016(r303526) +++ head/usr.sbin/pw/pw_vpw.c Sat Jul 30 01:10:05 2016(r303527) @@ -33,7 +33,6 @@ static const char rcsid[] = #include #include #include -#define _WITH_GETLINE #include #include #include Modified: head/usr.sbin/services_mkdb/services_mkdb.c == --- head/usr.sbin/services_mkdb/services_mkdb.c Sat Jul 30 01:07:47 2016 (r303526) +++ head/usr.sbin/services_mkdb/services_mkdb.c Sat Jul 30 01:10:05 2016 (r303527) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _WITH_GETLINE #include #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303526 - in head/usr.bin: calendar checknr comm grep mandoc sdiff sed soelim uniq
Author: bapt Date: Sat Jul 30 01:07:47 2016 New Revision: 303526 URL: https://svnweb.freebsd.org/changeset/base/303526 Log: Remove usage of _WITH_GETLINE from usr.bin Modified: head/usr.bin/calendar/io.c head/usr.bin/checknr/checknr.c head/usr.bin/comm/comm.c head/usr.bin/grep/grep.c head/usr.bin/mandoc/Makefile head/usr.bin/sdiff/sdiff.c head/usr.bin/sed/main.c head/usr.bin/soelim/soelim.c head/usr.bin/uniq/uniq.c Modified: head/usr.bin/calendar/io.c == --- head/usr.bin/calendar/io.c Sat Jul 30 01:04:18 2016(r303525) +++ head/usr.bin/calendar/io.c Sat Jul 30 01:07:47 2016(r303526) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _WITH_GETLINE #include #include #include Modified: head/usr.bin/checknr/checknr.c == --- head/usr.bin/checknr/checknr.c Sat Jul 30 01:04:18 2016 (r303525) +++ head/usr.bin/checknr/checknr.c Sat Jul 30 01:07:47 2016 (r303526) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); * structured typesetting. */ #include -#define _WITH_GETLINE #include #include #include Modified: head/usr.bin/comm/comm.c == --- head/usr.bin/comm/comm.cSat Jul 30 01:04:18 2016(r303525) +++ head/usr.bin/comm/comm.cSat Jul 30 01:07:47 2016(r303526) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _WITH_GETLINE #include #include #include Modified: head/usr.bin/grep/grep.c == --- head/usr.bin/grep/grep.cSat Jul 30 01:04:18 2016(r303525) +++ head/usr.bin/grep/grep.cSat Jul 30 01:07:47 2016(r303526) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _WITH_GETLINE #include #include #include Modified: head/usr.bin/mandoc/Makefile == --- head/usr.bin/mandoc/MakefileSat Jul 30 01:04:18 2016 (r303525) +++ head/usr.bin/mandoc/MakefileSat Jul 30 01:07:47 2016 (r303526) @@ -83,7 +83,6 @@ SRCS+=${DB_SRCS} WARNS?=2 CFLAGS+= -DHAVE_CONFIG_H \ --D_WITH_GETLINE \ -I${.CURDIR}/../../lib/libopenbsd/ \ -I${.CURDIR}/../../contrib/sqlite3 LIBADD=openbsd sqlite3 z Modified: head/usr.bin/sdiff/sdiff.c == --- head/usr.bin/sdiff/sdiff.c Sat Jul 30 01:04:18 2016(r303525) +++ head/usr.bin/sdiff/sdiff.c Sat Jul 30 01:07:47 2016(r303526) @@ -22,7 +22,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _WITH_GETLINE #include #include #include Modified: head/usr.bin/sed/main.c == --- head/usr.bin/sed/main.c Sat Jul 30 01:04:18 2016(r303525) +++ head/usr.bin/sed/main.c Sat Jul 30 01:07:47 2016(r303526) @@ -58,7 +58,6 @@ static const char sccsid[] = "@(#)main.c #include #include #include -#define _WITH_GETLINE #include #include #include Modified: head/usr.bin/soelim/soelim.c == --- head/usr.bin/soelim/soelim.cSat Jul 30 01:04:18 2016 (r303525) +++ head/usr.bin/soelim/soelim.cSat Jul 30 01:07:47 2016 (r303526) @@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _WITH_GETLINE #include #include #include Modified: head/usr.bin/uniq/uniq.c == --- head/usr.bin/uniq/uniq.cSat Jul 30 01:04:18 2016(r303525) +++ head/usr.bin/uniq/uniq.cSat Jul 30 01:07:47 2016(r303526) @@ -53,7 +53,6 @@ static const char rcsid[] = #include #include #include -#define _WITH_GETLINE #include #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303502 - head/usr.bin/indent
On 07/29/16 19:00, Bruce Evans wrote: On Fri, 29 Jul 2016, Pedro F. Giffuni wrote: Log: indent(1): Use NULL instead of zero for pointers. This is probably not indent's style, I doubt that you found all of the implicit NULLs. A recent commit added strstr() without even a comparison with 0. This adds some lexical style bugs. Yikes... hurry doesn't help get commits right. Sorry. Hope r303525 is not worse than what we had before. Pedro. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303525 - head/usr.bin/indent
Author: pfg Date: Sat Jul 30 01:04:18 2016 New Revision: 303525 URL: https://svnweb.freebsd.org/changeset/base/303525 Log: indent(1): Yet more style issues. strchr(3) returns a pointer not a boolean. Attempt to make the style somewhat more ocnsistent with what indent had before recent changes. Pointed out by: bde Modified: head/usr.bin/indent/indent.c head/usr.bin/indent/io.c head/usr.bin/indent/lexi.c Modified: head/usr.bin/indent/indent.c == --- head/usr.bin/indent/indent.cSat Jul 30 01:00:16 2016 (r303524) +++ head/usr.bin/indent/indent.cSat Jul 30 01:04:18 2016 (r303525) @@ -342,8 +342,8 @@ main(int argc, char **argv) case comment: /* we have a comment, so we must copy it into * the buffer */ if (!flushed_nl || sc_end != NULL) { - if (sc_end == NULL) { /* if this is the first comment, we -* must set up the buffer */ + if (sc_end == NULL) { /* if this is the first comment, we + * must set up the buffer */ save_com[0] = save_com[1] = ' '; sc_end = &(save_com[2]); } @@ -1100,8 +1100,8 @@ check_type: while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t')) e_lab--; - /* comment on preprocessor line */ if (e_lab - s_lab == com_end && bp_save == NULL) { + /* comment on preprocessor line */ if (sc_end == NULL) /* if this is the first comment, we * must set up the buffer */ sc_end = &(save_com[0]); Modified: head/usr.bin/indent/io.c == --- head/usr.bin/indent/io.cSat Jul 30 01:00:16 2016(r303524) +++ head/usr.bin/indent/io.cSat Jul 30 01:04:18 2016(r303525) @@ -348,8 +348,8 @@ fill_buffer(void) int i; FILE *f = input; -if (bp_save != NULL) { /* there is a partly filled input buffer left */ - buf_ptr = bp_save; /* dont read anything, just switch buffers */ +if (bp_save != NULL) { /* there is a partly filled input buffer left */ + buf_ptr = bp_save; /* do not read anything, just switch buffers */ buf_end = be_save; bp_save = be_save = NULL; if (buf_ptr < buf_end) Modified: head/usr.bin/indent/lexi.c == --- head/usr.bin/indent/lexi.c Sat Jul 30 01:00:16 2016(r303524) +++ head/usr.bin/indent/lexi.c Sat Jul 30 01:04:18 2016(r303525) @@ -197,7 +197,7 @@ lexi(void) seensfx |= 1; continue; } - if (!(seensfx & 2) && strchr("fFlL", *buf_ptr)) { + if (!(seensfx & 2) && (strchr("fFlL", *buf_ptr) != NULL)) { CHECK_SIZE_TOKEN; if (buf_ptr[1] == buf_ptr[0]) *e_token++ = *buf_ptr++; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303524 - in head: include lib/libc/stdio
Author: bapt Date: Sat Jul 30 01:00:16 2016 New Revision: 303524 URL: https://svnweb.freebsd.org/changeset/base/303524 Log: Remove _WITH_GETLINE and _WITH_DPRINTF guards When adding getline(3) and dprintf(3) into libc, those guards were added to prevent breaking too many ports. 7 years later the ports tree have been fixed, it is time to remove this FreeBSDism While here remove the extra parenthesis surrounding dprintf(3) Modified: head/include/stdio.h head/lib/libc/stdio/getline.3 head/lib/libc/stdio/printf.3 Modified: head/include/stdio.h == --- head/include/stdio.hFri Jul 29 23:30:33 2016(r303523) +++ head/include/stdio.hSat Jul 30 01:00:16 2016(r303524) @@ -357,44 +357,8 @@ ssize_t getdelim(char ** __restrict, si FILE *open_memstream(char **, size_t *); int renameat(int, const char *, int, const char *); int vdprintf(int, const char * __restrict, __va_list); - -/* - * Every programmer and his dog wrote functions called getline() and dprintf() - * before POSIX.1-2008 came along and decided to usurp the names, so we - * don't prototype them by default unless one of the following is true: - * a) the app has requested them specifically by defining _WITH_GETLINE or - * _WITH_DPRINTF, respectively - * b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE - * c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE - */ -#ifndef _WITH_GETLINE -#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) -#define_WITH_GETLINE -#elif defined(_POSIX_C_SOURCE) -#if _POSIX_C_SOURCE >= 200809 -#define_WITH_GETLINE -#endif -#endif -#endif - -#ifdef _WITH_GETLINE ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); -#endif - -#ifndef _WITH_DPRINTF -#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) -#define_WITH_DPRINTF -#elif defined(_POSIX_C_SOURCE) -#if _POSIX_C_SOURCE >= 200809 -#define_WITH_DPRINTF -#endif -#endif -#endif - -#ifdef _WITH_DPRINTF -int (dprintf)(int, const char * __restrict, ...); -#endif - +int dprintf(int, const char * __restrict, ...); #endif /* __POSIX_VISIBLE >= 200809 */ /* Modified: head/lib/libc/stdio/getline.3 == --- head/lib/libc/stdio/getline.3 Fri Jul 29 23:30:33 2016 (r303523) +++ head/lib/libc/stdio/getline.3 Sat Jul 30 01:00:16 2016 (r303524) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 30, 2012 +.Dd July 30, 2016 .Dt GETLINE 3 .Os .Sh NAME @@ -34,7 +34,6 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.Fd "#define _WITH_GETLINE" .In stdio.h .Ft ssize_t .Fn getdelim "char ** restrict linep" "size_t * restrict linecapp" "int delimiter" " FILE * restrict stream" @@ -97,34 +96,6 @@ while ((linelen = getline(, fwrite(line, linelen, 1, stdout); free(line); .Ed -.Sh COMPATIBILITY -Many application writers used the name -.Va getline -before the -.Fn getline -function was introduced in -.St -p1003.1 , -so a prototype is not provided by default in order to avoid -compatibility problems. -Applications that wish to use the -.Fn getline -function described herein should either request a strict -.St -p1003.1-2008 -environment by defining the macro -.Dv _POSIX_C_SOURCE -to the value 200809 or greater, or by defining the macro -.Dv _WITH_GETLINE , -prior to the inclusion of -.In stdio.h . -For compatibility with GNU libc, defining either -.Dv _BSD_SOURCE -or -.Dv _GNU_SOURCE -prior to the inclusion of -.In stdio.h -will also make -.Fn getline -available. .Sh ERRORS These functions may fail if: .Bl -tag -width Er Modified: head/lib/libc/stdio/printf.3 == --- head/lib/libc/stdio/printf.3Fri Jul 29 23:30:33 2016 (r303523) +++ head/lib/libc/stdio/printf.3Sat Jul 30 01:00:16 2016 (r303524) @@ -32,7 +32,7 @@ .\" @(#)printf.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 2, 2009 +.Dd July 30, 2016 .Dt PRINTF 3 .Os .Sh NAME @@ -42,7 +42,6 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.Fd "#define _WITH_DPRINTF" .In stdio.h .Ft int .Fn printf "const char * restrict format" ... @@ -715,34 +714,6 @@ char *newfmt(const char *fmt, ...) } .Ed .Sh COMPATIBILITY -Many application writers used the name -.Va dprintf -before the -.Fn dprintf -function was introduced in -.St -p1003.1 , -so a prototype is not provided by default in order to avoid -compatibility problems. -Applications that wish to use the -.Fn dprintf -function described herein should either request a strict -.St -p1003.1-2008 -environment by defining the macro -.Dv _POSIX_C_SOURCE -to the value 200809 or greater, or by defining the macro -.Dv _WITH_DPRINTF , -prior to the inclusion of -.In stdio.h . -For compatibility with GNU libc, defining
Re: svn commit: r303503 - head/sys/kern
On Fri, 29 Jul 2016, John Baldwin wrote: Log: Don't treat NOCPU as a valid CPU to CPU_ISSET. If a thread is created bound to a cpuset it might already be bound before it's very first timeslice, and td_lastcpu will be NOCPU in that case. MFC after: 1 week Thanks. Did you get this from your mail queue on 2016/05/08? Modified: head/sys/kern/sched_4bsd.c == --- head/sys/kern/sched_4bsd.c Fri Jul 29 19:36:10 2016(r303502) +++ head/sys/kern/sched_4bsd.c Fri Jul 29 20:19:14 2016(r303503) @@ -1241,7 +1241,7 @@ sched_pickcpu(struct thread *td) mtx_assert(_lock, MA_OWNED); - if (THREAD_CAN_SCHED(td, td->td_lastcpu)) + if (td->td_lastcpu != NOCPU && THREAD_CAN_SCHED(td, td->td_lastcpu)) best = td->td_lastcpu; else best = NOCPU; This bug was more fatal on amd64 than on i386. td_last_cpu has a correct (signed) type int and NOCPU is -1. THREAD_CAN_SCHED uses unsigned type. -1 becomes 0x in it on amd64 and 0x on i386. The old mail says that these get shifted to 1/4 as big, but I think the relevant value is more like 8 -- 8 bits per byte requires a byte at offset 1/8 of of these values in a byte array for a bitmap, but the array is of u_int or u_long so the array index is 1/32nd or 1/64 of these values and the memory offset is 1/8. Anyway, the final offset is small enough to not always trap on i386 only. When NOCPU was 255, t_lastcpu was u_char and the memory offset was 31 bytes. This didn't even give a buffer overrun with MAXCPU = 254. When td_lastcpu is NOCPU and the check doesn't trap, 'best' is set to NOCPU in both cases and the code works. Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303502 - head/usr.bin/indent
On Fri, 29 Jul 2016, Pedro F. Giffuni wrote: Log: indent(1): Use NULL instead of zero for pointers. This is probably not indent's style, I doubt that you found all of the implicit NULLs. A recent commit added strstr() without even a comparison with 0. This adds some lexical style bugs. Modified: head/usr.bin/indent/indent.c == --- head/usr.bin/indent/indent.cFri Jul 29 18:26:15 2016 (r303501) +++ head/usr.bin/indent/indent.cFri Jul 29 19:36:10 2016 (r303502) @@ -341,8 +341,8 @@ main(int argc, char **argv) } case comment: /* we have a comment, so we must copy it into * the buffer */ - if (!flushed_nl || sc_end != 0) { - if (sc_end == 0) { /* if this is the first comment, we + if (!flushed_nl || sc_end != NULL) { + if (sc_end == NULL) { /* if this is the first comment, we * must set up the buffer */ save_com[0] = save_com[1] = ' '; sc_end = &(save_com[2]); This breaks the formatting using blind substitution. A program named indent should be used to check the formatting. indent -l is mostly broken, but it works for comments, and indent's source code needs it to format comments more than most programs because indent puts lots of comments to the right of the code where they get moved further right by expansions. Normally, reformatting of such comments is not wanted, but it should be used for new code. I added the -[n]fcb to disable excessive reformatting of comments to the right of code. This only applies to block comments. @@ -1101,9 +1101,9 @@ check_type: while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t')) e_lab--; - if (e_lab - s_lab == com_end && bp_save == 0) { /* comment on -* preprocessor line */ This was a good example of indent's bad style. The comment needed to be in coulumns 64-78 to follow the style. After expansion, it needs to be in columns 72-78. But 2 of the 3 words in it are too long to fit there. - if (sc_end == 0)/* if this is the first comment, we + /* comment on preprocessor line */ The expansion wasn't blind, and the comment was moved to fit on new line. indent would have problems moving it, but it wouldn't move it to a wrong place -- from inside the compound statement to outside. + if (e_lab - s_lab == com_end && bp_save == NULL) { + if (sc_end == NULL) /* if this is the first comment, we * must set up the buffer */ sc_end = &(save_com[0]); else { indent would have kept it inside the compound statement. It can then be started at the same indentation level as the code, or at the right of a blank statement. The comment could be corrected to live outside of the compound statement by adding an "if" condition to it. That is too hard for indent. The first coment inside the comment gives an example of using an "if" condition but this is not quite right here -- "if" only applies before the test. Modified: head/usr.bin/indent/io.c == --- head/usr.bin/indent/io.cFri Jul 29 18:26:15 2016(r303501) +++ head/usr.bin/indent/io.cFri Jul 29 19:36:10 2016(r303502) @@ -348,10 +348,10 @@ fill_buffer(void) int i; FILE *f = input; -if (bp_save != 0) {/* there is a partly filled input buffer left */ +if (bp_save != NULL) { /* there is a partly filled input buffer left */ The formatting was already broken here. It is especially broken since nearby lines use a smaller indentation that would work here too. buf_ptr = bp_save; /* dont read anything, just switch buffers */ indent dont need know spelling lessons? buf_end = be_save; - bp_save = be_save = 0; + bp_save = be_save = NULL; if (buf_ptr < buf_end) return; /* only return if there is really something in * this buffer */ Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303487 - head/usr.bin/indent
On Fri, 29 Jul 2016, Piotr Stefaniak wrote: On 2016-07-29 18:28, Pedro F. Giffuni wrote: Log: indent(1): fix struct termination detection. Small style cleanup while here. Wrong commit message. Actually committed here is: Support "f" and "F" floating constant suffixes. ... Also: Add large style bug in the fix. Modified: head/usr.bin/indent/lexi.c == --- head/usr.bin/indent/lexi.c Fri Jul 29 16:25:09 2016 (r303486) +++ head/usr.bin/indent/lexi.c Fri Jul 29 16:28:51 2016 (r303487) @@ -191,15 +191,13 @@ lexi(void) } } while (1) { - if (!(seensfx & 1) && - (*buf_ptr == 'U' || *buf_ptr == 'u')) { + if (!(seensfx & 1) && (*buf_ptr == 'U' || *buf_ptr == 'u')) { CHECK_SIZE_TOKEN; *e_token++ = *buf_ptr++; seensfx |= 1; continue; } - if (!(seensfx & 2) && - (*buf_ptr == 'L' || *buf_ptr == 'l')) { + if (!(seensfx & 2) && strchr("fFlL", *buf_ptr)) { indent's style is mostly bad, but this doesn't seem to involve using boolean tests for non-boolean str*() functions. indent didn't use strchr() before, but it always does explict comparisons with 0 for strcmp() and strncmp(). strstr() doesn't even return an integer, so an explicit comparison is even more needed for it. Except the "found" test doesn't require negative logic like !strcmp(). CHECK_SIZE_TOKEN; if (buf_ptr[1] == buf_ptr[0]) *e_token++ = *buf_ptr++; Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303523 - head/usr.bin/indent
Author: pfg Date: Fri Jul 29 23:30:33 2016 New Revision: 303523 URL: https://svnweb.freebsd.org/changeset/base/303523 Log: indent(1): Attempt to preserve some consistent style. Remove the excessive braces from r303485 and align the comments to the right as done in the rest of the code. This is not nice but there is no clear way to make it nice (and KNF). Pointed out by: bde Modified: head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.c == --- head/usr.bin/indent/indent.cFri Jul 29 22:11:29 2016 (r303522) +++ head/usr.bin/indent/indent.cFri Jul 29 23:30:33 2016 (r303523) @@ -701,10 +701,9 @@ check_type: break; case semicolon: /* got a ';' */ - if (ps.dec_nest == 0) { - /* we are not in an initialization or structure declaration */ - ps.in_or_st = false; - } + if (ps.dec_nest == 0) + ps.in_or_st = false;/* we are not in an initialization or +* structure declaration */ scase = false; /* these will only need resetting in an error */ squest = 0; if (ps.last_token == rparen && rparen_count == 0) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303485 - head/usr.bin/indent
On Fri, 29 Jul 2016, Pedro F. Giffuni wrote: Log: indent(1): fix struct termination detection. Semicolons inside struct declarations don't end the declarations. Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Obtained from: Piotr Stefaniak Modified: head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.c == --- head/usr.bin/indent/indent.cFri Jul 29 16:17:54 2016 (r303484) +++ head/usr.bin/indent/indent.cFri Jul 29 16:23:00 2016 (r303485) @@ -701,8 +701,10 @@ check_type: break; case semicolon: /* got a ';' */ - ps.in_or_st = false;/* we are not in an initialization or -* structure declaration */ + if (ps.dec_nest == 0) { + /* we are not in an initialization or structure declaration */ + ps.in_or_st = false; + } This adds some style bugs. indent is written in a bad style that is very far from KNF, but perhaps it could format itself if it had an indent.pro. Part of its bad style is to use unnecessary parentheses a lot. But it mostly doesn't use unecessary braces. Except here. Another part of its bad style is to put comments to the right of the code, even when this requires misformatting them across multiple lines. The changed code gave example of both (the misformatting was to not have any whitespace between the semicolon and the comment so as to minimise comment indentation. This was actually another style bug. indent normally puts comments at the right at a tab stop even when this gives very narrow comments split across several lines). The changed code puts the comment on a line by itself. indent almost never does that elsewhere for comments about single statements. The comment here is technically for a block of compound statements, but the block has only 1 statement and was created by using excessive braces. scase = false; /* these will only need resetting in an error */ squest = 0; if (ps.last_token == rparen && rparen_count == 0) Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303522 - head/sys/dev/cxgbe
Author: jhb Date: Fri Jul 29 22:11:29 2016 New Revision: 303522 URL: https://svnweb.freebsd.org/changeset/base/303522 Log: Various fixes to the t4/5nex character device. - Remove null open/close methods. - Don't set d_flags to 0 explicitly. - Remove t5_cdevsw as the .d_name member isn't really used and doesn't warrant a separate cdevsw just for the name. - Use ENOTTY as the error value for an unknown ioctl request. - Use make_dev_s() to close race with setting si_drv1. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c == --- head/sys/dev/cxgbe/t4_main.cFri Jul 29 21:37:00 2016 (r303521) +++ head/sys/dev/cxgbe/t4_main.cFri Jul 29 22:11:29 2016 (r303522) @@ -134,14 +134,9 @@ static driver_t vcxgbe_driver = { }; static d_ioctl_t t4_ioctl; -static d_open_t t4_open; -static d_close_t t4_close; static struct cdevsw t4_cdevsw = { .d_version = D_VERSION, - .d_flags = 0, - .d_open = t4_open, - .d_close = t4_close, .d_ioctl = t4_ioctl, .d_name = "t4nex", }; @@ -179,15 +174,6 @@ static driver_t vcxl_driver = { sizeof(struct vi_info) }; -static struct cdevsw t5_cdevsw = { - .d_version = D_VERSION, - .d_flags = 0, - .d_open = t4_open, - .d_close = t4_close, - .d_ioctl = t4_ioctl, - .d_name = "t5nex", -}; - /* ifnet + media interface */ static void cxgbe_init(void *); static int cxgbe_ioctl(struct ifnet *, unsigned long, caddr_t); @@ -681,6 +667,7 @@ t4_attach(device_t dev) { struct adapter *sc; int rc = 0, i, j, n10g, n1g, rqidx, tqidx; + struct make_dev_args mda; struct intrs_and_queues iaq; struct sge *s; uint8_t *buf; @@ -760,13 +747,16 @@ t4_attach(device_t dev) setup_memwin(sc); if (t4_init_devlog_params(sc, 0) == 0) fixup_devlog_params(sc); - sc->cdev = make_dev(is_t4(sc) ? _cdevsw : _cdevsw, - device_get_unit(dev), UID_ROOT, GID_WHEEL, 0600, "%s", - device_get_nameunit(dev)); - if (sc->cdev == NULL) - device_printf(dev, "failed to create nexus char device.\n"); - else - sc->cdev->si_drv1 = sc; + make_dev_args_init(); + mda.mda_devsw = _cdevsw; + mda.mda_uid = UID_ROOT; + mda.mda_gid = GID_WHEEL; + mda.mda_mode = 0600; + mda.mda_si_drv1 = sc; + rc = make_dev_s(, >cdev, "%s", device_get_nameunit(dev)); + if (rc != 0) + device_printf(dev, "failed to create nexus char device: %d.\n", + rc); /* Go no further if recovery mode has been requested. */ if (TUNABLE_INT_FETCH("hw.cxgbe.sos", ) && i != 0) { @@ -8727,18 +8717,6 @@ t4_iterate(void (*func)(struct adapter * } static int -t4_open(struct cdev *dev, int flags, int type, struct thread *td) -{ - return (0); -} - -static int -t4_close(struct cdev *dev, int flags, int type, struct thread *td) -{ - return (0); -} - -static int t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data, int fflag, struct thread *td) { @@ -8909,7 +8887,7 @@ t4_ioctl(struct cdev *dev, unsigned long rc = t4_set_tracer(sc, (struct t4_tracer *)data); break; default: - rc = EINVAL; + rc = ENOTTY; } return (rc); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303521 - head/contrib/llvm/projects/libunwind/src
Author: emaste Date: Fri Jul 29 21:37:00 2016 New Revision: 303521 URL: https://svnweb.freebsd.org/changeset/base/303521 Log: libunwind: correct return code in unwinding trace log message Obtained from:LLVM r277215 MFC after:3 days Sponsored by: The FreeBSD Foundation Modified: head/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp Modified: head/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp == --- head/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp Fri Jul 29 21:18:20 2016(r303520) +++ head/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp Fri Jul 29 21:37:00 2016(r303521) @@ -572,7 +572,7 @@ static _Unwind_Reason_Code unwind_phase2 unw_get_reg(cursor, UNW_REG_SP, ); if (unw_get_proc_info(cursor, ) != UNW_ESUCCESS) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info " - "failed => _URC_FATAL_PHASE1_ERROR\n", + "failed => _URC_FATAL_PHASE2_ERROR\n", static_cast(exception_object)); return _URC_FATAL_PHASE2_ERROR; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303520 - head/usr.bin/cpuset
Author: vangyzen Date: Fri Jul 29 21:18:20 2016 New Revision: 303520 URL: https://svnweb.freebsd.org/changeset/base/303520 Log: Fix markup for -j in cpuset(1) synopsis MFC after:3 days Sponsored by: Dell Inc. Modified: head/usr.bin/cpuset/cpuset.1 Modified: head/usr.bin/cpuset/cpuset.1 == --- head/usr.bin/cpuset/cpuset.1Fri Jul 29 21:12:48 2016 (r303519) +++ head/usr.bin/cpuset/cpuset.1Fri Jul 29 21:18:20 2016 (r303520) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 8, 2015 +.Dd July 29, 2016 .Dt CPUSET 1 .Os .Sh NAME @@ -52,7 +52,7 @@ .Nm .Fl g .Op Fl cir -.Op Fl d Ar domain | j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq +.Op Fl d Ar domain | Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq .Sh DESCRIPTION The .Nm ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303519 - head/share/man/man9
Author: vangyzen Date: Fri Jul 29 21:12:48 2016 New Revision: 303519 URL: https://svnweb.freebsd.org/changeset/base/303519 Log: Fix two return types in the cpuset(9) and bitset(9) man pages The *_FFS() and *_COUNT() functions return int, not size_t. MFC after:3 days Sponsored by: Dell Inc. Modified: head/share/man/man9/bitset.9 head/share/man/man9/cpuset.9 Modified: head/share/man/man9/bitset.9 == --- head/share/man/man9/bitset.9Fri Jul 29 21:11:32 2016 (r303518) +++ head/share/man/man9/bitset.9Fri Jul 29 21:12:48 2016 (r303519) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 20, 2015 +.Dd July 29, 2016 .Dt BITSET 9 .Os .Sh NAME @@ -77,9 +77,9 @@ .Fn BIT_EMPTY "const SETSIZE" "struct STRUCTNAME *bitset" .Ft bool .Fn BIT_ISFULLSET "const SETSIZE" "struct STRUCTNAME *bitset" -.Ft size_t +.Ft int .Fn BIT_FFS "const SETSIZE" "struct STRUCTNAME *bitset" -.Ft size_t +.Ft int .Fn BIT_COUNT "const SETSIZE" "struct STRUCTNAME *bitset" .\" .Ft bool Modified: head/share/man/man9/cpuset.9 == --- head/share/man/man9/cpuset.9Fri Jul 29 21:11:32 2016 (r303518) +++ head/share/man/man9/cpuset.9Fri Jul 29 21:12:48 2016 (r303519) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 20, 2015 +.Dd July 29, 2016 .Dt CPUSET 9 .Os .Sh NAME @@ -75,9 +75,9 @@ .Fn CPU_EMPTY "cpuset_t *cpuset" .Ft bool .Fn CPU_ISFULLSET "cpuset_t *cpuset" -.Ft size_t +.Ft int .Fn CPU_FFS "cpuset_t *cpuset" -.Ft size_t +.Ft int .Fn CPU_COUNT "cpuset_t *cpuset" .\" .Ft bool ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303518 - head/contrib/blacklist/lib
Author: lidl Date: Fri Jul 29 21:11:32 2016 New Revision: 303518 URL: https://svnweb.freebsd.org/changeset/base/303518 Log: libblacklist: Do not use %m for logging, use strerror(errno) The blacklist library can accept a function to use for logging, defaulting to vsyslog(), if no function is specified. Make the blacklist library use strerror(errno) explicitly, instead of %m, so that the passed in function does not need to support the syslog specific placeholder. This matches a change already submitted and accepted upstream. MFC after:1 week Sponsored by: The FreeBSD Foundation Modified: head/contrib/blacklist/lib/bl.c Modified: head/contrib/blacklist/lib/bl.c == --- head/contrib/blacklist/lib/bl.c Fri Jul 29 21:07:17 2016 (r303517) +++ head/contrib/blacklist/lib/bl.c Fri Jul 29 21:11:32 2016 (r303518) @@ -152,8 +152,8 @@ bl_init(bl_t b, bool srv) b->b_fd = socket(PF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK|SOCK_NOSIGPIPE, 0); if (b->b_fd == -1) { - bl_log(b->b_fun, LOG_ERR, "%s: socket failed (%m)", - __func__); + bl_log(b->b_fun, LOG_ERR, "%s: socket failed (%s)", + __func__, strerror(errno)); BL_UNLOCK(b); return -1; } @@ -200,8 +200,8 @@ bl_init(bl_t b, bool srv) */ if (b->b_connected != 1) { bl_log(b->b_fun, LOG_DEBUG, - "%s: connect failed for `%s' (%m)", - __func__, sun->sun_path); + "%s: connect failed for `%s' (%s)", + __func__, sun->sun_path, strerror(errno)); b->b_connected = 1; } BL_UNLOCK(b); @@ -220,8 +220,8 @@ bl_init(bl_t b, bool srv) errno = serrno; if (rv == -1) { bl_log(b->b_fun, LOG_ERR, - "%s: bind failed for `%s' (%m)", - __func__, sun->sun_path); + "%s: bind failed for `%s' (%s)", + __func__, sun->sun_path, strerror(errno)); goto out; } } @@ -260,7 +260,8 @@ bl_init(bl_t b, bool srv) if (setsockopt(b->b_fd, CRED_LEVEL, CRED_NAME, , (socklen_t)sizeof(one)) == -1) { bl_log(b->b_fun, LOG_ERR, "%s: setsockopt %s " - "failed (%m)", __func__, __STRING(CRED_NAME)); + "failed (%s)", __func__, __STRING(CRED_NAME), + strerror(errno)); goto out; } #endif @@ -296,7 +297,8 @@ bl_create(bool srv, const char *path, vo return b; out: free(b); - bl_log(fun, LOG_ERR, "%s: malloc failed (%m)", __func__); + bl_log(fun, LOG_ERR, "%s: malloc failed (%s)", __func__, + strerror(errno)); return NULL; } @@ -451,7 +453,8 @@ bl_recv(bl_t b) rlen = recvmsg(b->b_fd, , 0); if (rlen == -1) { - bl_log(b->b_fun, LOG_ERR, "%s: recvmsg failed (%m)", __func__); + bl_log(b->b_fun, LOG_ERR, "%s: recvmsg failed (%s)", __func__, + strerror(errno)); return NULL; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303516 - head/sys/vm
Author: markj Date: Fri Jul 29 21:05:37 2016 New Revision: 303516 URL: https://svnweb.freebsd.org/changeset/base/303516 Log: Use vm_page_undirty() instead of manually setting a page field. Reviewed by: alc MFC after:3 days Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c == --- head/sys/vm/vm_page.c Fri Jul 29 21:05:17 2016(r303515) +++ head/sys/vm/vm_page.c Fri Jul 29 21:05:37 2016(r303516) @@ -3397,7 +3397,7 @@ vm_page_advise(vm_page_t m, int advice) * But we do make the page as freeable as we can without * actually taking the step of unmapping it. */ - m->dirty = 0; + vm_page_undirty(m); else if (advice != MADV_DONTNEED) return; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303515 - head/usr.bin/resizewin
Author: lidl Date: Fri Jul 29 21:05:17 2016 New Revision: 303515 URL: https://svnweb.freebsd.org/changeset/base/303515 Log: Make resizewin.1 manpage use .Fx macro Fix capitalization of "PuTTY" also. MFC after:1 week Modified: head/usr.bin/resizewin/resizewin.1 Modified: head/usr.bin/resizewin/resizewin.1 == --- head/usr.bin/resizewin/resizewin.1 Fri Jul 29 21:03:30 2016 (r303514) +++ head/usr.bin/resizewin/resizewin.1 Fri Jul 29 21:05:17 2016 (r303515) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 17, 2016 +.Dd July 9, 2016 .Dt RESIZEWIN 1 .Os .Sh NAME @@ -55,10 +55,12 @@ updates the kernel's window size to matc .Pp Note that virtually all modern terninals support VT100/ANSI escape sequences, including xterm, konsole, gnome-terminal iTerm, -Terminal.app, and puTTY. +Terminal.app, and PuTTY. .Sh SEE ALSO .Xr resize 1 , .Xr stty 1 .Sh HISTORY +The .Nm -appeared in FreeBSD 11. +command first appeared in +.Fx 11 . ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303513 - head/sys/ofed/drivers/infiniband/ulp/sdp
Author: markj Date: Fri Jul 29 21:03:02 2016 New Revision: 303513 URL: https://svnweb.freebsd.org/changeset/base/303513 Log: sdp: Destroy the RDMA ID after destroying the connection's queue pair. This is the ordering documented by rdma_destroy_qp(). Also add a useful KASSERT to sdp_pcbfree(). Sponsored by: EMC / Isilon Storage Division Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Jul 29 21:01:04 2016(r303512) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Jul 29 21:03:02 2016(r303513) @@ -160,7 +160,10 @@ sdp_pcbbind(struct sdp_sock *ssk, struct static void sdp_pcbfree(struct sdp_sock *ssk) { + KASSERT(ssk->socket == NULL, ("ssk %p socket still attached", ssk)); + KASSERT((ssk->flags & SDP_DESTROY) == 0, + ("ssk %p already destroyed", ssk)); sdp_dbg(ssk->socket, "Freeing pcb"); SDP_WLOCK_ASSERT(ssk); @@ -171,7 +174,6 @@ sdp_pcbfree(struct sdp_sock *ssk) LIST_REMOVE(ssk, list); SDP_LIST_WUNLOCK(); crfree(ssk->cred); - sdp_destroy_cma(ssk); ssk->qp_active = 0; if (ssk->qp) { ib_destroy_qp(ssk->qp); @@ -179,6 +181,7 @@ sdp_pcbfree(struct sdp_sock *ssk) } sdp_tx_ring_destroy(ssk); sdp_rx_ring_destroy(ssk); + sdp_destroy_cma(ssk); rw_destroy(>rx_ring.destroyed_lock); rw_destroy(>lock); uma_zfree(sdp_zone, ssk); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303514 - head/sys/dev/ntb
Author: mav Date: Fri Jul 29 21:03:30 2016 New Revision: 303514 URL: https://svnweb.freebsd.org/changeset/base/303514 Log: Fix NTBT_QP_LINKS negotiation. I believe it never worked correctly for more the one queue even in Linux. This fixes case when one of consumer drivers is not loaded on one side, but its queues still announced as ready if something else brought link up. While there, remove some pointless NULL checks. Modified: head/sys/dev/ntb/ntb_transport.c Modified: head/sys/dev/ntb/ntb_transport.c == --- head/sys/dev/ntb/ntb_transport.cFri Jul 29 21:03:02 2016 (r303513) +++ head/sys/dev/ntb/ntb_transport.cFri Jul 29 21:03:30 2016 (r303514) @@ -572,9 +572,6 @@ ntb_transport_free_queue(struct ntb_tran struct ntb_transport_ctx *nt = qp->transport; struct ntb_queue_entry *entry; - if (qp == NULL) - return; - callout_drain(>link_work); ntb_db_set_mask(qp->dev, 1ull << qp->qp_num); @@ -694,7 +691,7 @@ ntb_transport_tx_enqueue(struct ntb_tran struct ntb_queue_entry *entry; int rc; - if (qp == NULL || !qp->link_is_up || len == 0) { + if (!qp->link_is_up || len == 0) { CTR0(KTR_NTB, "TX: link not up"); return (EINVAL); } @@ -1059,11 +1056,9 @@ ntb_transport_link_work(void *arg) size >> 32); ntb_peer_spad_write(dev, NTBT_MW0_SZ_LOW + (i * 2), size); } - ntb_peer_spad_write(dev, NTBT_NUM_MWS, nt->mw_count); - ntb_peer_spad_write(dev, NTBT_NUM_QPS, nt->qp_count); - + ntb_peer_spad_write(dev, NTBT_QP_LINKS, 0); ntb_peer_spad_write(dev, NTBT_VERSION, NTB_TRANSPORT_VERSION); /* Query the remote side for its info */ @@ -1245,16 +1240,18 @@ ntb_qp_link_work(void *arg) struct ntb_transport_qp *qp = arg; device_t dev = qp->dev; struct ntb_transport_ctx *nt = qp->transport; - uint32_t val, dummy; - - ntb_spad_read(dev, NTBT_QP_LINKS, ); - - ntb_peer_spad_write(dev, NTBT_QP_LINKS, val | (1ull << qp->qp_num)); + int i; + uint32_t val; - /* query remote spad for qp ready bits */ - ntb_peer_spad_read(dev, NTBT_QP_LINKS, ); + /* Report queues that are up on our side */ + for (i = 0, val = 0; i < nt->qp_count; i++) { + if (nt->qp_vec[i].client_ready) + val |= (1 << i); + } + ntb_peer_spad_write(dev, NTBT_QP_LINKS, val); /* See if the remote side is up */ + ntb_spad_read(dev, NTBT_QP_LINKS, ); if ((val & (1ull << qp->qp_num)) != 0) { ntb_printf(2, "qp %d link up\n", qp->qp_num); qp->link_is_up = true; @@ -1350,17 +1347,16 @@ ntb_qp_link_cleanup(struct ntb_transport void ntb_transport_link_down(struct ntb_transport_qp *qp) { + struct ntb_transport_ctx *nt = qp->transport; + int i; uint32_t val; - if (qp == NULL) - return; - qp->client_ready = false; - - ntb_spad_read(qp->dev, NTBT_QP_LINKS, ); - - ntb_peer_spad_write(qp->dev, NTBT_QP_LINKS, - val & ~(1 << qp->qp_num)); + for (i = 0, val = 0; i < nt->qp_count; i++) { + if (nt->qp_vec[i].client_ready) + val |= (1 << i); + } + ntb_peer_spad_write(qp->dev, NTBT_QP_LINKS, val); if (qp->link_is_up) ntb_send_link_down(qp); @@ -1379,8 +1375,6 @@ ntb_transport_link_down(struct ntb_trans bool ntb_transport_link_query(struct ntb_transport_qp *qp) { - if (qp == NULL) - return (false); return (qp->link_is_up); } @@ -1479,8 +1473,6 @@ out: */ unsigned char ntb_transport_qp_num(struct ntb_transport_qp *qp) { - if (qp == NULL) - return 0; return (qp->qp_num); } @@ -1497,9 +1489,6 @@ unsigned int ntb_transport_max_size(struct ntb_transport_qp *qp) { - if (qp == NULL) - return (0); - return (qp->tx_max_frame - sizeof(struct ntb_payload_header)); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303512 - head/sys/ofed/drivers/infiniband/ulp/sdp
Author: markj Date: Fri Jul 29 21:01:04 2016 New Revision: 303512 URL: https://svnweb.freebsd.org/changeset/base/303512 Log: sdp: Use malloc(9) instead of the Linux compat layer. SDP transmit and receive rings are always created in a sleepable context, so we can use M_WAITOK and remove error checks. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h Fri Jul 29 20:54:43 2016(r303511) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h Fri Jul 29 21:01:04 2016(r303512) @@ -455,6 +455,8 @@ struct sdp_sock { #defineSDP_RLOCK_ASSERT(ssk) rw_assert(&(ssk)->lock, RA_RLOCKED) #defineSDP_LOCK_ASSERT(ssk)rw_assert(&(ssk)->lock, RA_LOCKED) +MALLOC_DECLARE(M_SDP); + static inline void tx_sa_reset(struct tx_srcavail_state *tx_sa) { memset((void *)_sa->busy, 0, Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Jul 29 20:54:43 2016(r303511) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Jul 29 21:01:04 2016(r303512) @@ -64,6 +64,10 @@ #include __FBSDID("$FreeBSD$"); +#include +#include +#include + #include "sdp.h" #include @@ -86,7 +90,7 @@ RW_SYSINIT(sdplockinit, _lock, "SDP #defineSDP_LIST_RLOCK_ASSERT() rw_assert(_lock, RW_RLOCKED) #defineSDP_LIST_LOCK_ASSERT() rw_assert(_lock, RW_LOCKED) -static MALLOC_DEFINE(M_SDP, "sdp", "Socket Direct Protocol"); +MALLOC_DEFINE(M_SDP, "sdp", "Sockets Direct Protocol"); static void sdp_stop_keepalive_timer(struct socket *so); Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Jul 29 20:54:43 2016(r303511) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Jul 29 21:01:04 2016(r303512) @@ -701,25 +701,16 @@ sdp_rx_ring_create(struct sdp_sock *ssk, struct ib_cq *rx_cq; int rc = 0; - sdp_dbg(ssk->socket, "rx ring created"); INIT_WORK(>rx_comp_work, sdp_rx_comp_work); atomic_set(>rx_ring.head, 1); atomic_set(>rx_ring.tail, 1); - ssk->rx_ring.buffer = kmalloc( - sizeof *ssk->rx_ring.buffer * SDP_RX_SIZE, GFP_KERNEL); - if (!ssk->rx_ring.buffer) { - sdp_warn(ssk->socket, - "Unable to allocate RX Ring size %zd.\n", -sizeof(*ssk->rx_ring.buffer) * SDP_RX_SIZE); - - return -ENOMEM; - } + ssk->rx_ring.buffer = malloc(sizeof(*ssk->rx_ring.buffer) * SDP_RX_SIZE, + M_SDP, M_WAITOK); rx_cq = ib_create_cq(device, sdp_rx_irq, sdp_rx_cq_event_handler, ssk, SDP_RX_SIZE, 0); - if (IS_ERR(rx_cq)) { rc = PTR_ERR(rx_cq); sdp_warn(ssk->socket, "Unable to allocate RX CQ: %d.\n", rc); @@ -732,7 +723,7 @@ sdp_rx_ring_create(struct sdp_sock *ssk, return 0; err_cq: - kfree(ssk->rx_ring.buffer); + free(ssk->rx_ring.buffer, M_SDP); ssk->rx_ring.buffer = NULL; return rc; } @@ -746,8 +737,7 @@ sdp_rx_ring_destroy(struct sdp_sock *ssk if (ssk->rx_ring.buffer) { sdp_rx_ring_purge(ssk); - - kfree(ssk->rx_ring.buffer); + free(ssk->rx_ring.buffer, M_SDP); ssk->rx_ring.buffer = NULL; } Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c Fri Jul 29 20:54:43 2016(r303511) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c Fri Jul 29 21:01:04 2016(r303512) @@ -427,19 +427,11 @@ sdp_tx_ring_create(struct sdp_sock *ssk, atomic_set(>tx_ring.head, 1); atomic_set(>tx_ring.tail, 1); - ssk->tx_ring.buffer = kzalloc( - sizeof *ssk->tx_ring.buffer * SDP_TX_SIZE, GFP_KERNEL); - if (!ssk->tx_ring.buffer) { - rc = -ENOMEM; - sdp_warn(ssk->socket, "Can't allocate TX Ring size %zd.\n", -sizeof(*ssk->tx_ring.buffer) * SDP_TX_SIZE); - - goto out; - } + ssk->tx_ring.buffer = malloc(sizeof(*ssk->tx_ring.buffer) * SDP_TX_SIZE, + M_SDP, M_WAITOK); tx_cq = ib_create_cq(device, sdp_tx_irq, sdp_tx_cq_event_handler,
svn commit: r303511 - head/sys/ofed/drivers/infiniband/ulp/sdp
Author: markj Date: Fri Jul 29 20:54:43 2016 New Revision: 303511 URL: https://svnweb.freebsd.org/changeset/base/303511 Log: sdp: Use the correct socket buffer in sdp_post_recvs_needed(). Sponsored by: EMC / Isilon Storage Division Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Jul 29 20:52:18 2016(r303510) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Jul 29 20:54:43 2016(r303511) @@ -175,7 +175,7 @@ sdp_post_recvs_needed(struct sdp_sock *s return 1; buffer_size = ssk->recv_bytes; - max_bytes = max(ssk->socket->so_snd.sb_hiwat, + max_bytes = max(ssk->socket->so_rcv.sb_hiwat, (1 + SDP_MIN_TX_CREDITS) * buffer_size); max_bytes *= rcvbuf_scale; /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303509 - head/sys/ofed/drivers/infiniband/ulp/sdp
Author: markj Date: Fri Jul 29 20:51:52 2016 New Revision: 303509 URL: https://svnweb.freebsd.org/changeset/base/303509 Log: sdp: Always free received control packets after they're handled. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Jul 29 20:48:42 2016(r303508) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Jul 29 20:51:52 2016(r303509) @@ -319,14 +319,14 @@ sdp_recv_completion(struct sdp_sock *ssk return mb; } -/* socket lock should be taken before calling this */ -static int +static void sdp_process_rx_ctl_mb(struct sdp_sock *ssk, struct mbuf *mb) { struct sdp_bsdh *h; struct socket *sk; SDP_WLOCK_ASSERT(ssk); + sk = ssk->socket; h = mtod(mb, struct sdp_bsdh *); switch (h->mid) { @@ -339,16 +339,13 @@ sdp_process_rx_ctl_mb(struct sdp_sock *s sdp_dbg(sk, "RX data when state = FIN_WAIT1\n"); sdp_notify(ssk, ECONNRESET); } - m_freem(mb); break; #ifdef SDP_ZCOPY case SDP_MID_RDMARDCOMPL: - m_freem(mb); break; case SDP_MID_SENDSM: sdp_handle_sendsm(ssk, ntohl(h->mseq_ack)); - m_freem(mb); break; case SDP_MID_SRCAVAIL_CANCEL: sdp_dbg_data(sk, "Handling SrcAvailCancel\n"); @@ -362,7 +359,6 @@ sdp_process_rx_ctl_mb(struct sdp_sock *s sdp_dbg(sk, "Got SrcAvailCancel - " "but no SrcAvail in process\n"); } - m_freem(mb); break; case SDP_MID_SINKAVAIL: sdp_dbg_data(sk, "Got SinkAvail - not supported: ignored\n"); @@ -373,7 +369,6 @@ sdp_process_rx_ctl_mb(struct sdp_sock *s sdp_dbg_data(sk, "Handling ABORT\n"); sdp_prf(sk, NULL, "Handling ABORT"); sdp_notify(ssk, ECONNRESET); - m_freem(mb); break; case SDP_MID_DISCONN: sdp_dbg_data(sk, "Handling DISCONN\n"); @@ -383,20 +378,17 @@ sdp_process_rx_ctl_mb(struct sdp_sock *s case SDP_MID_CHRCVBUF: sdp_dbg_data(sk, "Handling RX CHRCVBUF\n"); sdp_handle_resize_request(ssk, (struct sdp_chrecvbuf *)(h+1)); - m_freem(mb); break; case SDP_MID_CHRCVBUF_ACK: sdp_dbg_data(sk, "Handling RX CHRCVBUF_ACK\n"); sdp_handle_resize_ack(ssk, (struct sdp_chrecvbuf *)(h+1)); - m_freem(mb); break; default: /* TODO: Handle other messages */ sdp_warn(sk, "SDP: FIXME MID %d\n", h->mid); - m_freem(mb); + break; } - - return 0; + m_freem(mb); } static int ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303510 - head/sys/dev/ntb/ntb_hw
Author: mav Date: Fri Jul 29 20:52:18 2016 New Revision: 303510 URL: https://svnweb.freebsd.org/changeset/base/303510 Log: Clear scratchpad after MSIX negotiation to not leak garbage. Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c == --- head/sys/dev/ntb/ntb_hw/ntb_hw.cFri Jul 29 20:51:52 2016 (r303509) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.cFri Jul 29 20:52:18 2016 (r303510) @@ -2649,6 +2649,7 @@ msix_done: if (val != NTB_MSIX_RECEIVED) goto reschedule; + intel_ntb_spad_clear(ntb->device); ntb->peer_msix_good = true; /* Give peer time to see our NTB_MSIX_RECEIVED. */ goto reschedule; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303508 - head/sys/ofed/drivers/infiniband/ulp/sdp
Author: markj Date: Fri Jul 29 20:48:42 2016 New Revision: 303508 URL: https://svnweb.freebsd.org/changeset/base/303508 Log: Fix the KASSERT format string arguments after r303507. Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Jul 29 20:39:32 2016(r303507) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Jul 29 20:48:42 2016(r303508) @@ -668,7 +668,8 @@ sdp_rx_irq(struct ib_cq *cq, void *cq_co struct sdp_sock *ssk; ssk = cq_context; - KASSERT(cq == ssk->rx_ring.cq, ("%s: mismatched cq on %p", ssk)); + KASSERT(cq == ssk->rx_ring.cq, + ("%s: mismatched cq on %p", __func__, ssk)); SDPSTATS_COUNTER_INC(rx_int_count); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303507 - head/sys/ofed/drivers/infiniband/ulp/sdp
Author: markj Date: Fri Jul 29 20:39:32 2016 New Revision: 303507 URL: https://svnweb.freebsd.org/changeset/base/303507 Log: sdp: Use the PCB as the rx completion handler argument. The generic socket may be detached from the PCB before the completion queue is drained and destroyed, so this change closes a race condition in connection teardown. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Jul 29 20:36:01 2016(r303506) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Jul 29 20:39:32 2016(r303507) @@ -665,13 +665,10 @@ sdp_process_rx(struct sdp_sock *ssk) static void sdp_rx_irq(struct ib_cq *cq, void *cq_context) { - struct socket *sk = cq_context; - struct sdp_sock *ssk = sdp_sk(sk); + struct sdp_sock *ssk; - if (cq != ssk->rx_ring.cq) { - sdp_dbg(sk, "cq = %p, ssk->cq = %p\n", cq, ssk->rx_ring.cq); - return; - } + ssk = cq_context; + KASSERT(cq == ssk->rx_ring.cq, ("%s: mismatched cq on %p", ssk)); SDPSTATS_COUNTER_INC(rx_int_count); @@ -728,7 +725,7 @@ sdp_rx_ring_create(struct sdp_sock *ssk, } rx_cq = ib_create_cq(device, sdp_rx_irq, sdp_rx_cq_event_handler, - ssk->socket, SDP_RX_SIZE, 0); + ssk, SDP_RX_SIZE, 0); if (IS_ERR(rx_cq)) { rc = PTR_ERR(rx_cq); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303506 - head/sys/ofed/drivers/infiniband/ulp/sdp
Author: markj Date: Fri Jul 29 20:36:01 2016 New Revision: 303506 URL: https://svnweb.freebsd.org/changeset/base/303506 Log: sdp: Destroy the PCB lock before freeing to the zone. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Jul 29 20:35:04 2016(r303505) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Jul 29 20:36:01 2016(r303506) @@ -176,8 +176,8 @@ sdp_pcbfree(struct sdp_sock *ssk) sdp_tx_ring_destroy(ssk); sdp_rx_ring_destroy(ssk); rw_destroy(>rx_ring.destroyed_lock); - uma_zfree(sdp_zone, ssk); rw_destroy(>lock); + uma_zfree(sdp_zone, ssk); } /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303505 - head/sys/ofed/drivers/infiniband/ulp/sdp
Author: markj Date: Fri Jul 29 20:35:04 2016 New Revision: 303505 URL: https://svnweb.freebsd.org/changeset/base/303505 Log: sdp: Use an mbufq for received control packets. This is simpler than the hand-rolled queue, and fixes a use-after-free. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h Fri Jul 29 20:33:43 2016(r303504) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h Fri Jul 29 20:35:04 2016(r303505) @@ -403,8 +403,7 @@ struct sdp_sock { struct sdp_rx_ring rx_ring; struct sdp_tx_ring tx_ring; struct rwlock lock; - struct mbuf *rx_ctl_q; - struct mbuf *rx_ctl_tail; + struct mbufqrxctlq; /* received control packets */ int qp_active; /* XXX Flag. */ int max_sge; Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Jul 29 20:33:43 2016(r303504) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Jul 29 20:35:04 2016(r303505) @@ -469,6 +469,7 @@ sdp_attach(struct socket *so, int proto, ssk->flags = 0; ssk->qp_active = 0; ssk->state = TCPS_CLOSED; + mbufq_init(>rxctlq, INT_MAX); SDP_LIST_WLOCK(); LIST_INSERT_HEAD(_list, ssk, list); sdp_count++; Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Jul 29 20:33:43 2016(r303504) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c Fri Jul 29 20:35:04 2016(r303505) @@ -459,14 +459,9 @@ sdp_process_rx_mb(struct sdp_sock *ssk, ntohl(rrch->len)); } #endif - mb->m_nextpkt = NULL; - if (ssk->rx_ctl_tail) - ssk->rx_ctl_tail->m_nextpkt = mb; - else - ssk->rx_ctl_q = mb; - ssk->rx_ctl_tail = mb; - - return 0; + if (mbufq_enqueue(>rxctlq, mb) != 0) + m_freem(mb); + return (0); } sdp_prf1(sk, NULL, "queueing %s mb\n", mid2str(h->mid)); @@ -611,11 +606,8 @@ sdp_do_posts(struct sdp_sock *ssk) return; } - while ((mb = ssk->rx_ctl_q)) { - ssk->rx_ctl_q = mb->m_nextpkt; - mb->m_nextpkt = NULL; + while ((mb = mbufq_dequeue(>rxctlq)) != NULL) sdp_process_rx_ctl_mb(ssk, mb); - } if (ssk->state == TCPS_TIME_WAIT) return; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303504 - head/sys/ofed/drivers/infiniband/ulp/sdp
Author: markj Date: Fri Jul 29 20:33:43 2016 New Revision: 303504 URL: https://svnweb.freebsd.org/changeset/base/303504 Log: sdp: Remove Linux build files. They aren't useful here, and Linux seems to have largely abandoned SDP anyway. Sponsored by: EMC / Isilon Storage Division Deleted: head/sys/ofed/drivers/infiniband/ulp/sdp/Kconfig head/sys/ofed/drivers/infiniband/ulp/sdp/Makefile ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303503 - head/sys/kern
Author: jhb Date: Fri Jul 29 20:19:14 2016 New Revision: 303503 URL: https://svnweb.freebsd.org/changeset/base/303503 Log: Don't treat NOCPU as a valid CPU to CPU_ISSET. If a thread is created bound to a cpuset it might already be bound before it's very first timeslice, and td_lastcpu will be NOCPU in that case. MFC after:1 week Modified: head/sys/kern/sched_4bsd.c Modified: head/sys/kern/sched_4bsd.c == --- head/sys/kern/sched_4bsd.c Fri Jul 29 19:36:10 2016(r303502) +++ head/sys/kern/sched_4bsd.c Fri Jul 29 20:19:14 2016(r303503) @@ -1241,7 +1241,7 @@ sched_pickcpu(struct thread *td) mtx_assert(_lock, MA_OWNED); - if (THREAD_CAN_SCHED(td, td->td_lastcpu)) + if (td->td_lastcpu != NOCPU && THREAD_CAN_SCHED(td, td->td_lastcpu)) best = td->td_lastcpu; else best = NOCPU; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303502 - head/usr.bin/indent
Author: pfg Date: Fri Jul 29 19:36:10 2016 New Revision: 303502 URL: https://svnweb.freebsd.org/changeset/base/303502 Log: indent(1): Use NULL instead of zero for pointers. Modified: head/usr.bin/indent/args.c head/usr.bin/indent/indent.c head/usr.bin/indent/io.c head/usr.bin/indent/lexi.c head/usr.bin/indent/pr_comment.c Modified: head/usr.bin/indent/args.c == --- head/usr.bin/indent/args.c Fri Jul 29 18:26:15 2016(r303501) +++ head/usr.bin/indent/args.c Fri Jul 29 19:36:10 2016(r303502) @@ -280,9 +280,9 @@ found: break; case STDIN: - if (input == 0) + if (input == NULL) input = stdin; - if (output == 0) + if (output == NULL) output = stdout; break; Modified: head/usr.bin/indent/indent.c == --- head/usr.bin/indent/indent.cFri Jul 29 18:26:15 2016 (r303501) +++ head/usr.bin/indent/indent.cFri Jul 29 19:36:10 2016 (r303502) @@ -147,11 +147,11 @@ main(int argc, char **argv) scase = ps.pcase = false; squest = 0; -sc_end = 0; -bp_save = 0; -be_save = 0; +sc_end = NULL; +bp_save = NULL; +be_save = NULL; -output = 0; +output = NULL; tabs_to_var = 0; /*--*\ @@ -328,7 +328,7 @@ main(int argc, char **argv) case lbrace:/* this is a brace that starts the compound * stmt */ - if (sc_end == 0) { /* ignore buffering if a comment wasn't + if (sc_end == NULL) { /* ignore buffering if a comment wasn't * stored up */ ps.search_brace = false; goto check_type; @@ -341,8 +341,8 @@ main(int argc, char **argv) } case comment: /* we have a comment, so we must copy it into * the buffer */ - if (!flushed_nl || sc_end != 0) { - if (sc_end == 0) { /* if this is the first comment, we + if (!flushed_nl || sc_end != NULL) { + if (sc_end == NULL) { /* if this is the first comment, we * must set up the buffer */ save_com[0] = save_com[1] = ' '; sc_end = &(save_com[2]); @@ -386,7 +386,7 @@ main(int argc, char **argv) && e_code != s_code && e_code[-1] == '}')) force_nl = false; - if (sc_end == 0) { /* ignore buffering if comment wasn't + if (sc_end == NULL) { /* ignore buffering if comment wasn't * saved up */ ps.search_brace = false; goto check_type; @@ -417,7 +417,7 @@ main(int argc, char **argv) * save_com */ *sc_end++ = ' ';/* add trailing blank, just in case */ buf_end = sc_end; - sc_end = 0; + sc_end = NULL; break; } /* end of switch */ if (type_code != 0) /* we must make this check, just in case there @@ -1101,9 +1101,9 @@ check_type: while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t')) e_lab--; - if (e_lab - s_lab == com_end && bp_save == 0) { /* comment on -* preprocessor line */ - if (sc_end == 0)/* if this is the first comment, we + /* comment on preprocessor line */ + if (e_lab - s_lab == com_end && bp_save == NULL) { + if (sc_end == NULL) /* if this is the first comment, we * must set up the buffer */ sc_end = &(save_com[0]); else { @@ -1126,7 +1126,7 @@ check_type: * save_com */ *sc_end++ = ' ';/* add trailing blank, just in case */ buf_end = sc_end; - sc_end = 0; + sc_end = NULL; } *e_lab = '\0'; /* null terminate line */ ps.pcase = false; Modified: head/usr.bin/indent/io.c == --- head/usr.bin/indent/io.cFri Jul 29 18:26:15 2016(r303501) +++ head/usr.bin/indent/io.cFri Jul 29 19:36:10 2016(r303502) @@ -348,10 +348,10 @@ fill_buffer(void) int i; FILE *f = input; -if (bp_save != 0) {/* there is a partly filled input buffer
Re: svn commit: r303501 - in head: sys/kern tests/sys/aio
On Friday, July 29, 2016 06:26:15 PM John Baldwin wrote: > Author: jhb > Date: Fri Jul 29 18:26:15 2016 > New Revision: 303501 > URL: https://svnweb.freebsd.org/changeset/base/303501 > > Log: > Fix locking issues with aio_fsync(). > > - Use correct lock in aio_cancel_sync when dequeueing job. > - Add _locked variants of aio_set/clear_cancel_function and use those > to avoid lock recursion when adding and removing fsync jobs to the > per-process sync queue. > - While here, add a basic test for aio_fsync(). > > PR: 211390 > Reported by:Randy Westlund> MFC after: 1 week > Sponsored by: Chelsio Communications > Differential Revision: https://reviews.freebsd.org/D7339 Oops, missed: Reviewed by:kib -- John Baldwin ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303501 - in head: sys/kern tests/sys/aio
Author: jhb Date: Fri Jul 29 18:26:15 2016 New Revision: 303501 URL: https://svnweb.freebsd.org/changeset/base/303501 Log: Fix locking issues with aio_fsync(). - Use correct lock in aio_cancel_sync when dequeueing job. - Add _locked variants of aio_set/clear_cancel_function and use those to avoid lock recursion when adding and removing fsync jobs to the per-process sync queue. - While here, add a basic test for aio_fsync(). PR: 211390 Reported by: Randy WestlundMFC after:1 week Sponsored by: Chelsio Communications Differential Revision:https://reviews.freebsd.org/D7339 Modified: head/sys/kern/vfs_aio.c head/tests/sys/aio/aio_test.c Modified: head/sys/kern/vfs_aio.c == --- head/sys/kern/vfs_aio.c Fri Jul 29 18:10:59 2016(r303500) +++ head/sys/kern/vfs_aio.c Fri Jul 29 18:26:15 2016(r303501) @@ -311,6 +311,7 @@ static void aio_proc_rundown_exec(void * static int aio_qphysio(struct proc *p, struct kaiocb *job); static voidaio_daemon(void *param); static voidaio_bio_done_notify(struct proc *userp, struct kaiocb *job); +static boolaio_clear_cancel_function_locked(struct kaiocb *job); static int aio_kick(struct proc *userp); static voidaio_kick_nowait(struct proc *userp); static voidaio_kick_helper(void *context, int pending); @@ -919,7 +920,7 @@ notification_done: if (--sjob->pending > 0) continue; TAILQ_REMOVE(>kaio_syncqueue, sjob, list); - if (!aio_clear_cancel_function(sjob)) + if (!aio_clear_cancel_function_locked(sjob)) continue; TAILQ_INSERT_TAIL(>kaio_syncready, sjob, list); schedule_fsync = true; @@ -967,40 +968,57 @@ aio_cancel_cleared(struct kaiocb *job) return ((job->jobflags & KAIOCB_CLEARED) != 0); } -bool -aio_clear_cancel_function(struct kaiocb *job) +static bool +aio_clear_cancel_function_locked(struct kaiocb *job) { - struct kaioinfo *ki; - ki = job->userproc->p_aioinfo; - AIO_LOCK(ki); + AIO_LOCK_ASSERT(job->userproc->p_aioinfo, MA_OWNED); MPASS(job->cancel_fn != NULL); if (job->jobflags & KAIOCB_CANCELLING) { job->jobflags |= KAIOCB_CLEARED; - AIO_UNLOCK(ki); return (false); } job->cancel_fn = NULL; - AIO_UNLOCK(ki); return (true); } bool -aio_set_cancel_function(struct kaiocb *job, aio_cancel_fn_t *func) +aio_clear_cancel_function(struct kaiocb *job) { struct kaioinfo *ki; + bool ret; ki = job->userproc->p_aioinfo; AIO_LOCK(ki); - if (job->jobflags & KAIOCB_CANCELLED) { - AIO_UNLOCK(ki); + ret = aio_clear_cancel_function_locked(job); + AIO_UNLOCK(ki); + return (ret); +} + +static bool +aio_set_cancel_function_locked(struct kaiocb *job, aio_cancel_fn_t *func) +{ + + AIO_LOCK_ASSERT(job->userproc->p_aioinfo, MA_OWNED); + if (job->jobflags & KAIOCB_CANCELLED) return (false); - } job->cancel_fn = func; - AIO_UNLOCK(ki); return (true); } +bool +aio_set_cancel_function(struct kaiocb *job, aio_cancel_fn_t *func) +{ + struct kaioinfo *ki; + bool ret; + + ki = job->userproc->p_aioinfo; + AIO_LOCK(ki); + ret = aio_set_cancel_function_locked(job, func); + AIO_UNLOCK(ki); + return (ret); +} + void aio_complete(struct kaiocb *job, long status, int error) { @@ -1655,10 +1673,10 @@ aio_cancel_sync(struct kaiocb *job) struct kaioinfo *ki; ki = job->userproc->p_aioinfo; - mtx_lock(_job_mtx); + AIO_LOCK(ki); if (!aio_cancel_cleared(job)) TAILQ_REMOVE(>kaio_syncqueue, job, list); - mtx_unlock(_job_mtx); + AIO_UNLOCK(ki); aio_cancel(job); } @@ -1718,7 +1736,8 @@ queueit: } } if (job->pending != 0) { - if (!aio_set_cancel_function(job, aio_cancel_sync)) { + if (!aio_set_cancel_function_locked(job, + aio_cancel_sync)) { AIO_UNLOCK(ki); aio_cancel(job); return (0); Modified: head/tests/sys/aio/aio_test.c == --- head/tests/sys/aio/aio_test.c Fri Jul 29 18:10:59 2016 (r303500) +++ head/tests/sys/aio/aio_test.c Fri Jul 29 18:26:15 2016 (r303501) @@ -924,6 +924,88 @@ ATF_TC_BODY(aio_socket_short_write_cance close(s[0]); } +/* + * This test just performs a basic test of aio_fsync(). + */
Re: svn commit: r303487 - head/usr.bin/indent
On 07/29/16 12:06, Piotr Stefaniak wrote: On 2016-07-29 18:28, Pedro F. Giffuni wrote: Author: pfg Date: Fri Jul 29 16:28:51 2016 New Revision: 303487 URL: https://svnweb.freebsd.org/changeset/base/303487 Log: indent(1): fix struct termination detection. Small style cleanup while here. Wrong commit message. Actually committed here is: Support "f" and "F" floating constant suffixes. Argggh .. yes will fix sorry.. will fix.. reverting :(. Pedro. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303497 - head/sys/dev/pci
On Friday, July 29, 2016 11:04:01 AM Ngie Cooper wrote: > > > On Jul 29, 2016, at 10:54, John Baldwinwrote: > > > > Author: jhb > > Date: Fri Jul 29 17:54:21 2016 > > New Revision: 303497 > > URL: https://svnweb.freebsd.org/changeset/base/303497 > > > > Log: > > Add a loader tunable (hw.pci.enable_pcie_hp) to disable PCI-e HotPlug. > > > > Some systems and/or devices (such as riser cards) do not include a > > non-compliant implementation of PCI-e HotPlug that can result in devices > > not being attached (e.g. the HotPlug code might assume that a card is > > being unplugged and will power the slot off and detach it). This > > tunable can be set to 0 to disable support for PCI-e HotPlug ignoring > > the incorrect HotPlug state on these slots. > > > > PR:211081 > > Reported by:Sergey Renkas (SuperMicro X7 riser card) > > Reported by:Jeffrey E Pieper > > (Intel X520 adapter) > > MFC after:1 week > > Relnotes:yes > > Should this be done on a per-bus basis? For now this is just a way to disable it globally. If need be we could add a separate hint to do it per-bridge (hint.pcib.X.hp=0/1 or some such). I'm still working with the Intel folks to see if I can narrow down exactly what makes this chip unhappy to see if I can include a workaround. Both of these devices use a chip from PLX to manage an internal PCI bridge. In both cases the PLX chip reports that a mechnical latch is open (PCI HP supports an optional latch that can be opened to release a card so it can be removed), but neither device has a real latch (so the sensor has not been wired correctly in either device). However, just bypassing the sensor check isn't sufficient to allow the devices behind the bridge to probe. -- John Baldwin ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303484 - head/usr.bin/indent
On 07/29/16 11:24, Benjamin Kaduk wrote: On Fri, Jul 29, 2016 at 11:20 AM, Benjamin Kaduk> wrote: On Fri, Jul 29, 2016 at 11:17 AM, Pedro F. Giffuni > wrote: Author: pfg Date: Fri Jul 29 16:17:54 2016 New Revision: 303484 URL: https://svnweb.freebsd.org/changeset/base/303484 Log: indent(1): Fix breakage caused by single comment following "else". indent(1) simply wasn't taught that "else" may be followed by a comment without any opening brace anywhere on the line, so it was very confused in such cases. Wrong commit message? I see no 'else' in this change. (I guess core's guidance is to revert and recommit with correct message, these days.) Nevermind, I think I see what's going on here, now. No problem. It would be great to have more eyes helping review the changes here: https://github.com/pstef/freebsd_indent/commits/master I only got started with a first batch of them. Regards, Pedro. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303497 - head/sys/dev/pci
> On Jul 29, 2016, at 10:54, John Baldwinwrote: > > Author: jhb > Date: Fri Jul 29 17:54:21 2016 > New Revision: 303497 > URL: https://svnweb.freebsd.org/changeset/base/303497 > > Log: > Add a loader tunable (hw.pci.enable_pcie_hp) to disable PCI-e HotPlug. > > Some systems and/or devices (such as riser cards) do not include a > non-compliant implementation of PCI-e HotPlug that can result in devices > not being attached (e.g. the HotPlug code might assume that a card is > being unplugged and will power the slot off and detach it). This > tunable can be set to 0 to disable support for PCI-e HotPlug ignoring > the incorrect HotPlug state on these slots. > > PR:211081 > Reported by:Sergey Renkas (SuperMicro X7 riser card) > Reported by:Jeffrey E Pieper > (Intel X520 adapter) > MFC after:1 week > Relnotes:yes Should this be done on a per-bus basis? Thanks! -Ngie ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303499 - head/usr.bin/indent
Author: pfg Date: Fri Jul 29 18:00:10 2016 New Revision: 303499 URL: https://svnweb.freebsd.org/changeset/base/303499 Log: indent(1): Support "f" and "F" floating constant suffixes. Actually this just brings back r303487 with the correct commit log. Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Obtained from:Piotr Stefaniak Modified: head/usr.bin/indent/lexi.c Modified: head/usr.bin/indent/lexi.c == --- head/usr.bin/indent/lexi.c Fri Jul 29 17:55:38 2016(r303498) +++ head/usr.bin/indent/lexi.c Fri Jul 29 18:00:10 2016(r303499) @@ -191,15 +191,13 @@ lexi(void) } } while (1) { - if (!(seensfx & 1) && - (*buf_ptr == 'U' || *buf_ptr == 'u')) { + if (!(seensfx & 1) && (*buf_ptr == 'U' || *buf_ptr == 'u')) { CHECK_SIZE_TOKEN; *e_token++ = *buf_ptr++; seensfx |= 1; continue; } - if (!(seensfx & 2) && - (*buf_ptr == 'L' || *buf_ptr == 'l')) { + if (!(seensfx & 2) && strchr("fFlL", *buf_ptr)) { CHECK_SIZE_TOKEN; if (buf_ptr[1] == buf_ptr[0]) *e_token++ = *buf_ptr++; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303498 - head/usr.bin/indent
Author: pfg Date: Fri Jul 29 17:55:38 2016 New Revision: 303498 URL: https://svnweb.freebsd.org/changeset/base/303498 Log: Revert r303487: Wrong commit log. Will be brought back with the correct log. Modified: head/usr.bin/indent/lexi.c Modified: head/usr.bin/indent/lexi.c == --- head/usr.bin/indent/lexi.c Fri Jul 29 17:54:21 2016(r303497) +++ head/usr.bin/indent/lexi.c Fri Jul 29 17:55:38 2016(r303498) @@ -191,13 +191,15 @@ lexi(void) } } while (1) { - if (!(seensfx & 1) && (*buf_ptr == 'U' || *buf_ptr == 'u')) { + if (!(seensfx & 1) && + (*buf_ptr == 'U' || *buf_ptr == 'u')) { CHECK_SIZE_TOKEN; *e_token++ = *buf_ptr++; seensfx |= 1; continue; } - if (!(seensfx & 2) && strchr("fFlL", *buf_ptr)) { + if (!(seensfx & 2) && + (*buf_ptr == 'L' || *buf_ptr == 'l')) { CHECK_SIZE_TOKEN; if (buf_ptr[1] == buf_ptr[0]) *e_token++ = *buf_ptr++; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303497 - head/sys/dev/pci
Author: jhb Date: Fri Jul 29 17:54:21 2016 New Revision: 303497 URL: https://svnweb.freebsd.org/changeset/base/303497 Log: Add a loader tunable (hw.pci.enable_pcie_hp) to disable PCI-e HotPlug. Some systems and/or devices (such as riser cards) do not include a non-compliant implementation of PCI-e HotPlug that can result in devices not being attached (e.g. the HotPlug code might assume that a card is being unplugged and will power the slot off and detach it). This tunable can be set to 0 to disable support for PCI-e HotPlug ignoring the incorrect HotPlug state on these slots. PR: 211081 Reported by: Sergey Renkas(SuperMicro X7 riser card) Reported by: Jeffrey E Pieper (Intel X520 adapter) MFC after:1 week Relnotes: yes Modified: head/sys/dev/pci/pci_pci.c Modified: head/sys/dev/pci/pci_pci.c == --- head/sys/dev/pci/pci_pci.c Fri Jul 29 17:28:14 2016(r303496) +++ head/sys/dev/pci/pci_pci.c Fri Jul 29 17:54:21 2016(r303497) @@ -907,11 +907,19 @@ pcib_set_mem_decode(struct pcib_softc *s /* * PCI-express HotPlug support. */ +static int pci_enable_pcie_hp = 1; +SYSCTL_INT(_hw_pci, OID_AUTO, enable_pcie_hp, CTLFLAG_RDTUN, +_enable_pcie_hp, 0, +"Enable support for native PCI-express HotPlug."); + static void pcib_probe_hotplug(struct pcib_softc *sc) { device_t dev; + if (!pci_enable_pcie_hp) + return; + dev = sc->dev; if (pci_find_cap(dev, PCIY_EXPRESS, NULL) != 0) return; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303495 - in head: include/xlocale lib/libc/locale
Author: ed Date: Fri Jul 29 17:18:47 2016 New Revision: 303495 URL: https://svnweb.freebsd.org/changeset/base/303495 Log: Change the return type of freelocale(3) to void. Our version of this function currently returns an integer indicating failure or success, whereas POSIX specifies that this function has no return value. It returns void. Patch up the header, sources and man page to use the right type. While there, use the opportunity to simplify the body of this function. Theoretically speaking, this change breaks the ABI of this function. That said, I have yet to find any code that makes use of freelocale()'s return value. I couldn't find any of it in the base system, nor did an exp-run reveal any breakage caused by this change. PR: 211394 (exp-run) Modified: head/include/xlocale/_locale.h head/lib/libc/locale/freelocale.3 head/lib/libc/locale/xlocale.c Modified: head/include/xlocale/_locale.h == --- head/include/xlocale/_locale.h Fri Jul 29 17:15:41 2016 (r303494) +++ head/include/xlocale/_locale.h Fri Jul 29 17:18:47 2016 (r303495) @@ -48,7 +48,7 @@ typedef struct_xlocale *locale_t; #endif locale_tduplocale(locale_t base); -int freelocale(locale_t loc); +voidfreelocale(locale_t loc); locale_tnewlocale(int mask, const char *locale, locale_t base); const char *querylocale(int mask, locale_t loc); locale_tuselocale(locale_t loc); Modified: head/lib/libc/locale/freelocale.3 == --- head/lib/libc/locale/freelocale.3 Fri Jul 29 17:15:41 2016 (r303494) +++ head/lib/libc/locale/freelocale.3 Fri Jul 29 17:18:47 2016 (r303495) @@ -26,7 +26,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd September 17, 2011 +.Dd July 26, 2016 .Dt FREELOCALE 3 .Os .Sh NAME @@ -39,7 +39,7 @@ or .Lb libc .Sh SYNOPSIS .In locale.h -.Ft int +.Ft void .Fn freelocale "locale_t locale" .Sh DESCRIPTION Frees a @@ -47,8 +47,6 @@ Frees a This relinquishes any resources held exclusively by this locale. Note that locales share reference-counted components, so a call to this function is not guaranteed to free all of the components. -.Sh RETURN VALUES -Returns 0 on success or -1 on error. .Sh SEE ALSO .Xr duplocale 3 , .Xr localeconv 3 , @@ -57,12 +55,5 @@ Returns 0 on success or -1 on error. .Xr uselocale 3 , .Xr xlocale 3 .Sh STANDARDS -The -.Fn freelocale -function -differs from -.St -p1003.1-2008 -in that its return type is -.Vt int -rather than -.Vt void . +This function conforms to +.St -p1003.1-2008 . Modified: head/lib/libc/locale/xlocale.c == --- head/lib/libc/locale/xlocale.c Fri Jul 29 17:15:41 2016 (r303494) +++ head/lib/libc/locale/xlocale.c Fri Jul 29 17:18:47 2016 (r303495) @@ -325,20 +325,18 @@ locale_t duplocale(locale_t base) * Free a locale_t. This is quite a poorly named function. It actually * disclaims a reference to a locale_t, rather than freeing it. */ -int +void freelocale(locale_t loc) { - /* Fail if we're passed something that isn't a locale. */ - if ((NULL == loc) || (LC_GLOBAL_LOCALE == loc)) { - return (-1); - } - /* If we're passed the global locale, pretend that we freed it but don't -* actually do anything. */ - if (&__xlocale_global_locale == loc) { - return (0); - } - xlocale_release(loc); - return (0); + + /* +* Fail if we're passed something that isn't a locale. If we're +* passed the global locale, pretend that we freed it but don't +* actually do anything. +*/ + if (loc != NULL && loc != LC_GLOBAL_LOCALE && + loc != &__xlocale_global_locale) + xlocale_release(loc); } /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303494 - in head: share/man/man4 sys/dev/ntb sys/dev/ntb/if_ntb
Author: mav Date: Fri Jul 29 17:15:41 2016 New Revision: 303494 URL: https://svnweb.freebsd.org/changeset/base/303494 Log: Once more refactor KPI between ntb_transport(4) and if_ntb(4).. New design allows to attach multiple consumers to ntb_transport(4) instance. Previous design obtained from Linux theoretically allowed that, but was not practically usable (Linux also has only one consumer driver now). Modified: head/share/man/man4/if_ntb.4 head/share/man/man4/ntb_transport.4 head/sys/dev/ntb/if_ntb/if_ntb.c head/sys/dev/ntb/ntb_transport.c head/sys/dev/ntb/ntb_transport.h Modified: head/share/man/man4/if_ntb.4 == --- head/share/man/man4/if_ntb.4Fri Jul 29 17:12:31 2016 (r303493) +++ head/share/man/man4/if_ntb.4Fri Jul 29 17:15:41 2016 (r303494) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 10, 2016 +.Dd July 29, 2016 .Dt IF_NTB 4 .Os .Sh NAME @@ -49,7 +49,7 @@ The following tunables are settable from .Bl -ohang .It Va hw.if_ntb.num_queues Number of transport queues to use per interface. -Default is 1. +Default is unlimited. .El .Sh DESCRIPTION The @@ -84,3 +84,6 @@ Later improvements were done by .An Conrad E. Meyer Aq Mt c...@freebsd.org and .An Alexander Motin Aq Mt m...@freebsd.org . +.Sh BUGS +Linux supports only one queue per interface, so manual configuration +may be required for compatibility. Modified: head/share/man/man4/ntb_transport.4 == --- head/share/man/man4/ntb_transport.4 Fri Jul 29 17:12:31 2016 (r303493) +++ head/share/man/man4/ntb_transport.4 Fri Jul 29 17:15:41 2016 (r303494) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 10, 2016 +.Dd July 29, 2016 .Dt NTB_TRANSPORT 4 .Os .Sh NAME @@ -44,10 +44,15 @@ The following tunables are settable from .It Va hw.ntb_transport.debug_level Driver debug level. The default value is 0, higher means more verbose. -.It Va hw.ntb_transport.max_num_clients -Number of bidirectional queues to setup. -The default value is 0, that means one queue per available memory window. -Maximal number is limited by number of doorbells. +.It Va hint.ntb_transport. Ns Ar X Ns Va .config +Configures queues allocation for consumer devices, separated by commas. +Each device can be configured as: "[:]", where: +.Va name +is a name of the driver which should attach the device (empty means any), +.Va queues +is a number of queues to allocate (empty means automatic), +The default configuration is empty string, which means single device +with one queue per memory window allowing any driver attachment. .El .Sh DESCRIPTION The Modified: head/sys/dev/ntb/if_ntb/if_ntb.c == --- head/sys/dev/ntb/if_ntb/if_ntb.cFri Jul 29 17:12:31 2016 (r303493) +++ head/sys/dev/ntb/if_ntb/if_ntb.cFri Jul 29 17:15:41 2016 (r303494) @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); static SYSCTL_NODE(_hw, OID_AUTO, if_ntb, CTLFLAG_RW, 0, "if_ntb"); -static unsigned g_if_ntb_num_queues = 1; +static unsigned g_if_ntb_num_queues = UINT_MAX; SYSCTL_UINT(_hw_if_ntb, OID_AUTO, num_queues, CTLFLAG_RWTUN, _if_ntb_num_queues, 0, "Number of queues per interface"); @@ -144,7 +144,8 @@ ntb_net_attach(device_t dev) if_initname(ifp, device_get_name(dev), device_get_unit(dev)); if_setdev(ifp, dev); - sc->num_queues = g_if_ntb_num_queues; + sc->num_queues = min(g_if_ntb_num_queues, + ntb_transport_queue_count(dev)); sc->queues = malloc(sc->num_queues * sizeof(struct ntb_net_queue), M_DEVBUF, M_WAITOK | M_ZERO); sc->mtu = INT_MAX; @@ -152,8 +153,7 @@ ntb_net_attach(device_t dev) q = >queues[i]; q->sc = sc; q->ifp = ifp; - q->qp = ntb_transport_create_queue(q, - device_get_parent(dev), ); + q->qp = ntb_transport_create_queue(dev, i, , q); if (q->qp == NULL) break; sc->mtu = imin(sc->mtu, ntb_transport_max_size(q->qp)); @@ -167,6 +167,7 @@ ntb_net_attach(device_t dev) callout_init(>queue_full, 1); } sc->num_queues = i; + device_printf(dev, "%d queue(s)\n", sc->num_queues); if_setinitfn(ifp, ntb_net_init); if_setsoftc(ifp, sc); Modified: head/sys/dev/ntb/ntb_transport.c == --- head/sys/dev/ntb/ntb_transport.cFri Jul 29 17:12:31 2016 (r303493) +++ head/sys/dev/ntb/ntb_transport.cFri Jul 29 17:15:41 2016 (r303494) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -64,13 +63,6 @@ __FBSDID("$FreeBSD$"); #include "ntb.h" #include
Re: svn commit: r303487 - head/usr.bin/indent
On 2016-07-29 18:28, Pedro F. Giffuni wrote: Author: pfg Date: Fri Jul 29 16:28:51 2016 New Revision: 303487 URL: https://svnweb.freebsd.org/changeset/base/303487 Log: indent(1): fix struct termination detection. Small style cleanup while here. Wrong commit message. Actually committed here is: Support "f" and "F" floating constant suffixes. Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Obtained from:Piotr Stefaniak Modified: head/usr.bin/indent/lexi.c Modified: head/usr.bin/indent/lexi.c == --- head/usr.bin/indent/lexi.c Fri Jul 29 16:25:09 2016(r303486) +++ head/usr.bin/indent/lexi.c Fri Jul 29 16:28:51 2016(r303487) @@ -191,15 +191,13 @@ lexi(void) } } while (1) { - if (!(seensfx & 1) && - (*buf_ptr == 'U' || *buf_ptr == 'u')) { + if (!(seensfx & 1) && (*buf_ptr == 'U' || *buf_ptr == 'u')) { CHECK_SIZE_TOKEN; *e_token++ = *buf_ptr++; seensfx |= 1; continue; } - if (!(seensfx & 2) && - (*buf_ptr == 'L' || *buf_ptr == 'l')) { + if (!(seensfx & 2) && strchr("fFlL", *buf_ptr)) { CHECK_SIZE_TOKEN; if (buf_ptr[1] == buf_ptr[0]) *e_token++ = *buf_ptr++; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org" ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303492 - head/sys/vm
Author: alc Date: Fri Jul 29 16:43:51 2016 New Revision: 303492 URL: https://svnweb.freebsd.org/changeset/base/303492 Log: Remove a probe declaration that has been unused since r292469, when vm_pageout_grow_cache() was replaced. MFC after:3 days Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cFri Jul 29 16:35:58 2016(r303491) +++ head/sys/vm/vm_pageout.cFri Jul 29 16:43:51 2016(r303492) @@ -139,7 +139,6 @@ SYSINIT(pagedaemon, SI_SUB_KTHREAD_PAGE, _kp); SDT_PROVIDER_DEFINE(vm); -SDT_PROBE_DEFINE(vm, , , vm__lowmem_cache); SDT_PROBE_DEFINE(vm, , , vm__lowmem_scan); #if !defined(NO_SWAPPING) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303491 - head/sys/x86/x86
Author: royger Date: Fri Jul 29 16:35:58 2016 New Revision: 303491 URL: https://svnweb.freebsd.org/changeset/base/303491 Log: Revert r291022: x86/intr: allow mutex recursion in intr_remove_handler This was only needed for Xen, and a better way to deal with this issue has been found, so this commit can be reverted. Sponsored by: Citrix Systems R MFC after:5 days Reviewed by: kib Differential revision:https://reviews.freebsd.org/D7363 Modified: head/sys/x86/x86/intr_machdep.c Modified: head/sys/x86/x86/intr_machdep.c == --- head/sys/x86/x86/intr_machdep.c Fri Jul 29 16:34:54 2016 (r303490) +++ head/sys/x86/x86/intr_machdep.c Fri Jul 29 16:35:58 2016 (r303491) @@ -197,28 +197,19 @@ int intr_remove_handler(void *cookie) { struct intsrc *isrc; - int error, mtx_owned; + int error; isrc = intr_handler_source(cookie); error = intr_event_remove_handler(cookie); if (error == 0) { - /* -* Recursion is needed here so PICs can remove interrupts -* while resuming. It was previously not possible due to -* intr_resume holding the intr_table_lock and -* intr_remove_handler recursing on it. -*/ - mtx_owned = mtx_owned(_table_lock); - if (mtx_owned == 0) - mtx_lock(_table_lock); + mtx_lock(_table_lock); isrc->is_handlers--; if (isrc->is_handlers == 0) { isrc->is_pic->pic_disable_source(isrc, PIC_NO_EOI); isrc->is_pic->pic_disable_intr(isrc); } intrcnt_updatename(isrc); - if (mtx_owned == 0) - mtx_unlock(_table_lock); + mtx_unlock(_table_lock); } return (error); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303490 - head/sys/x86/xen
Author: royger Date: Fri Jul 29 16:34:54 2016 New Revision: 303490 URL: https://svnweb.freebsd.org/changeset/base/303490 Log: xen-intr: fix removal of event channels during resume Event channel handlers cannot be removed during resume because there might be an interrupt thread running on a CPU currently blocked in the cpususpend_handler, which prevents the call to intr_remove_handler from finishing and completely freezes the system during resume. r291022 tried to fix this by allowing recursion in intr_remove_handler, but that's clearly not enough. Instead don't remove the handlers at the interrupt resume phase, and let each driver remove the handler by itself during resume. In order to do this, change the opaque event channel handler cookie to use the global interrupt vector instead of the event channel port. The event channel port cannot be used because after resume all event channels are reset, and the port numbers can change. Sponsored by: Citrix Systems R MFC after:5 days Modified: head/sys/x86/xen/xen_intr.c Modified: head/sys/x86/xen/xen_intr.c == --- head/sys/x86/xen/xen_intr.c Fri Jul 29 16:34:16 2016(r303489) +++ head/sys/x86/xen/xen_intr.c Fri Jul 29 16:34:54 2016(r303490) @@ -130,8 +130,6 @@ struct xenisrc { u_int xi_masked:1; }; -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) - static voidxen_intr_suspend(struct pic *); static voidxen_intr_resume(struct pic *, bool suspend_cancelled); static voidxen_intr_enable_source(struct intsrc *isrc); @@ -422,7 +420,7 @@ xen_intr_bind_isrc(struct xenisrc **isrc mtx_unlock(_intr_isrc_lock); /* Assign the opaque handler (the event channel port) */ - *port_handlep = >xi_port; + *port_handlep = >xi_vector; #ifdef SMP if (type == EVTCHN_TYPE_PORT) { @@ -468,16 +466,17 @@ xen_intr_bind_isrc(struct xenisrc **isrc static struct xenisrc * xen_intr_isrc(xen_intr_handle_t handle) { - evtchn_port_t port; + int vector; if (handle == NULL) return (NULL); - port = *(evtchn_port_t *)handle; - if (!is_valid_evtchn(port) || port >= NR_EVENT_CHANNELS) - return (NULL); + vector = *(int *)handle; + KASSERT(vector >= FIRST_EVTCHN_INT && + vector < (FIRST_EVTCHN_INT + xen_intr_auto_vector_count), + ("Xen interrupt vector is out of range")); - return (xen_intr_port_to_isrc[port]); + return ((struct xenisrc *)intr_lookup_source(vector)); } /** @@ -780,10 +779,6 @@ xen_intr_resume(struct pic *unused, bool xen_rebind_virq(isrc); break; default: - intr_remove_handler(isrc->xi_cookie); - isrc->xi_cpu = 0; - isrc->xi_type = EVTCHN_TYPE_UNBOUND; - isrc->xi_cookie = NULL; break; } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303489 - head/usr.bin/indent
Author: pfg Date: Fri Jul 29 16:34:16 2016 New Revision: 303489 URL: https://svnweb.freebsd.org/changeset/base/303489 Log: indent(1): Removed whitespace shouldn't be considered in column calculations. This piece of code removed tabs and space characters from after colons that follow labels by decrementing the e_lab (end of label) "pointer" which is later used to calculate the width of the string that fprintf() puts into "output". But pad_output() gets the length from the actual string, so it miscalculated what the current column is. Fixed by putting a string terminator at the e_lab "pointer". Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Obtained from:Piotr Stefaniak Modified: head/usr.bin/indent/io.c Modified: head/usr.bin/indent/io.c == --- head/usr.bin/indent/io.cFri Jul 29 16:33:45 2016(r303488) +++ head/usr.bin/indent/io.cFri Jul 29 16:34:16 2016(r303489) @@ -116,6 +116,7 @@ dump_line(void) } while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t')) e_lab--; + *e_lab = '\0'; cur_col = pad_output(1, compute_label_target()); if (s_lab[0] == '#' && (strncmp(s_lab, "#else", 5) == 0 || strncmp(s_lab, "#endif", 6) == 0)) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303488 - head/sys/dev/xen/netfront
Author: royger Date: Fri Jul 29 16:33:45 2016 New Revision: 303488 URL: https://svnweb.freebsd.org/changeset/base/303488 Log: xen-netfront: fix trying to send packets with disconnected netfront In certain circumstances xn_txq_mq_start might be called with num_queues == 0 during the resume phase after a migration, which can trigger a KASSERT. Fix this by making sure the carrier is on before trying to transmit, or else return that the queues are full. Just as a note, I haven't been able to reproduce this crash on my test systems, but I still think it's possible and worth fixing. Reported by: Karl PielorzSponsored by: Citrix Systems R MFC after:5 days Reviewed by: Wei Liu Differential revision:https://reviews.freebsd.org/D7349 Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c == --- head/sys/dev/xen/netfront/netfront.cFri Jul 29 16:28:51 2016 (r303487) +++ head/sys/dev/xen/netfront/netfront.cFri Jul 29 16:33:45 2016 (r303488) @@ -2157,6 +2157,9 @@ xn_txq_mq_start(struct ifnet *ifp, struc np = ifp->if_softc; npairs = np->num_queues; + if (!netfront_carrier_ok(np)) + return (ENOBUFS); + KASSERT(npairs != 0, ("called with 0 available queues")); /* check if flowid is set */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303484 - head/usr.bin/indent
On Fri, Jul 29, 2016 at 11:20 AM, Benjamin Kadukwrote: > On Fri, Jul 29, 2016 at 11:17 AM, Pedro F. Giffuni > wrote: > >> Author: pfg >> Date: Fri Jul 29 16:17:54 2016 >> New Revision: 303484 >> URL: https://svnweb.freebsd.org/changeset/base/303484 >> >> Log: >> indent(1): Fix breakage caused by single comment following "else". >> >> indent(1) simply wasn't taught that "else" may be followed by a comment >> without any opening brace anywhere on the line, so it was very confused >> in such cases. >> >> > Wrong commit message? I see no 'else' in this change. > (I guess core's guidance is to revert and recommit with correct message, > these days.) > Nevermind, I think I see what's going on here, now. -Ben ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303487 - head/usr.bin/indent
Author: pfg Date: Fri Jul 29 16:28:51 2016 New Revision: 303487 URL: https://svnweb.freebsd.org/changeset/base/303487 Log: indent(1): fix struct termination detection. Small style cleanup while here. Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Obtained from:Piotr Stefaniak Modified: head/usr.bin/indent/lexi.c Modified: head/usr.bin/indent/lexi.c == --- head/usr.bin/indent/lexi.c Fri Jul 29 16:25:09 2016(r303486) +++ head/usr.bin/indent/lexi.c Fri Jul 29 16:28:51 2016(r303487) @@ -191,15 +191,13 @@ lexi(void) } } while (1) { - if (!(seensfx & 1) && - (*buf_ptr == 'U' || *buf_ptr == 'u')) { + if (!(seensfx & 1) && (*buf_ptr == 'U' || *buf_ptr == 'u')) { CHECK_SIZE_TOKEN; *e_token++ = *buf_ptr++; seensfx |= 1; continue; } - if (!(seensfx & 2) && - (*buf_ptr == 'L' || *buf_ptr == 'l')) { + if (!(seensfx & 2) && strchr("fFlL", *buf_ptr)) { CHECK_SIZE_TOKEN; if (buf_ptr[1] == buf_ptr[0]) *e_token++ = *buf_ptr++; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303486 - head/lib/libc/gen
Author: ed Date: Fri Jul 29 16:25:09 2016 New Revision: 303486 URL: https://svnweb.freebsd.org/changeset/base/303486 Log: Mention that basename(3) and dirname(3) will change in the future. Update the existing manual pages for basename(3) and dirname(3) to mention that in future versions of FreeBSD, these functions will no longer use internal buffers for storing the results. MFC after:1 week Differential Revision:https://reviews.freebsd.org/D7356 Modified: head/lib/libc/gen/basename.3 head/lib/libc/gen/dirname.3 Modified: head/lib/libc/gen/basename.3 == --- head/lib/libc/gen/basename.3Fri Jul 29 16:23:00 2016 (r303485) +++ head/lib/libc/gen/basename.3Fri Jul 29 16:25:09 2016 (r303486) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 28, 2016 +.Dd July 29, 2016 .Dt BASENAME 3 .Os .Sh NAME @@ -61,8 +61,16 @@ function returns a pointer to internal storage space allocated on the first call that will be overwritten by subsequent calls. +.Pp +Other vendor implementations of +.Fn basename +may store their result in the input buffer, +making it safe to use in multithreaded applications. +Future versions of +.Fx +will follow this approach as well. .Fn basename_r -is therefore preferred for threaded applications. +will then become obsolete. .Sh RETURN VALUES On successful completion, .Fn basename Modified: head/lib/libc/gen/dirname.3 == --- head/lib/libc/gen/dirname.3 Fri Jul 29 16:23:00 2016(r303485) +++ head/lib/libc/gen/dirname.3 Fri Jul 29 16:25:09 2016(r303486) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 28, 2016 +.Dd July 29, 2016 .Dt DIRNAME 3 .Os .Sh NAME @@ -56,10 +56,11 @@ by subsequent calls. .Pp Other vendor implementations of .Fn dirname -may modify the contents of the string passed to -.Fn dirname ; -this should be taken into account when writing code which calls this function -if portability is desired. +may store their result in the input buffer, +making it safe to use in multithreaded applications. +Future versions of +.Fx +will follow this approach as well. .Sh RETURN VALUES On successful completion, .Fn dirname ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303485 - head/usr.bin/indent
Author: pfg Date: Fri Jul 29 16:23:00 2016 New Revision: 303485 URL: https://svnweb.freebsd.org/changeset/base/303485 Log: indent(1): fix struct termination detection. Semicolons inside struct declarations don't end the declarations. Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Obtained from:Piotr Stefaniak Modified: head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.c == --- head/usr.bin/indent/indent.cFri Jul 29 16:17:54 2016 (r303484) +++ head/usr.bin/indent/indent.cFri Jul 29 16:23:00 2016 (r303485) @@ -701,8 +701,10 @@ check_type: break; case semicolon: /* got a ';' */ - ps.in_or_st = false;/* we are not in an initialization or -* structure declaration */ + if (ps.dec_nest == 0) { + /* we are not in an initialization or structure declaration */ + ps.in_or_st = false; + } scase = false; /* these will only need resetting in an error */ squest = 0; if (ps.last_token == rparen && rparen_count == 0) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r303484 - head/usr.bin/indent
On Fri, Jul 29, 2016 at 11:17 AM, Pedro F. Giffuniwrote: > Author: pfg > Date: Fri Jul 29 16:17:54 2016 > New Revision: 303484 > URL: https://svnweb.freebsd.org/changeset/base/303484 > > Log: > indent(1): Fix breakage caused by single comment following "else". > > indent(1) simply wasn't taught that "else" may be followed by a comment > without any opening brace anywhere on the line, so it was very confused > in such cases. > > Wrong commit message? I see no 'else' in this change. (I guess core's guidance is to revert and recommit with correct message, these days.) -Ben > Differential Revision: https://reviews.freebsd.org/D6966 (Partial) > Obtained from:Piotr Stefaniak > > Modified: > head/usr.bin/indent/indent.c > > Modified: head/usr.bin/indent/indent.c > > == > --- head/usr.bin/indent/indent.cFri Jul 29 16:14:03 2016 > (r303483) > +++ head/usr.bin/indent/indent.cFri Jul 29 16:17:54 2016 > (r303484) > @@ -319,6 +319,8 @@ main(int argc, char **argv) > switch (type_code) { > case newline: > ++line_no; > + if (sc_end != NULL) > + goto sw_buffer; /* dump comment, if any */ > flushed_nl = true; > case form_feed: > break; /* form feeds and newlines found here will > be > ___ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org" > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303484 - head/usr.bin/indent
Author: pfg Date: Fri Jul 29 16:17:54 2016 New Revision: 303484 URL: https://svnweb.freebsd.org/changeset/base/303484 Log: indent(1): Fix breakage caused by single comment following "else". indent(1) simply wasn't taught that "else" may be followed by a comment without any opening brace anywhere on the line, so it was very confused in such cases. Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Obtained from:Piotr Stefaniak Modified: head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.c == --- head/usr.bin/indent/indent.cFri Jul 29 16:14:03 2016 (r303483) +++ head/usr.bin/indent/indent.cFri Jul 29 16:17:54 2016 (r303484) @@ -319,6 +319,8 @@ main(int argc, char **argv) switch (type_code) { case newline: ++line_no; + if (sc_end != NULL) + goto sw_buffer; /* dump comment, if any */ flushed_nl = true; case form_feed: break; /* form feeds and newlines found here will be ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303483 - head/usr.bin/indent
Author: pfg Date: Fri Jul 29 16:14:03 2016 New Revision: 303483 URL: https://svnweb.freebsd.org/changeset/base/303483 Log: indent(1): Avoid potential use-after-free. last_bl is a char pointer that tracks the last blank character in a comment, which is used for wrapping long comment lines. Since the underlying array may be reallocated, make sure last_bl is up to date when that happens. Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Obtained from:Piotr Stefaniak Modified: head/usr.bin/indent/indent_globs.h Modified: head/usr.bin/indent/indent_globs.h == --- head/usr.bin/indent/indent_globs.h Fri Jul 29 16:09:05 2016 (r303482) +++ head/usr.bin/indent/indent_globs.h Fri Jul 29 16:14:03 2016 (r303483) @@ -71,6 +71,7 @@ FILE *output; /* the output file if (combuf == NULL) \ err(1, NULL); \ e_com = combuf + (e_com-s_com) + 1; \ + last_bl = combuf + (last_bl-s_com) + 1; \ l_com = combuf + nsize - 5; \ s_com = combuf + 1; \ } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303482 - head/usr.bin/indent
Author: pfg Date: Fri Jul 29 16:09:05 2016 New Revision: 303482 URL: https://svnweb.freebsd.org/changeset/base/303482 Log: indent(1): Avoid out of bound access of array codebuf. dump_line() requires s_code to be a string, because it will call count_spaces(). Differential Revision: https://reviews.freebsd.org/D6966 (Partial) Obtained from:Piotr Stefaniak Modified: head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.c == --- head/usr.bin/indent/indent.cFri Jul 29 15:24:50 2016 (r303481) +++ head/usr.bin/indent/indent.cFri Jul 29 16:09:05 2016 (r303482) @@ -979,8 +979,10 @@ check_type: if (ps.want_blank) *e_code++ = ' '; ps.want_blank = false; - if (dec_ind && s_code != e_code) + if (dec_ind && s_code != e_code) { + *e_code = '\0'; dump_line(); + } dec_ind = 0; } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303481 - head/sys/conf
Author: imp Date: Fri Jul 29 15:24:50 2016 New Revision: 303481 URL: https://svnweb.freebsd.org/changeset/base/303481 Log: Fix typo. Modified: head/sys/conf/files Modified: head/sys/conf/files == --- head/sys/conf/files Fri Jul 29 12:30:33 2016(r303480) +++ head/sys/conf/files Fri Jul 29 15:24:50 2016(r303481) @@ -86,9 +86,9 @@ cam/cam_xpt.c optional scbus cam/ata/ata_all.c optional scbus cam/ata/ata_xpt.c optional scbus cam/ata/ata_pmp.c optional scbus -cam/nvme/nvme_all.coptional scbus nvmd !nvd +cam/nvme/nvme_all.coptional scbus nvme !nvd cam/nvme/nvme_da.c optional scbus nvme da !nvd -cam/nvme/nvme_xpt.coptional scbus nvmd !nvd +cam/nvme/nvme_xpt.coptional scbus nvme !nvd cam/scsi/scsi_xpt.coptional scbus cam/scsi/scsi_all.coptional scbus cam/scsi/scsi_cd.c optional cd ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303480 - in head/sys/modules/dtrace: . dtraceall
Author: br Date: Fri Jul 29 12:30:33 2016 New Revision: 303480 URL: https://svnweb.freebsd.org/changeset/base/303480 Log: Include FBT to modules build on RISC-V. Modified: head/sys/modules/dtrace/Makefile head/sys/modules/dtrace/dtraceall/dtraceall.c Modified: head/sys/modules/dtrace/Makefile == --- head/sys/modules/dtrace/MakefileFri Jul 29 12:29:17 2016 (r303479) +++ head/sys/modules/dtrace/MakefileFri Jul 29 12:30:33 2016 (r303480) @@ -24,7 +24,9 @@ SUBDIR+= fbt fasttrap .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64" SUBDIR+= systrace_freebsd32 .endif -.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" +.if ${MACHINE_CPUARCH} == "aarch64" || \ +${MACHINE_CPUARCH} == "arm" || \ +${MACHINE_CPUARCH} == "riscv" SUBDIR+= fbt .endif .include Modified: head/sys/modules/dtrace/dtraceall/dtraceall.c == --- head/sys/modules/dtrace/dtraceall/dtraceall.c Fri Jul 29 12:29:17 2016(r303479) +++ head/sys/modules/dtrace/dtraceall/dtraceall.c Fri Jul 29 12:30:33 2016(r303480) @@ -70,7 +70,7 @@ MODULE_DEPEND(dtraceall, dtmalloc, 1, 1, MODULE_DEPEND(dtraceall, dtnfscl, 1, 1, 1); #endif #if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \ -defined(__i386__) || defined(__powerpc__) +defined(__i386__) || defined(__powerpc__) || defined(__riscv__) MODULE_DEPEND(dtraceall, fbt, 1, 1, 1); #endif #if defined(__amd64__) || defined(__i386__) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303479 - head/sys/cddl/dev/fbt/riscv
Author: br Date: Fri Jul 29 12:29:17 2016 New Revision: 303479 URL: https://svnweb.freebsd.org/changeset/base/303479 Log: Remove unused variables. Modified: head/sys/cddl/dev/fbt/riscv/fbt_isa.c Modified: head/sys/cddl/dev/fbt/riscv/fbt_isa.c == --- head/sys/cddl/dev/fbt/riscv/fbt_isa.c Fri Jul 29 12:15:55 2016 (r303478) +++ head/sys/cddl/dev/fbt/riscv/fbt_isa.c Fri Jul 29 12:29:17 2016 (r303479) @@ -82,11 +82,9 @@ fbt_provide_module_function(linker_file_ linker_symval_t *symval, void *opaque) { fbt_probe_t *fbt, *retfbt; - uint32_t *target, *start; uint32_t *instr, *limit; const char *name; char *modname; - int offs; modname = opaque; name = symval->name; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303478 - head/sys/fs/autofs
Author: trasz Date: Fri Jul 29 12:15:55 2016 New Revision: 303478 URL: https://svnweb.freebsd.org/changeset/base/303478 Log: Remove write-only variable. MFC after:1 month Modified: head/sys/fs/autofs/autofs_vnops.c Modified: head/sys/fs/autofs/autofs_vnops.c == --- head/sys/fs/autofs/autofs_vnops.c Fri Jul 29 11:33:23 2016 (r303477) +++ head/sys/fs/autofs/autofs_vnops.c Fri Jul 29 12:15:55 2016 (r303478) @@ -138,11 +138,9 @@ autofs_trigger_vn(struct vnode *vp, cons struct vnode **newvp) { struct autofs_node *anp; - struct autofs_mount *amp; int error, lock_flags; anp = vp->v_data; - amp = VFSTOAUTOFS(vp->v_mount); /* * Release the vnode lock, so that other operations, in partcular ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303477 - head/sys/dev/usb
Author: trasz Date: Fri Jul 29 11:33:23 2016 New Revision: 303477 URL: https://svnweb.freebsd.org/changeset/base/303477 Log: Improve error message. MFC after:1 month Modified: head/sys/dev/usb/usb_device.c Modified: head/sys/dev/usb/usb_device.c == --- head/sys/dev/usb/usb_device.c Fri Jul 29 11:33:01 2016 (r303476) +++ head/sys/dev/usb/usb_device.c Fri Jul 29 11:33:23 2016 (r303477) @@ -1724,8 +1724,8 @@ usb_alloc_device(device_t parent_dev, st /* Setup USB descriptors */ err = (usb_temp_setup_by_index_p) (udev, usb_template); if (err) { - DPRINTFN(0, "setting up USB template failed maybe the USB " - "template module has not been loaded\n"); + DPRINTFN(0, "setting up USB template failed - " + "usb_template(4) not loaded?\n"); goto done; } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303476 - head/sys/dev/usb/template
Author: trasz Date: Fri Jul 29 11:33:01 2016 New Revision: 303476 URL: https://svnweb.freebsd.org/changeset/base/303476 Log: Fix MTP description in the comment. MFC after:1 month Modified: head/sys/dev/usb/template/usb_template_mtp.c Modified: head/sys/dev/usb/template/usb_template_mtp.c == --- head/sys/dev/usb/template/usb_template_mtp.cFri Jul 29 08:50:36 2016(r303475) +++ head/sys/dev/usb/template/usb_template_mtp.cFri Jul 29 11:33:01 2016(r303476) @@ -26,7 +26,7 @@ */ /* - * This file contains the USB templates for an USB Message Transfer + * This file contains the USB templates for an USB Media Transfer * Protocol device. * * NOTE: It is common practice that MTP devices use some dummy ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r303475 - in head/sys: arm64/conf conf dev/usb/controller
Author: andrew Date: Fri Jul 29 08:50:36 2016 New Revision: 303475 URL: https://svnweb.freebsd.org/changeset/base/303475 Log: Add a generic EHCI USB driver based on the Allwinner A10 driver. It is ACPI only for now, but wouldn't be too difficult to add support for FDT. Reviewed by: hselasky Obtained from:ABT Systems Ltd MFC after:1 month Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D7352 Added: head/sys/dev/usb/controller/generic_ehci.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm64/conf/GENERIC == --- head/sys/arm64/conf/GENERIC Fri Jul 29 06:22:11 2016(r303474) +++ head/sys/arm64/conf/GENERIC Fri Jul 29 08:50:36 2016(r303475) @@ -131,6 +131,7 @@ device pl011 optionsUSB_DEBUG # enable debug msgs device dwcotg # DWC OTG controller device ohci# OHCI PCI->USB interface +device ehci# EHCI PCI->USB interface (USB 2.0) device xhci# XHCI PCI->USB interface (USB 3.0) device usb # USB Bus (required) device ukbd# Keyboard Modified: head/sys/conf/files.arm64 == --- head/sys/conf/files.arm64 Fri Jul 29 06:22:11 2016(r303474) +++ head/sys/conf/files.arm64 Fri Jul 29 08:50:36 2016(r303475) @@ -69,6 +69,7 @@ dev/psci/psci_arm64.S optionalpsci dev/uart/uart_cpu_fdt.coptionaluart fdt dev/uart/uart_dev_pl011.c optionaluart pl011 dev/usb/controller/dwc_otg_hisi.c optional dwcotg fdt soc_hisi_hi6220 +dev/usb/controller/generic_ehci.c optional ehci acpi dev/usb/controller/generic_ohci.c optional ohci fdt dev/usb/controller/generic_usb_if.m optional ohci fdt dev/vnic/mrml_bridge.c optionalvnic fdt Added: head/sys/dev/usb/controller/generic_ehci.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/controller/generic_ehci.c Fri Jul 29 08:50:36 2016 (r303475) @@ -0,0 +1,220 @@ +/*- + * Copyright (c) 2012 Ganbold Tsagaankhuu+ * Copyright (c) 2016 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Andrew Turner under + * sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Generic EHCI driver based on the Allwinner A10 EHCI driver + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_bus.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +static device_attach_t generic_ehci_attach; +static device_detach_t generic_ehci_detach; + +static int +generic_ehci_probe(device_t self) +{ + ACPI_HANDLE h; + + if ((h = acpi_get_handle(self)) == NULL || + !acpi_MatchHid(h, "PNP0D20")) + return (ENXIO); + + device_set_desc(self, "Generic EHCI Controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +generic_ehci_attach(device_t self) +{ + ehci_softc_t *sc = device_get_softc(self); + int err; + int rid; + + /* initialise some bus fields */ + sc->sc_bus.parent = self; +
svn commit: r303474 - head/sys/dev/hyperv/storvsc
Author: sephe Date: Fri Jul 29 06:22:11 2016 New Revision: 303474 URL: https://svnweb.freebsd.org/changeset/base/303474 Log: hyperv/storvsc: Use busdma(9) and enable PIM_UNMAPPED by default. The UNMAPPED I/O greatly improves userland direct disk I/O performance by 35% ~ 135%. Submitted by: Hongjiang Zhang MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D7195 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Jul 29 06:10:27 2016(r303473) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Jul 29 06:22:11 2016(r303474) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -87,7 +88,10 @@ __FBSDID("$FreeBSD$"); #define VSTOR_PKT_SIZE (sizeof(struct vstor_packet) - vmscsi_size_delta) -#define HV_ALIGN(x, a) roundup2(x, a) +#define STORVSC_DATA_SEGCNT_MAXVMBUS_CHAN_PRPLIST_MAX +#define STORVSC_DATA_SEGSZ_MAX PAGE_SIZE +#define STORVSC_DATA_SIZE_MAX \ + (STORVSC_DATA_SEGCNT_MAX * STORVSC_DATA_SEGSZ_MAX) struct storvsc_softc; @@ -102,7 +106,7 @@ struct hv_sgl_page_pool{ boolean_tis_init; } g_hv_sgl_page_pool; -#define STORVSC_MAX_SG_PAGE_CNT STORVSC_MAX_IO_REQUESTS * VMBUS_CHAN_PRPLIST_MAX +#define STORVSC_MAX_SG_PAGE_CNT STORVSC_MAX_IO_REQUESTS * STORVSC_DATA_SEGCNT_MAX enum storvsc_request_type { WRITE_TYPE, @@ -110,26 +114,41 @@ enum storvsc_request_type { UNKNOWN_TYPE }; -struct hvs_gpa_range { +SYSCTL_NODE(_hw, OID_AUTO, storvsc, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, +"Hyper-V storage interface"); + +static u_int hv_storvsc_use_pim_unmapped = 1; +SYSCTL_INT(_hw_storvsc, OID_AUTO, use_pim_unmapped, CTLFLAG_RDTUN, +_storvsc_use_pim_unmapped, 0, +"Optimize storvsc by using unmapped I/O"); + +struct hv_storvsc_sysctl { + u_long data_bio_cnt; + u_long data_vaddr_cnt; + u_long data_sg_cnt; +}; + +struct storvsc_gpa_range { struct vmbus_gpa_range gpa_range; - uint64_tgpa_page[VMBUS_CHAN_PRPLIST_MAX]; + uint64_tgpa_page[STORVSC_DATA_SEGCNT_MAX]; } __packed; struct hv_storvsc_request { - LIST_ENTRY(hv_storvsc_request) link; - struct vstor_packet vstor_packet; - int prp_cnt; - struct hvs_gpa_range prp_list; - void *sense_data; - uint8_t sense_info_len; - uint8_t retries; - union ccb *ccb; - struct storvsc_softc *softc; - struct callout callout; - struct sema synch_sema; /*Synchronize the request/response if needed */ - struct sglist *bounce_sgl; - unsigned int bounce_sgl_count; - uint64_t not_aligned_seg_bits; + LIST_ENTRY(hv_storvsc_request) link; + struct vstor_packet vstor_packet; + int prp_cnt; + struct storvsc_gpa_rangeprp_list; + void*sense_data; + uint8_t sense_info_len; + uint8_t retries; + union ccb *ccb; + struct storvsc_softc*softc; + struct callout callout; + struct sema synch_sema; /*Synchronize the request/response if needed */ + struct sglist *bounce_sgl; + unsigned intbounce_sgl_count; + uint64_tnot_aligned_seg_bits; + bus_dmamap_tdata_dmap; }; struct storvsc_softc { @@ -148,6 +167,8 @@ struct storvsc_softc { struct hv_storvsc_request hs_init_req; struct hv_storvsc_request hs_reset_req; device_ths_dev; + bus_dma_tag_t storvsc_req_dtag; + struct hv_storvsc_sysctlsysctl_data; struct vmbus_channel*hs_cpu2chan[MAXCPU]; }; @@ -882,6 +903,77 @@ storvsc_create_cpu2chan(struct storvsc_s } } +static int +storvsc_init_requests(device_t dev) +{ + struct storvsc_softc *sc = device_get_softc(dev); + struct hv_storvsc_request *reqp; + int error, i; + + LIST_INIT(>hs_free_list); + + error = bus_dma_tag_create( + bus_get_dma_tag(dev), /* parent */ + 1, /* alignment */ + PAGE_SIZE, /* boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ +
svn commit: r303473 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Fri Jul 29 06:10:27 2016 New Revision: 303473 URL: https://svnweb.freebsd.org/changeset/base/303473 Log: hyperv/vmbus: Revoke unnecessary exposure of vmbus softc MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D7348 Modified: head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/vmbus.c == --- head/sys/dev/hyperv/vmbus/vmbus.c Fri Jul 29 05:58:24 2016 (r303472) +++ head/sys/dev/hyperv/vmbus/vmbus.c Fri Jul 29 06:10:27 2016 (r303473) @@ -125,7 +125,7 @@ static void vmbus_msghc_free(struct vm static struct vmbus_msghc *vmbus_msghc_get1(struct vmbus_msghc_ctx *, uint32_t); -struct vmbus_softc *vmbus_sc; +static struct vmbus_softc *vmbus_sc; extern inthand_t IDTVEC(vmbus_isr); @@ -176,6 +176,12 @@ DRIVER_MODULE(vmbus, acpi, vmbus_driver, MODULE_DEPEND(vmbus, acpi, 1, 1, 1); MODULE_VERSION(vmbus, 1); +static __inline struct vmbus_softc * +vmbus_get_softc(void) +{ + return vmbus_sc; +} + static struct vmbus_msghc * vmbus_msghc_alloc(bus_dma_tag_t parent_dtag) { Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h == --- head/sys/dev/hyperv/vmbus/vmbus_var.h Fri Jul 29 05:58:24 2016 (r303472) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Fri Jul 29 06:10:27 2016 (r303473) @@ -120,20 +120,6 @@ struct vmbus_softc { #define VMBUS_FLAG_ATTACHED0x0001 /* vmbus was attached */ #define VMBUS_FLAG_SYNIC 0x0002 /* SynIC was setup */ -extern struct vmbus_softc *vmbus_sc; - -static __inline struct vmbus_softc * -vmbus_get_softc(void) -{ - return vmbus_sc; -} - -static __inline device_t -vmbus_get_device(void) -{ - return vmbus_sc->vmbus_dev; -} - #define VMBUS_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field #define VMBUS_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"