CVS commit: src/usr.sbin/npf/npftest
Module Name:src Committed By: knakahara Date: Mon Apr 25 02:01:32 UTC 2016 Modified Files: src/usr.sbin/npf/npftest: Makefile Log Message: fix ATF net/npf/t_npf failure To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/npf/npftest/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/npf/npftest/Makefile diff -u src/usr.sbin/npf/npftest/Makefile:1.7 src/usr.sbin/npf/npftest/Makefile:1.8 --- src/usr.sbin/npf/npftest/Makefile:1.7 Sat Nov 16 17:12:35 2013 +++ src/usr.sbin/npf/npftest/Makefile Mon Apr 25 02:01:32 2016 @@ -16,7 +16,7 @@ LIBNPFTEST!= cd ${.CURDIR}/libnpftest && DPADD+= ${LIBNPFTEST}/libnpftest.a LDADD+= -L${LIBNPFTEST} -lnpftest -LDADD+= -lrump -lrumpvfs -lrumpnet -lrumpnet_net +LDADD+= -lrump -lrumpvfs -lrumpuser -lrumpnet -lrumpnet_net LDADD+= -lrumpdev_bpf .include
CVS commit: src
Module Name:src Committed By: dholland Date: Sun Apr 24 19:48:30 UTC 2016 Modified Files: src/distrib/sets/lists/comp: mi src/include: semaphore.h src/sys/kern: uipc_sem.c src/sys/sys: Makefile Added Files: src/sys/sys: semaphore.h Log Message: Define SEM_VALUE_MAX in only one place. Adding a whole extra header file just for this is not the optimal solution... but stuffing it in with anything else exposes things that otherwise wouldn't be. Nothing in userland should use directly, and if some foolish third-party software should decide to do so anyway in spite of the instructions to the contrary I will ruthlessly break it later when the big kernel includes cleanup finally happens. Reported by Kamil Rytarowski, and, as it turns out, also by Klaus Heinz in 2008. To generate a diff of this commit: cvs rdiff -u -r1.2031 -r1.2032 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.4 -r1.5 src/include/semaphore.h cvs rdiff -u -r1.44 -r1.45 src/sys/kern/uipc_sem.c cvs rdiff -u -r1.158 -r1.159 src/sys/sys/Makefile cvs rdiff -u -r0 -r1.1 src/sys/sys/semaphore.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.2031 src/distrib/sets/lists/comp/mi:1.2032 --- src/distrib/sets/lists/comp/mi:1.2031 Sat Apr 23 23:28:13 2016 +++ src/distrib/sets/lists/comp/mi Sun Apr 24 19:48:30 2016 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2031 2016/04/23 23:28:13 christos Exp $ +# $NetBSD: mi,v 1.2032 2016/04/24 19:48:30 dholland Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.compcomp-sys-root @@ -2918,6 +2918,7 @@ ./usr/include/sys/select.h comp-c-include ./usr/include/sys/selinfo.h comp-c-include ./usr/include/sys/sem.hcomp-c-include +./usr/include/sys/semaphore.h comp-c-include ./usr/include/sys/sha1.h comp-c-include ./usr/include/sys/sha2.h comp-c-include ./usr/include/sys/shm.hcomp-c-include Index: src/include/semaphore.h diff -u src/include/semaphore.h:1.4 src/include/semaphore.h:1.5 --- src/include/semaphore.h:1.4 Thu Mar 8 21:59:28 2012 +++ src/include/semaphore.h Sun Apr 24 19:48:29 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: semaphore.h,v 1.4 2012/03/08 21:59:28 joerg Exp $ */ +/* $NetBSD: semaphore.h,v 1.5 2016/04/24 19:48:29 dholland Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -38,8 +38,8 @@ struct _sem_st; typedef struct _sem_st *sem_t; #define SEM_FAILED ((sem_t *)0) -#define SEM_VALUE_MAX (~0U) +#include /* some kernel-only bits */ #include __BEGIN_DECLS Index: src/sys/kern/uipc_sem.c diff -u src/sys/kern/uipc_sem.c:1.44 src/sys/kern/uipc_sem.c:1.45 --- src/sys/kern/uipc_sem.c:1.44 Mon Nov 9 01:55:03 2015 +++ src/sys/kern/uipc_sem.c Sun Apr 24 19:48:29 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_sem.c,v 1.44 2015/11/09 01:55:03 pgoyette Exp $ */ +/* $NetBSD: uipc_sem.c,v 1.45 2016/04/24 19:48:29 dholland Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.44 2015/11/09 01:55:03 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.45 2016/04/24 19:48:29 dholland Exp $"); #include #include @@ -77,6 +77,7 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v #include #include #include +#include #include #include #include @@ -85,7 +86,6 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v MODULE(MODULE_CLASS_MISC, ksem, NULL); #define SEM_MAX_NAMELEN 14 -#define SEM_VALUE_MAX (~0U) #define KS_UNLINKED 0x01 Index: src/sys/sys/Makefile diff -u src/sys/sys/Makefile:1.158 src/sys/sys/Makefile:1.159 --- src/sys/sys/Makefile:1.158 Sat Apr 2 20:38:40 2016 +++ src/sys/sys/Makefile Sun Apr 24 19:48:29 2016 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.158 2016/04/02 20:38:40 christos Exp $ +# $NetBSD: Makefile,v 1.159 2016/04/24 19:48:29 dholland Exp $ .include @@ -34,8 +34,8 @@ INCS= acct.h agpio.h aio.h ansi.h aout_m queue.h quota.h quotactl.h \ ras.h rbtree.h reboot.h radioio.h resource.h resourcevar.h rmd160.h \ rnd.h rndio.h rwlock.h \ - scanio.h sched.h scsiio.h sdt.h select.h selinfo.h sem.h sha1.h \ - sha2.h shm.h siginfo.h signal.h signalvar.h sigtypes.h \ + scanio.h sched.h scsiio.h sdt.h select.h selinfo.h sem.h semaphore.h \ + sha1.h sha2.h shm.h siginfo.h signal.h signalvar.h sigtypes.h \ sleepq.h socket.h \ socketvar.h sockio.h spawn.h specificdata.h stat.h \ statvfs.h syscall.h syscallargs.h sysctl.h stdarg.h stdbool.h \ Added files: Index: src/sys/sys/semaphore.h diff -u /dev/null src/sys/sys/semaphore.h:1.1 --- /dev/null Sun Apr 24 19:48:30 2016 +++ src/sys/sys/semaphore.h Sun Apr 24 19:48:29 2016 @@ -0,0 +1,44 @@ +/* $NetBSD: semaphore.h,v 1.1 2016/04/24 19:48:29 dholland Exp $ */ + +/*- + * Copyright (c) 2003 The NetBSD Foundation, Inc. + * All rights reserved. + * + *
CVS commit: xsrc/external/mit/ctwm/dist
Module Name:xsrc Committed By: christos Date: Sun Apr 24 18:27:03 UTC 2016 Modified Files: xsrc/external/mit/ctwm/dist: session.c Log Message: CID 1358680: Set umask before mkstemp To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/ctwm/dist/session.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/ctwm/dist/session.c diff -u xsrc/external/mit/ctwm/dist/session.c:1.2 xsrc/external/mit/ctwm/dist/session.c:1.3 --- xsrc/external/mit/ctwm/dist/session.c:1.2 Wed Apr 13 18:25:57 2016 +++ xsrc/external/mit/ctwm/dist/session.c Sun Apr 24 14:27:03 2016 @@ -859,7 +859,12 @@ static FILE *unique_file (char **filenam fd = open(template, O_RDWR | O_CREAT | O_EXCL, 0600); } while ((fd == -1) && (errno == EEXIST || errno == EINTR)); #else -if ((fd = mkstemp(tmp)) == -1) +{ + int omask = umask(077); + fd = mkstemp(tmp); + umask(omask); +} +if (fd == -1) return NULL; #endif if ((fp = fdopen(fd, "wb")) == NULL)
CVS commit: src/libexec/httpd
Module Name:src Committed By: christos Date: Sun Apr 24 18:24:47 UTC 2016 Modified Files: src/libexec/httpd: cgi-bozo.c Log Message: CID 1358679: Fix memory leak. XXX: pullup 7 To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/libexec/httpd/cgi-bozo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/httpd/cgi-bozo.c diff -u src/libexec/httpd/cgi-bozo.c:1.34 src/libexec/httpd/cgi-bozo.c:1.35 --- src/libexec/httpd/cgi-bozo.c:1.34 Fri Apr 15 16:00:13 2016 +++ src/libexec/httpd/cgi-bozo.c Sun Apr 24 14:24:47 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cgi-bozo.c,v 1.34 2016/04/15 20:00:13 mrg Exp $ */ +/* $NetBSD: cgi-bozo.c,v 1.35 2016/04/24 18:24:47 christos Exp $ */ /* $eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $ */ @@ -333,12 +333,12 @@ parse_search_string(bozo_httpreq_t *requ parse_err: - free (*args); free (str); - *args = NULL; + free (*args); + free(args); *args_len = 0; - return 0; + return NULL; }
CVS commit: xsrc/external/mit/xrdb/dist
Module Name:xsrc Committed By: christos Date: Sun Apr 24 18:22:49 UTC 2016 Modified Files: xsrc/external/mit/xrdb/dist: xrdb.c Log Message: CID 1358678: Don't pass -1 to fdopen(3) To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 xsrc/external/mit/xrdb/dist/xrdb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/xrdb/dist/xrdb.c diff -u xsrc/external/mit/xrdb/dist/xrdb.c:1.7 xsrc/external/mit/xrdb/dist/xrdb.c:1.8 --- xsrc/external/mit/xrdb/dist/xrdb.c:1.7 Mon Mar 17 06:03:20 2014 +++ xsrc/external/mit/xrdb/dist/xrdb.c Sun Apr 24 14:22:49 2016 @@ -1225,7 +1225,7 @@ Process(int scrno, Bool doScreen, Bool e #else { int fd = mkstemp(template); - output = fdopen(fd, "w"); + output = fd != -1 ? fdopen(fd, "w") : NULL; } #endif if (!output)
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: christos Date: Sun Apr 24 18:20:40 UTC 2016 Modified Files: src/external/bsd/dhcpcd/dist: eloop.c Log Message: CID 1358677: (Negative returns) tuck in poll_fd assignment in eloop_open() To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/external/bsd/dhcpcd/dist/eloop.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/dhcpcd/dist/eloop.c diff -u src/external/bsd/dhcpcd/dist/eloop.c:1.12 src/external/bsd/dhcpcd/dist/eloop.c:1.13 --- src/external/bsd/dhcpcd/dist/eloop.c:1.12 Sun Apr 10 17:00:53 2016 +++ src/external/bsd/dhcpcd/dist/eloop.c Sun Apr 24 14:20:40 2016 @@ -1,5 +1,5 @@ #include - __RCSID("$NetBSD: eloop.c,v 1.12 2016/04/10 21:00:53 roy Exp $"); + __RCSID("$NetBSD: eloop.c,v 1.13 2016/04/24 18:20:40 christos Exp $"); /* * eloop - portable event based main loop. @@ -620,6 +620,8 @@ eloop_open(struct eloop *eloop) return eloop->poll_fd; #elif defined (HAVE_EPOLL) return (eloop->poll_fd = epoll_create1(EPOLL_CLOEXEC)); +#else + return eloop->poll_fd = -1; #endif } #endif @@ -790,7 +792,6 @@ eloop_new(void) TAILQ_INIT(>free_timeouts); eloop->exitcode = EXIT_FAILURE; #if defined(HAVE_KQUEUE) || defined(HAVE_EPOLL) - eloop->poll_fd = -1; if (eloop_open(eloop) == -1) { eloop_free(eloop); return NULL;
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: christos Date: Sun Apr 24 18:16:05 UTC 2016 Modified Files: src/external/bsd/dhcpcd/dist: dhcp-common.c Log Message: CID 1358676: Forward NULL. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/dhcp-common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/dhcpcd/dist/dhcp-common.c diff -u src/external/bsd/dhcpcd/dist/dhcp-common.c:1.14 src/external/bsd/dhcpcd/dist/dhcp-common.c:1.15 --- src/external/bsd/dhcpcd/dist/dhcp-common.c:1.14 Wed Apr 20 04:53:01 2016 +++ src/external/bsd/dhcpcd/dist/dhcp-common.c Sun Apr 24 14:16:05 2016 @@ -1,5 +1,5 @@ #include - __RCSID("$NetBSD: dhcp-common.c,v 1.14 2016/04/20 08:53:01 roy Exp $"); + __RCSID("$NetBSD: dhcp-common.c,v 1.15 2016/04/24 18:16:05 christos Exp $"); /* * dhcpcd - DHCP client daemon @@ -210,7 +210,7 @@ make_option_mask(const struct dhcp_opt * continue; match = 0; for (i = 0, opt = odopts; i < odopts_len; i++, opt++) { - if (opt->var == NULL && opt->option == 0) + if (opt->var == NULL) continue; /* buggy dhcpcd-definitions.conf */ if (strcmp(opt->var, token) == 0) match = 1;
CVS commit: src/usr.sbin/makemandb
Module Name:src Committed By: christos Date: Sun Apr 24 18:11:43 UTC 2016 Modified Files: src/usr.sbin/makemandb: apropos-utils.c Log Message: CID 1358675: Wrong variable test To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/makemandb/apropos-utils.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/makemandb/apropos-utils.c diff -u src/usr.sbin/makemandb/apropos-utils.c:1.24 src/usr.sbin/makemandb/apropos-utils.c:1.25 --- src/usr.sbin/makemandb/apropos-utils.c:1.24 Wed Apr 13 07:48:29 2016 +++ src/usr.sbin/makemandb/apropos-utils.c Sun Apr 24 14:11:43 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: apropos-utils.c,v 1.24 2016/04/13 11:48:29 christos Exp $ */ +/* $NetBSD: apropos-utils.c,v 1.25 2016/04/24 18:11:43 christos Exp $ */ /*- * Copyright (c) 2011 Abhinav Upadhyay* All rights reserved. @@ -31,7 +31,7 @@ */ #include -__RCSID("$NetBSD: apropos-utils.c,v 1.24 2016/04/13 11:48:29 christos Exp $"); +__RCSID("$NetBSD: apropos-utils.c,v 1.25 2016/04/24 18:11:43 christos Exp $"); #include #include @@ -336,7 +336,7 @@ init_db(mandb_access_mode db_flag, const * to read/write the files */ int access_mode = R_OK; - switch (access_mode) { + switch (db_flag) { case MANDB_CREATE: case MANDB_WRITE: access_mode |= W_OK;
CVS commit: src/sys/net
Module Name:src Committed By: christos Date: Sun Apr 24 18:08:40 UTC 2016 Modified Files: src/sys/net: if_bridge.c Log Message: CID 1358673: dead code To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/net/if_bridge.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_bridge.c diff -u src/sys/net/if_bridge.c:1.118 src/sys/net/if_bridge.c:1.119 --- src/sys/net/if_bridge.c:1.118 Thu Apr 21 20:25:42 2016 +++ src/sys/net/if_bridge.c Sun Apr 24 14:08:40 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_bridge.c,v 1.118 2016/04/22 00:25:42 roy Exp $ */ +/* $NetBSD: if_bridge.c,v 1.119 2016/04/24 18:08:40 christos Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -80,7 +80,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.118 2016/04/22 00:25:42 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.119 2016/04/24 18:08:40 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_bridge_ipf.h" @@ -1784,8 +1784,6 @@ bridge_input(struct ifnet *ifp, struct m if (bridge_ourether(_bif, eh, 0)) { bridge_acquire_member(sc, _bif, &_psref); BRIDGE_PSZ_REXIT(s); -if (_bif == NULL) - goto out; if (_bif->bif_flags & IFBIF_LEARNING) (void) bridge_rtupdate(sc, eh->ether_shost, ifp, 0, IFBAF_DYNAMIC);
CVS commit: src/sys/net
Module Name:src Committed By: christos Date: Sun Apr 24 17:56:31 UTC 2016 Modified Files: src/sys/net: if_spppsubr.c Log Message: CID 1210544: Tainted scalar To generate a diff of this commit: cvs rdiff -u -r1.139 -r1.140 src/sys/net/if_spppsubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_spppsubr.c diff -u src/sys/net/if_spppsubr.c:1.139 src/sys/net/if_spppsubr.c:1.140 --- src/sys/net/if_spppsubr.c:1.139 Sun Apr 24 13:32:06 2016 +++ src/sys/net/if_spppsubr.c Sun Apr 24 13:56:31 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.139 2016/04/24 17:32:06 christos Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.140 2016/04/24 17:56:31 christos Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.139 2016/04/24 17:32:06 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.140 2016/04/24 17:56:31 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -1259,7 +1259,7 @@ sppp_cp_send(struct sppp *sp, u_short pr lh->ident = ident; lh->len = htons(LCP_HEADER_LEN + len); if (len) - bcopy (data, lh + 1, len); + memcpy(lh + 1, data, len); if (debug) { log(LOG_DEBUG, "%s: %s output <%s id=0x%x len=%d", @@ -2067,14 +2067,14 @@ static int sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) { STDDCL; - u_char *buf, *r, *p; + u_char *buf, *r, *p, l, blen; int origlen, rlen; uint32_t nmagic; u_short authproto; len -= 4; origlen = len; - buf = r = malloc (len, M_TEMP, M_NOWAIT); + buf = r = malloc (blen = len, M_TEMP, M_NOWAIT); if (! buf) return (0); @@ -2084,16 +2084,16 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp /* pass 1: check for things that need to be rejected */ p = (void *)(h + 1); - for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) { + for (rlen = 0; len > 1 && (l = p[1]) != 0; len -= l, p += l) { /* Sanity check option length */ - if (p[1] > len) { + if (l > len) { /* * Malicious option - drop immediately. * XXX Maybe we should just RXJ it? */ addlog("%s: received malicious LCP option 0x%02x, " "length 0x%02x, (len: 0x%02x) dropping.\n", ifp->if_xname, - p[0], p[1], len); + p[0], l, len); goto drop; } if (debug) @@ -2104,14 +2104,14 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp /* fall through, both are same length */ case LCP_OPT_ASYNC_MAP: /* Async control character map. */ - if (len >= 6 || p[1] == 6) + if (len >= 6 || l == 6) continue; if (debug) addlog(" [invalid]"); break; case LCP_OPT_MRU: /* Maximum receive unit. */ - if (len >= 4 && p[1] == 4) + if (len >= 4 && l == 4) continue; if (debug) addlog(" [invalid]"); @@ -2123,7 +2123,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp break; } authproto = (p[2] << 8) + p[3]; - if (authproto == PPP_CHAP && p[1] != 5) { + if (authproto == PPP_CHAP && l != 5) { if (debug) addlog(" [invalid chap len]"); break; @@ -2147,10 +2147,15 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp addlog(" [rej]"); break; } + if (rlen + l > blen) { + if (debug) +addlog(" [overflow]"); + continue; + } /* Add the option to rejected list. */ - bcopy (p, r, p[1]); - r += p[1]; - rlen += p[1]; + memcpy(r, p, l); + r += l; + rlen += l; } if (rlen) { if (debug) @@ -2170,7 +2175,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp p = (void *)(h + 1); len = origlen; - for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) { + for (rlen = 0; len > 1 && (l = p[1]) != 0; len -= l, p += l) { if (debug) addlog(" %s", sppp_lcp_opt_name(*p)); switch (*p) { @@ -2260,10 +2265,15 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp } continue; } + if (rlen + l > blen) { + if (debug) +addlog(" [overflow]"); + continue; + } /* Add the option to nak'ed list. */ - bcopy (p, r, p[1]); - r += p[1]; - rlen += p[1]; + memcpy(r, p, l); + r += l; + rlen += l; } if (rlen) { if (++sp->fail_counter[IDX_LCP] >= sp->lcp.max_failure) { @@ -2303,7 +2313,7 @@ static void sppp_lcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) { STDDCL; - u_char *buf, *p; + u_char *buf, *p, l; len -= 4; buf = malloc (len, M_TEMP, M_NOWAIT); @@ -2315,9 +2325,9 @@ sppp_lcp_RCN_rej(struct sppp *sp, struct ifp->if_xname); p = (void *)(h + 1); - for (; len > 1 && p[1]; len -= p[1], p += p[1]) { + for (; len > 1 && (l = p[1]) != 0; len -= l, p += l) { /* Sanity check option length */ - if (p[1] > len) { + if (l > len) { /* * Malicious option - drop immediately. * XXX Maybe we should just RXJ it? @@ -2384,11 +2394,11 @@ static void sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) { STDDCL; - u_char *buf, *p; + u_char *buf, *p, l, blen; uint32_t magic; len -= 4; - buf
CVS commit: xsrc/external/mit/xman/dist
Module Name:xsrc Committed By: christos Date: Sun Apr 24 17:37:02 UTC 2016 Modified Files: xsrc/external/mit/xman/dist: search.c Log Message: CID 987986: Set umask before mkstemp To generate a diff of this commit: cvs rdiff -u -r1.1.1.3 -r1.2 xsrc/external/mit/xman/dist/search.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/xman/dist/search.c diff -u xsrc/external/mit/xman/dist/search.c:1.1.1.3 xsrc/external/mit/xman/dist/search.c:1.2 --- xsrc/external/mit/xman/dist/search.c:1.1.1.3 Sun Jul 19 19:00:54 2015 +++ xsrc/external/mit/xman/dist/search.c Sun Apr 24 13:37:02 2016 @@ -153,7 +153,7 @@ DoSearch(ManpageGlobals * man_globals, i char string_buf[BUFSIZ], cmp_str[BUFSIZ], error_buf[BUFSIZ]; char *search_string = SearchString(man_globals); FILE *file; -int fd; +int fd, omask; int count; Boolean flag; @@ -180,7 +180,9 @@ DoSearch(ManpageGlobals * man_globals, i char label[BUFSIZ]; strcpy(tmp, MANTEMP); /* get a temp file. */ + omask = umask(077); fd = mkstemp(tmp); + umask(omask); if (fd < 0) { PopupWarning(man_globals, "Cant create temp file"); return NULL;
CVS commit: xsrc/external/mit/xman/dist
Module Name:xsrc Committed By: christos Date: Sun Apr 24 17:36:11 UTC 2016 Modified Files: xsrc/external/mit/xman/dist: misc.c Log Message: CID 987984: set umask before mkstemp To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 xsrc/external/mit/xman/dist/misc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/xman/dist/misc.c diff -u xsrc/external/mit/xman/dist/misc.c:1.7 xsrc/external/mit/xman/dist/misc.c:1.8 --- xsrc/external/mit/xman/dist/misc.c:1.7 Sun Jul 19 19:04:04 2015 +++ xsrc/external/mit/xman/dist/misc.c Sun Apr 24 13:36:11 2016 @@ -374,7 +374,7 @@ UncompressNamed(ManpageGlobals * man_glo { char tmp[BUFSIZ], cmdbuf[BUFSIZ], error_buf[BUFSIZ]; struct stat junk; -int fd; +int fd, omask; if (stat(filename, ) != 0) { /* Check for existence of the file. */ if (errno != ENOENT) { @@ -392,7 +392,9 @@ UncompressNamed(ManpageGlobals * man_glo */ strcpy(tmp, MANTEMP); /* get a temp file. */ +omask = umask(077); fd = mkstemp(tmp); +umask(omask); if (fd < 0) { PopupWarning(man_globals, "Error creating a temp file"); return FALSE; @@ -450,7 +452,7 @@ SgmlToRoffNamed(ManpageGlobals * man_glo { char tmp[BUFSIZ], cmdbuf[BUFSIZ], error_buf[BUFSIZ]; struct stat junk; -int fd; +int fd, omask; if (stat(filename, ) != 0) { /* Check for existence of the file. */ if (errno != ENOENT) { @@ -463,7 +465,9 @@ SgmlToRoffNamed(ManpageGlobals * man_glo } strcpy(tmp, MANTEMP); /* get a temp file. */ +omask = umask(077): fd = mkstemp(tmp); +umask(omask); if (fd < 0) { PopupWarning(man_globals, "Error creating a temp file"); return FALSE; @@ -503,7 +507,7 @@ FILE * Format(ManpageGlobals * man_globals, const char *entry) { FILE *file = NULL; -int fd; +int fd, omask; Widget manpage = man_globals->manpagewidgets.manpage; char cmdbuf[BUFSIZ], tmp[BUFSIZ], filename[BUFSIZ], error_buf[BUFSIZ]; @@ -559,7 +563,9 @@ Format(ManpageGlobals * man_globals, con XFlush(XtDisplay(man_globals->standby)); strcpy(tmp, MANTEMP); /* Get a temp file. */ +omask = umask(077); fd = mkstemp(tmp); +umask(omask); if (fd >= 0) { file = fdopen(fd, "r"); if (file == NULL) {
CVS commit: src/sys/net
Module Name:src Committed By: christos Date: Sun Apr 24 17:32:06 UTC 2016 Modified Files: src/sys/net: if_spppsubr.c Log Message: CID 980345: missing breaks To generate a diff of this commit: cvs rdiff -u -r1.138 -r1.139 src/sys/net/if_spppsubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_spppsubr.c diff -u src/sys/net/if_spppsubr.c:1.138 src/sys/net/if_spppsubr.c:1.139 --- src/sys/net/if_spppsubr.c:1.138 Sun Apr 24 12:59:15 2016 +++ src/sys/net/if_spppsubr.c Sun Apr 24 13:32:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.138 2016/04/24 16:59:15 christos Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.139 2016/04/24 17:32:06 christos Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.138 2016/04/24 16:59:15 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.139 2016/04/24 17:32:06 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -5370,7 +5370,9 @@ sppp_cp_type_name(u_char type) static const char * sppp_auth_type_name(u_short proto, u_char type) { - static char buf[12]; + static char buf[32]; + const char *name; + switch (proto) { case PPP_CHAP: switch (type) { @@ -5378,17 +5380,25 @@ sppp_auth_type_name(u_short proto, u_cha case CHAP_RESPONSE: return "response"; case CHAP_SUCCESS: return "success"; case CHAP_FAILURE: return "failure"; + default: name = "chap"; break; } break; + case PPP_PAP: switch (type) { case PAP_REQ: return "req"; case PAP_ACK: return "ack"; case PAP_NAK: return "nak"; + default: name = "pap"; break; } break; + + default: + name = "bad"; + break; } - snprintf(buf, sizeof(buf), "0x%x", type); + + snprintf(buf, sizeof(buf), "%s(%#x) %#x", name, proto, type); return buf; }
CVS commit: src/sys/net
Module Name:src Committed By: christos Date: Sun Apr 24 16:59:15 UTC 2016 Modified Files: src/sys/net: if_pppoe.c if_spppsubr.c Log Message: CID 980057, 980058, use strlcpy() To generate a diff of this commit: cvs rdiff -u -r1.105 -r1.106 src/sys/net/if_pppoe.c cvs rdiff -u -r1.137 -r1.138 src/sys/net/if_spppsubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_pppoe.c diff -u src/sys/net/if_pppoe.c:1.105 src/sys/net/if_pppoe.c:1.106 --- src/sys/net/if_pppoe.c:1.105 Thu Apr 14 21:31:29 2016 +++ src/sys/net/if_pppoe.c Sun Apr 24 12:59:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_pppoe.c,v 1.105 2016/04/15 01:31:29 ozaki-r Exp $ */ +/* $NetBSD: if_pppoe.c,v 1.106 2016/04/24 16:59:15 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.105 2016/04/15 01:31:29 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.106 2016/04/24 16:59:15 christos Exp $"); #include "pppoe.h" @@ -485,10 +485,9 @@ pppoe_dispatch_disc_pkt(struct mbuf *m, n = m_pulldown(m, off + sizeof(*pt), len, ); if (n) { - strncpy(error, + strlcpy(error, mtod(n, char*) + noff, len); - error[len] = '\0'; } printf("%s: connected to %s\n", devname, error); @@ -560,9 +559,8 @@ pppoe_dispatch_disc_pkt(struct mbuf *m, n = m_pulldown(m, off + sizeof(*pt), len, ); if (n && error) { - strncpy(error, + strlcpy(error, mtod(n, char *) + noff, len); - error[len] = '\0'; } } if (error) { @@ -949,7 +947,8 @@ pppoe_ioctl(struct ifnet *ifp, unsigned struct pppoediscparms *parms = (struct pppoediscparms*)data; memset(parms, 0, sizeof *parms); if (sc->sc_eth_if) - strncpy(parms->ifname, sc->sc_eth_if->if_xname, IFNAMSIZ); + strlcpy(parms->ifname, sc->sc_eth_if->if_xname, + sizeof(parms->ifname)); return 0; } break; Index: src/sys/net/if_spppsubr.c diff -u src/sys/net/if_spppsubr.c:1.137 src/sys/net/if_spppsubr.c:1.138 --- src/sys/net/if_spppsubr.c:1.137 Sat Apr 23 08:15:38 2016 +++ src/sys/net/if_spppsubr.c Sun Apr 24 12:59:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.137 2016/04/23 12:15:38 martin Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.138 2016/04/24 16:59:15 christos Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.137 2016/04/23 12:15:38 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.138 2016/04/24 16:59:15 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -5070,7 +5070,7 @@ sppp_params(struct sppp *sp, u_long cmd, cfg->myauthflags = sp->myauth.flags; cfg->hisauthflags = sp->hisauth.flags; - strncpy(cfg->ifname, sp->pp_if.if_xname, IFNAMSIZ); + strlcpy(cfg->ifname, sp->pp_if.if_xname, sizeof(cfg->ifname)); cfg->hisauth = 0; if (sp->hisauth.proto) cfg->hisauth = (sp->hisauth.proto == PPP_PAP) ? SPPP_AUTHPROTO_PAP : SPPP_AUTHPROTO_CHAP;
CVS commit: src/share/man/man9
Module Name:src Committed By: wiz Date: Sun Apr 24 15:11:26 UTC 2016 Modified Files: src/share/man/man9: usbdi.9 Log Message: Remove trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/share/man/man9/usbdi.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/usbdi.9 diff -u src/share/man/man9/usbdi.9:1.31 src/share/man/man9/usbdi.9:1.32 --- src/share/man/man9/usbdi.9:1.31 Sun Apr 24 15:03:18 2016 +++ src/share/man/man9/usbdi.9 Sun Apr 24 15:11:26 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: usbdi.9,v 1.31 2016/04/24 15:03:18 skrll Exp $ +.\" $NetBSD: usbdi.9,v 1.32 2016/04/24 15:11:26 wiz Exp $ .\" .\" Copyright (c) 2012 Matthew R. Green .\" All rights reserved. @@ -272,10 +272,10 @@ through .Fn usbd_set_config_index "struct usbd_device *dev" "int index" "int msg" .Ft usbd_status .Fn usbd_bulk_transfer "struct usbd_xfer *xfer" "struct usbd_pipe *pipe" \ - "uint16_t flags" "uint32_t timeout" "void *buf" "uint32_t *size" + "uint16_t flags" "uint32_t timeout" "void *buf" "uint32_t *size" .Ft usbd_status .Fn usbd_intr_transfer "struct usbd_xfer *xfer" "struct usbd_pipe *pipe" \ - "uint16_t flags" "uint32_t timeout" "void *buf" "uint32_t *size" + "uint16_t flags" "uint32_t timeout" "void *buf" "uint32_t *size" .Ft void .Fn usb_detach_waitold "device_t dv" .Ft void
CVS commit: src/share/man/man9
Module Name:src Committed By: skrll Date: Sun Apr 24 15:03:18 UTC 2016 Modified Files: src/share/man/man9: usbdi.9 Log Message: Update after nick-nhusb merge To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/share/man/man9/usbdi.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/usbdi.9 diff -u src/share/man/man9/usbdi.9:1.30 src/share/man/man9/usbdi.9:1.31 --- src/share/man/man9/usbdi.9:1.30 Mon Jun 29 16:20:14 2015 +++ src/share/man/man9/usbdi.9 Sun Apr 24 15:03:18 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: usbdi.9,v 1.30 2015/06/29 16:20:14 skrll Exp $ +.\" $NetBSD: usbdi.9,v 1.31 2016/04/24 15:03:18 skrll Exp $ .\" .\" Copyright (c) 2012 Matthew R. Green .\" All rights reserved. @@ -27,11 +27,11 @@ .\" SUCH DAMAGE. .\" .\" -.\" Copyright (c) 1999 The NetBSD Foundation, Inc. +.\" Copyright (c) 1999, 2016 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation -.\" by Lennart Augustsson. +.\" by Lennart Augustsson and Nick Hudson. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -54,7 +54,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 29, 2015 +.Dd April 24, 2016 .Dt USBDI 9 .Os .Sh NAME @@ -66,144 +66,148 @@ .In dev/usb/usbdi_util.h .Ss Functions offered by usbdi.h .Ft usbd_status -.Fn usbd_open_pipe "usbd_interface_handle iface" "uint8_t address" \ - "uint8_t flags" "usbd_pipe_handle *pipe" +.Fn usbd_open_pipe "struct usbd_interface *iface" "uint8_t address" \ + "uint8_t flags" "struct usbd_pipe **pipe" .Ft usbd_status -.Fn usbd_close_pipe "usbd_pipe_handle pipe" +.Fn usbd_close_pipe "struct usbd_pipe *pipe" .Ft usbd_status -.Fn usbd_transfer "usbd_xfer_handle xfer" -.Ft usbd_xfer_handle -.Fn usbd_alloc_xfer "usbd_device_handle dev" -.Ft usbd_status -.Fn usbd_free_xfer "usbd_xfer_handle xfer" -.Ft void -.Fn usbd_setup_xfer "usbd_xfer_handle xfer" "usbd_pipe_handle pipe" \ - "usbd_private_handle priv" "void *buffer" "uint32_t length" \ +.Fn usbd_transfer "struct usbd_xfer *xfer" +.Ft struct usbd_xfer * +.Fn usbd_setup_xfer "struct usbd_xfer *xfer" \ + "void *priv" "void *buffer" "uint32_t length" \ "uint16_t flags" "uint32_t timeout" "usbd_callback" .Ft void -.Fn usbd_setup_default_xfer "usbd_xfer_handle xfer" \ - "usbd_device_handle dev" "usbd_private_handle priv" \ +.Fn usbd_setup_default_xfer "struct usbd_xfer *xfer" \ + "struct usbd_device *dev" "void *priv" \ "uint32_t timeout" "usb_device_request_t *req" " void *buffer" \ "uint32_t length" "uint16_t flags" "usbd_callback" .Ft void -.Fn usbd_setup_isoc_xfer "usbd_xfer_handle xfer" "usbd_pipe_handle pipe" \ - "usbd_private_handle priv" "uint16_t *frlengths" \ +.Fn usbd_setup_isoc_xfer "struct usbd_xfer *xfer" \ + "void *priv" "uint16_t *frlengths" \ "uint32_t nframes" "uint16_t flags" "usbd_callback" .Ft void -.Fn usbd_get_xfer_status "usbd_xfer_handle xfer" "usbd_private_handle *priv" \ +.Fn usbd_get_xfer_status "struct usbd_xfer *xfer" "void **priv" \ "void **buffer" "uint32_t *count" "usbd_status *status" .Ft usb_endpoint_descriptor_t * -.Fn usbd_interface2endpoint_descriptor "usbd_interface_handle iface" \ +.Fn usbd_interface2endpoint_descriptor "struct usbd_interface *iface" \ "uint8_t address" .Ft usbd_status -.Fn usbd_abort_pipe "usbd_pipe_handle pipe" +.Fn usbd_abort_pipe "struct usbd_pipe *pipe" .Ft usbd_status -.Fn usbd_abort_default_pipe "usbd_device_handle dev" +.Fn usbd_abort_default_pipe "struct usbd_device *dev" .Ft usbd_status -.Fn usbd_clear_endpoint_stall "usbd_pipe_handle pipe" +.Fn usbd_clear_endpoint_stall "struct usbd_pipe *pipe" .Ft usbd_status -.Fn usbd_clear_endpoint_stall_async "usbd_pipe_handle pipe" +.Fn usbd_clear_endpoint_stall_async "struct usbd_pipe *pipe" .Ft void -.Fn usbd_clear_endpoint_toggle "usbd_pipe_handle pipe" +.Fn usbd_clear_endpoint_toggle "struct usbd_pipe *pipe" .Ft usbd_status -.Fn usbd_endpoint_count "usbd_interface_handle dev" "uint8_t *count" +.Fn usbd_endpoint_count "struct usbd_interface *dev" "uint8_t *count" .Ft usbd_status -.Fn usbd_interface_count "usbd_device_handle dev" "uint8_t *count" +.Fn usbd_interface_count "struct usbd_device *dev" "uint8_t *count" .Ft usbd_status -.Fn usbd_interface2device_handle "usbd_interface_handle iface" "usbd_device_handle *dev" +.Fn usbd_interface2device_handle "struct usbd_interface *iface" "struct usbd_device **dev" .Ft usbd_status -.Fn usbd_device2interface_handle "usbd_device_handle dev" "uint8_t ifaceno" "usbd_interface_handle *iface" +.Fn usbd_device2interface_handle "struct usbd_device *dev" "uint8_t ifaceno" "struct usbd_interface **iface" .Pp -.Ft usbd_device_handle -.Fn usbd_pipe2device_handle
CVS commit: src/lib/libpthread
Module Name:src Committed By: wiz Date: Sun Apr 24 09:01:45 UTC 2016 Modified Files: src/lib/libpthread: pthread_getcpuclockid.3 Log Message: Formatting, typos, whitespace fixes. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libpthread/pthread_getcpuclockid.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libpthread/pthread_getcpuclockid.3 diff -u src/lib/libpthread/pthread_getcpuclockid.3:1.2 src/lib/libpthread/pthread_getcpuclockid.3:1.3 --- src/lib/libpthread/pthread_getcpuclockid.3:1.2 Sun Apr 24 00:05:28 2016 +++ src/lib/libpthread/pthread_getcpuclockid.3 Sun Apr 24 09:01:45 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: pthread_getcpuclockid.3,v 1.2 2016/04/24 00:05:28 christos Exp $ +.\" $NetBSD: pthread_getcpuclockid.3,v 1.3 2016/04/24 09:01:45 wiz Exp $ .\" .\" Copyright (c) 2016 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -28,11 +28,11 @@ .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd April 23, 2016 -.Dt pthread_getcpuclockid 3 +.Dt PTHREAD_GETCPUCLOCKID 3 .Os .Sh NAME .Nm pthread_getcpuclockid -.Nd retrieve the clockid of the give thread +.Nd retrieve the clockid of the given thread .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -47,7 +47,7 @@ function retrieves the for the specified .Fa thread . .Pp -The +The .Xr clock_gettime 2 function can be used with the returned .Fa clock_id @@ -56,7 +56,7 @@ to retrieve LWP times. On success the .Fn pthread_getcpuclockid function returns 0, placing the requested -.Fa clock_id +.Fa clock_id in the argument. On error, the value \-1 is returned and the value of @@ -70,7 +70,7 @@ No thread with this id was found. .El .Sh SEE ALSO .Xr clock_getcpuclockid2 2 , -.Xr clock_gettime 2 , +.Xr clock_gettime 2 .Sh STANDARDS The .Fn pthread_getcpuclockid
CVS commit: src/lib/libc/sys
Module Name:src Committed By: wiz Date: Sun Apr 24 08:59:30 UTC 2016 Modified Files: src/lib/libc/sys: clock_getcpuclockid2.2 Log Message: Fix typos, whitespace, formatting. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libc/sys/clock_getcpuclockid2.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/sys/clock_getcpuclockid2.2 diff -u src/lib/libc/sys/clock_getcpuclockid2.2:1.1 src/lib/libc/sys/clock_getcpuclockid2.2:1.2 --- src/lib/libc/sys/clock_getcpuclockid2.2:1.1 Sat Apr 23 23:11:31 2016 +++ src/lib/libc/sys/clock_getcpuclockid2.2 Sun Apr 24 08:59:30 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: clock_getcpuclockid2.2,v 1.1 2016/04/23 23:11:31 christos Exp $ +.\" $NetBSD: clock_getcpuclockid2.2,v 1.2 2016/04/24 08:59:30 wiz Exp $ .\" .\" Copyright (c) 2016 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -28,11 +28,11 @@ .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd April 23, 2016 -.Dt clock_getcpuclockid2 2 +.Dt CLOCK_GETCPUCLOCKID2 2 .Os .Sh NAME .Nm clock_getcpuclockid2 -.Nd retrieve the clock id of a process or lwp +.Nd retrieve the clock id of a process or LWP .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -49,7 +49,7 @@ function retrieves the for the specified .Fa id and -.Fa idtype. +.Fa idtype . Supported .Fa idtypes are: @@ -86,7 +86,7 @@ The and .Fn clock_getcpuclockid2 functions succeed and return 0, placing the requested -.Fa clock_id +.Fa clock_id in the argument. On error, the value \-1 is returned and the value of @@ -96,7 +96,7 @@ is set to reflect what went wrong. These functions fail if: .Bl -tag -width Er .It Bq Er EINVAL -An unsuppored +An unsupported .Fa idtype was supplied. .El
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: martin Date: Sun Apr 24 07:45:10 UTC 2016 Modified Files: src/sys/rump/librump/rumpkern: lwproc.c Log Message: Add lwp_find() - verbatim copy from the hard kernel. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/rump/librump/rumpkern/lwproc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/lwproc.c diff -u src/sys/rump/librump/rumpkern/lwproc.c:1.39 src/sys/rump/librump/rumpkern/lwproc.c:1.40 --- src/sys/rump/librump/rumpkern/lwproc.c:1.39 Mon Apr 4 20:47:57 2016 +++ src/sys/rump/librump/rumpkern/lwproc.c Sun Apr 24 07:45:10 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: lwproc.c,v 1.39 2016/04/04 20:47:57 christos Exp $ */ +/* $NetBSD: lwproc.c,v 1.40 2016/04/24 07:45:10 martin Exp $ */ /* * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #define RUMP__CURLWP_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.39 2016/04/04 20:47:57 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.40 2016/04/24 07:45:10 martin Exp $"); #include #include @@ -69,6 +69,33 @@ lwp_unsleep(lwp_t *l, bool cleanup) (*l->l_syncobj->sobj_unsleep)(l, cleanup); } +/* + * Look up a live LWP within the specified process. + * + * Must be called with p->p_lock held. + */ +struct lwp * +lwp_find(struct proc *p, lwpid_t id) +{ + struct lwp *l; + + KASSERT(mutex_owned(p->p_lock)); + + LIST_FOREACH(l, >p_lwps, l_sibling) { + if (l->l_lid == id) + break; + } + + /* + * No need to lock - all of these conditions will + * be visible with the process level mutex held. + */ + if (l != NULL && (l->l_stat == LSIDL || l->l_stat == LSZOMB)) + l = NULL; + + return l; +} + void lwp_update_creds(struct lwp *l) {