svn commit: r287301 - head/libexec/talkd

2015-08-30 Thread Xin LI
Author: delphij
Date: Sun Aug 30 08:38:59 2015
New Revision: 287301
URL: https://svnweb.freebsd.org/changeset/base/287301

Log:
  Don't assign 'ptr' without using it.
  
  Reported by:  clang static analyzer
  MFC after:2 weeks

Modified:
  head/libexec/talkd/table.c

Modified: head/libexec/talkd/table.c
==
--- head/libexec/talkd/table.c  Sun Aug 30 04:46:44 2015(r287300)
+++ head/libexec/talkd/table.c  Sun Aug 30 08:38:59 2015(r287301)
@@ -197,7 +197,6 @@ delete_invite(u_int32_t id_num)
 {
TABLE_ENTRY *ptr;
 
-   ptr = table;
if (debug)
syslog(LOG_DEBUG, delete_invite(%d), id_num);
for (ptr = table; ptr != NIL; ptr = ptr-next) {
___
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: r287217 - head/usr.sbin/syslogd

2015-08-30 Thread Jilles Tjoelker
On Sun, Aug 30, 2015 at 11:53:00AM +0200, Ed Schouten wrote:
 2015-08-28 16:38 GMT+02:00 Joerg Sonnenberger jo...@britannica.bec.de:
  But the compiler can't tell if it is the *intention* that the function
  never returns. The warning behavior exists because that can easily
  change with macros etc.

 I think it's important to keep in mind what this keyword was designed for.

 The idea behind this attribute (and the C11 _Noreturn keyword) is to
 allow for propagation of optimisation state across compilation units.
 You use it to annotate functions in header files, so that the compiler
 does not need to handle function return at the call site. This
 knowledge can be automatically be inferred if the function is static.

Although you are right philosophically, in practice there are some
compilers and static analyzers that do benefit from noreturn attributes
on static functions. In particular, gcc 4.2.1 generates better code and
fewer warnings if static functions are annotated with noreturn if
appropriate, and some versions of the Clang/LLVM static analyzer do not
do any cross-procedural analysis at all and depend on noreturn
attributes on static functions to avoid false positives.

 Whether the compiler can throw additional warnings or not based on
 whether this keyword is present or what the intent of the programmer
 is, is completely irrelevant.

In practice this means that many compiler warnings need to be disabled
for the affected compilers.

 I agree with Bruce that this change makes little sense. I would even
 go as far as to say that GCC/Clang should just throw warnings if
 _Noreturn is used on a function that is static or used on a definition
 instead of a declaration.

_Noreturn on a global definition makes no sense but on a static function
it may still be needed.

-- 
Jilles Tjoelker
___
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: r287217 - head/usr.sbin/syslogd

2015-08-30 Thread Ed Schouten
2015-08-28 16:38 GMT+02:00 Joerg Sonnenberger jo...@britannica.bec.de:
 But the compiler can't tell if it is the *intention* that the function
 never returns. The warning behavior exists because that can easily
 change with macros etc.

I think it's important to keep in mind what this keyword was designed for.

The idea behind this attribute (and the C11 _Noreturn keyword) is to
allow for propagation of optimisation state across compilation units.
You use it to annotate functions in header files, so that the compiler
does not need to handle function return at the call site. This
knowledge can be automatically be inferred if the function is static.

Whether the compiler can throw additional warnings or not based on
whether this keyword is present or what the intent of the programmer
is, is completely irrelevant.

I agree with Bruce that this change makes little sense. I would even
go as far as to say that GCC/Clang should just throw warnings if
_Noreturn is used on a function that is static or used on a definition
instead of a declaration.

-- 
Ed Schouten e...@nuxi.nl
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
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: r287311 - head/share/doc/papers

2015-08-30 Thread George V. Neville-Neil
Author: gnn
Date: Sun Aug 30 20:59:19 2015
New Revision: 287311
URL: https://svnweb.freebsd.org/changeset/base/287311

Log:
  A bibliography of FreeBSD and BSD related papers and books.
  Keep this file in order by primary key which is the first author's
  last name and the year of publication.

Added:
  head/share/doc/papers/bsdreferences.bib   (contents, props changed)

Added: head/share/doc/papers/bsdreferences.bib
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/doc/papers/bsdreferences.bib Sun Aug 30 20:59:19 2015
(r287311)
@@ -0,0 +1,363 @@
+@Comment{A Bilbiography of papers that either use or extend FreeBSD.}
+@Comment{NOTE: Entries are alphabetical by primary key (author)}   
   
+@article{Anderson2014a,
+author = {Anderson, J and Watson, Rnm and Chisnall, D and Gudka, K. and 
Marinos, I and Davis, B},
+file = {:Users/gnn/Documents/Mendeley Desktop/Anderson et al/Proceedings of 
the European Conference on Computer Systems/Anderson et al. - 2014 - TESLA 
temporally enhanced system logic assertions.pdf:pdf},
+isbn = {9781450327046},
+journal = {Proceedings of the European Conference on Computer Systems},
+mendeley-groups = {CADETS},
+title = {{TESLA: temporally enhanced system logic assertions}},
+url = {http://dl.acm.org/citation.cfm?id=2592801},
+year = {2014}
+}
+
+@article{Armitage:2003:MSE:956993.957010,
+ author = {Armitage, Grenville},
+ title = {Maximising Student Exposure to Networking Using FreeBSD Virtual 
Hosts},
+ journal = {SIGCOMM Comput. Commun. Rev.},
+ issue_date = {July 2003},
+ volume = {33},
+ number = {3},
+ month = jul,
+ year = {2003},
+ issn = {0146-4833},
+ pages = {137--143},
+ numpages = {7},
+ url = {http://doi.acm.org/10.1145/956993.957010},
+ doi = {10.1145/956993.957010},
+ acmid = {957010},
+ publisher = {ACM},
+ address = {New York, NY, USA},
+ keywords = {FreeBSD, IP, Unix, networking, students, teaching, virtual hosts},
+} 
+
+@article{Armitage:2008:IHI:1384609.1384613,
+ author = {Armitage, Grenville and Stewart, Lawrence and Welzl, Michael and 
Healy, James},
+ title = {An Independent H-TCP Implementation Under FreeBSD 7.0: Description 
and Observed Behaviour},
+ journal = {SIGCOMM Comput. Commun. Rev.},
+ issue_date = {July 2008},
+ volume = {38},
+ number = {3},
+ month = jul,
+ year = {2008},
+ issn = {0146-4833},
+ pages = {27--38},
+ numpages = {12},
+ url = {http://doi.acm.org/10.1145/1384609.1384613},
+ doi = {10.1145/1384609.1384613},
+ acmid = {1384613},
+ publisher = {ACM},
+ address = {New York, NY, USA},
+ keywords = {FreeBSD, H-TCP, TCP, congestion control},
+} 
+  
+@inproceedings{Bless:2004:IFT:1161734.1162020,
+ author = {Bless, Roland and Doll, Mark},
+ title = {Integration of the FreeBSD TCP/IP-stack into the Discrete Event 
Simulator OMNet++},
+ booktitle = {Proceedings of the 36th Conference on Winter Simulation},
+ series = {WSC '04},
+ year = {2004},
+ isbn = {0-7803-8786-4},
+ location = {Washington, D.C.},
+ pages = {1556--1561},
+ numpages = {6},
+ url = {http://dl.acm.org/citation.cfm?id=1161734.1162020},
+ acmid = {1162020},
+ publisher = {Winter Simulation Conference},
+} 
+  
+@inproceedings{Canfora:2011:SIA:1985441.1985463,
+ author = {Canfora, Gerardo and Cerulo, Luigi and Cimitile, Marta and Di 
Penta, Massimiliano},
+ title = {Social Interactions Around Cross-system Bug Fixings: The Case of 
FreeBSD and OpenBSD},
+ booktitle = {Proceedings of the 8th Working Conference on Mining Software 
Repositories},
+ series = {MSR '11},
+ year = {2011},
+ isbn = {978-1-4503-0574-7},
+ location = {Waikiki, Honolulu, HI, USA},
+ pages = {143--152},
+ numpages = {10},
+ url = {http://doi.acm.org/10.1145/1985441.1985463},
+ doi = {10.1145/1985441.1985463},
+ acmid = {1985463},
+ publisher = {ACM},
+ address = {New York, NY, USA},
+ keywords = {bug fixing, code migration, empirical study, social network 
analysis},
+} 
+
+
+@inproceedings{Chang:2008:ESC:1370750.1370766,
+ author = {Chang, Hung-Fu and Mockus, Audris},
+ title = {Evaluation of Source Code Copy Detection Methods on Freebsd},
+ booktitle = {Proceedings of the 2008 International Working Conference on 
Mining Software Repositories},
+ series = {MSR '08},
+ year = {2008},
+ isbn = {978-1-60558-024-1},
+ location = {Leipzig, Germany},
+ pages = {61--66},
+ numpages = {6},
+ url = {http://doi.acm.org/10.1145/1370750.1370766},
+ doi = {10.1145/1370750.1370766},
+ acmid = {1370766},
+ publisher = {ACM},
+ address = {New York, NY, USA},
+ keywords = {clone detection, cloning, code copying, open source, version 
control},
+} 
+  
+@article{Chisnall:2015:BPA:2786763.2694367,
+ author = {Chisnall, David and Rothwell, Colin and Watson, Robert N.M. and 
Woodruff, Jonathan and Vadera, Munraj and Moore, Simon W. and Roe, Michael and 
Davis, Brooks and Neumann, Peter G.},
+ title = {Beyond the PDP-11: Architectural 

svn commit: r287314 - head/tools/tools/iwn/iwnstats

2015-08-30 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 30 21:55:01 2015
New Revision: 287314
URL: https://svnweb.freebsd.org/changeset/base/287314

Log:
  oops - mis-commit.

Modified:
  head/tools/tools/iwn/iwnstats/Makefile

Modified: head/tools/tools/iwn/iwnstats/Makefile
==
--- head/tools/tools/iwn/iwnstats/Makefile  Sun Aug 30 21:54:47 2015
(r287313)
+++ head/tools/tools/iwn/iwnstats/Makefile  Sun Aug 30 21:55:01 2015
(r287314)
@@ -9,8 +9,6 @@ MAN=
 CFLAGS+=-I${.CURDIR}/../../../../sys/dev/iwn/
 CFLAGS+=-I${.CURDIR}/../../../../sys/
 
-CFLAGS+=   -g -ggdb -O0
-
 PROG=  iwnstats
 
 # Because of a clang preprocessor parser limitation causing this
___
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: r287310 - head/sys/kern

2015-08-30 Thread Konstantin Belousov
Author: kib
Date: Sun Aug 30 18:02:57 2015
New Revision: 287310
URL: https://svnweb.freebsd.org/changeset/base/287310

Log:
  Use P1B_PRIO_MAX to designate max posix priority for the RR/FIFO
  scheduler types.  It was intended to be used there, compare with the
  min value, and with the test for correctness in ksched_setscheduler().
  
  Note that P1B_PRIO_MAX and RTP_PRIO_MAX do have the same numerical
  values, the change is cosmetical.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/ksched.c

Modified: head/sys/kern/ksched.c
==
--- head/sys/kern/ksched.c  Sun Aug 30 17:58:11 2015(r287309)
+++ head/sys/kern/ksched.c  Sun Aug 30 18:02:57 2015(r287310)
@@ -229,7 +229,7 @@ ksched_get_priority_max(struct ksched *k
switch (policy) {
case SCHED_FIFO:
case SCHED_RR:
-   *prio = RTP_PRIO_MAX;
+   *prio = P1B_PRIO_MAX;
break;
case SCHED_OTHER:
*prio = PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE;
___
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: r287311 - head/share/doc/papers

2015-08-30 Thread Baptiste Daroussin
On Sun, Aug 30, 2015 at 08:59:20PM +, George V. Neville-Neil wrote:
 Author: gnn
 Date: Sun Aug 30 20:59:19 2015
 New Revision: 287311
 URL: https://svnweb.freebsd.org/changeset/base/287311
 
 Log:
   A bibliography of FreeBSD and BSD related papers and books.
   Keep this file in order by primary key which is the first author's
   last name and the year of publication.
 
Wouldn't it be more useful to have this on the website? That would be of
interest of lot of people interested in freebsd including people that haven't an
installed freebsd, imho the website would be more accurate than sources.

Best regards,
Bapt


pgp7VF9ogQN3U.pgp
Description: PGP signature


svn commit: r287312 - head/sys/dev/iwn

2015-08-30 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 30 21:54:33 2015
New Revision: 287312
URL: https://svnweb.freebsd.org/changeset/base/287312

Log:
  Migrate the stats API for iwn(4) into a cdev ioctl, rather than tying
  into the vap.
  
  This allows for possible hardware interaction without needing a vap
  configured.

Modified:
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/iwn/if_iwn_ioctl.h
  head/sys/dev/iwn/if_iwnvar.h

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun Aug 30 20:59:19 2015(r287311)
+++ head/sys/dev/iwn/if_iwn.c   Sun Aug 30 21:54:33 2015(r287312)
@@ -39,11 +39,13 @@ __FBSDID($FreeBSD$);
 #include sys/systm.h
 #include sys/malloc.h
 #include sys/bus.h
+#include sys/conf.h
 #include sys/rman.h
 #include sys/endian.h
 #include sys/firmware.h
 #include sys/limits.h
 #include sys/module.h
+#include sys/priv.h
 #include sys/queue.h
 #include sys/taskqueue.h
 
@@ -378,6 +380,19 @@ MODULE_DEPEND(iwn, firmware, 1, 1, 1);
 MODULE_DEPEND(iwn, pci, 1, 1, 1);
 MODULE_DEPEND(iwn, wlan, 1, 1, 1);
 
+static d_ioctl_t iwn_cdev_ioctl;
+static d_open_t iwn_cdev_open;
+static d_close_t iwn_cdev_close;
+
+static struct cdevsw iwn_cdevsw = {
+   .d_version = D_VERSION,
+   .d_flags = 0,
+   .d_open = iwn_cdev_open,
+   .d_close = iwn_cdev_close,
+   .d_ioctl = iwn_cdev_ioctl,
+   .d_name = iwn,
+};
+
 static int
 iwn_probe(device_t dev)
 {
@@ -704,6 +719,15 @@ iwn_attach(device_t dev)
if (bootverbose)
ieee80211_announce(ic);
DPRINTF(sc, IWN_DEBUG_TRACE, -%s: end\n,__func__);
+
+   /* Add debug ioctl right at the end */
+   sc-sc_cdev = make_dev(iwn_cdevsw, device_get_unit(dev),
+   UID_ROOT, GID_WHEEL, 0600, %s, device_get_nameunit(dev));
+   if (sc-sc_cdev == NULL) {
+   device_printf(dev, failed to create debug character device\n);
+   } else {
+   sc-sc_cdev-si_drv1 = sc;
+   }
return 0;
 fail:
iwn_detach(dev);
@@ -1416,6 +1440,11 @@ iwn_detach(device_t dev)
bus_release_resource(dev, SYS_RES_MEMORY,
rman_get_rid(sc-mem), sc-mem);
 
+   if (sc-sc_cdev) {
+   destroy_dev(sc-sc_cdev);
+   sc-sc_cdev = NULL;
+   }
+
DPRINTF(sc, IWN_DEBUG_TRACE, -%s: end\n, __func__);
IWN_LOCK_DESTROY(sc);
return 0;
@@ -4999,18 +5028,37 @@ iwn_watchdog(void *arg)
 }
 
 static int
-iwn_ioctl(struct ieee80211com *ic, u_long cmd, void *data)
+iwn_cdev_open(struct cdev *dev, int flags, int type, struct thread *td)
 {
-   struct ifreq *ifr = data;
-   struct iwn_softc *sc = ic-ic_softc;
-   int error = 0;
- 
+
+   return (0);
+}
+
+static int
+iwn_cdev_close(struct cdev *dev, int flags, int type, struct thread *td)
+{
+
+   return (0);
+}
+
+static int
+iwn_cdev_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data, int fflag,
+struct thread *td)
+{
+   int rc;
+   struct iwn_softc *sc = dev-si_drv1;
+   struct iwn_ioctl_data *d;
+
+   rc = priv_check(td, PRIV_DRIVER);
+   if (rc != 0)
+   return (0);
+
switch (cmd) {
case SIOCGIWNSTATS:
+   d = (struct iwn_ioctl_data *) data;
IWN_LOCK(sc);
/* XXX validate permissions/memory/etc? */
-   error = copyout(sc-last_stat, ifr-ifr_data,
-   sizeof(struct iwn_stats));
+   rc = copyout(sc-last_stat, d-dst_addr, sizeof(struct 
iwn_stats));
IWN_UNLOCK(sc);
break;
case SIOCZIWNSTATS:
@@ -5019,10 +5067,17 @@ iwn_ioctl(struct ieee80211com *ic, u_lon
IWN_UNLOCK(sc);
break;
default:
-   error = ENOTTY;
+   rc = EINVAL;
break;
}
-   return (error);
+   return (rc);
+}
+
+static int
+iwn_ioctl(struct ieee80211com *ic, u_long cmd, void *data)
+{
+
+   return (ENOTTY);
 }
 
 static void
@@ -8979,3 +9034,5 @@ iwn_debug_register(struct iwn_softc *sc)
DPRINTF(sc, IWN_DEBUG_REGISTER,%s,\n);
 }
 #endif
+
+

Modified: head/sys/dev/iwn/if_iwn_ioctl.h
==
--- head/sys/dev/iwn/if_iwn_ioctl.h Sun Aug 30 20:59:19 2015
(r287311)
+++ head/sys/dev/iwn/if_iwn_ioctl.h Sun Aug 30 21:54:33 2015
(r287312)
@@ -18,8 +18,13 @@
 #ifndef__IF_IWN_IOCTL_H__
 #define__IF_IWN_IOCTL_H__
 
+struct iwn_ioctl_data {
+   void *dst_addr;
+   int dst_len;
+};
+
 /* XXX how should I pick appropriate ioctl numbers? */
-#defineSIOCGIWNSTATS   _IOWR('i', 145, struct ifreq)
-#defineSIOCZIWNSTATS   _IOWR('i', 146, struct ifreq)
+#defineSIOCGIWNSTATS   _IOWR('f', 145, struct iwn_ioctl_data)
+#defineSIOCZIWNSTATS   _IOWR('f', 146, struct 

svn commit: r287313 - head/tools/tools/iwn/iwnstats

2015-08-30 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 30 21:54:47 2015
New Revision: 287313
URL: https://svnweb.freebsd.org/changeset/base/287313

Log:
  Convert this over to use the new cdev based ioctl path.

Modified:
  head/tools/tools/iwn/iwnstats/Makefile
  head/tools/tools/iwn/iwnstats/iwn_ioctl.c
  head/tools/tools/iwn/iwnstats/iwn_ioctl.h
  head/tools/tools/iwn/iwnstats/iwnstats.h
  head/tools/tools/iwn/iwnstats/main.c

Modified: head/tools/tools/iwn/iwnstats/Makefile
==
--- head/tools/tools/iwn/iwnstats/Makefile  Sun Aug 30 21:54:33 2015
(r287312)
+++ head/tools/tools/iwn/iwnstats/Makefile  Sun Aug 30 21:54:47 2015
(r287313)
@@ -9,6 +9,8 @@ MAN=
 CFLAGS+=-I${.CURDIR}/../../../../sys/dev/iwn/
 CFLAGS+=-I${.CURDIR}/../../../../sys/
 
+CFLAGS+=   -g -ggdb -O0
+
 PROG=  iwnstats
 
 # Because of a clang preprocessor parser limitation causing this

Modified: head/tools/tools/iwn/iwnstats/iwn_ioctl.c
==
--- head/tools/tools/iwn/iwnstats/iwn_ioctl.c   Sun Aug 30 21:54:33 2015
(r287312)
+++ head/tools/tools/iwn/iwnstats/iwn_ioctl.c   Sun Aug 30 21:54:47 2015
(r287313)
@@ -63,28 +63,24 @@
 #include iwn_ioctl.h
 
 void
-iwn_setifname(struct iwnstats *is, const char *ifname)
-{
-
-   strncpy(is-ifr.ifr_name, ifname, sizeof (is-ifr.ifr_name));
-}
-
-void
 iwn_zerostats(struct iwnstats *is)
 {
 
-   if (ioctl(is-s, SIOCZIWNSTATS, is-ifr)  0)
-   err(-1, ioctl: %s, is-ifr.ifr_name);
+   if (ioctl(is-s, SIOCZIWNSTATS, NULL)  0)
+   err(-1, ioctl);
 }
 
 int
 iwn_collect(struct iwnstats *is)
 {
int err;
+   struct iwn_ioctl_data d;
 
-   is-ifr.ifr_data = (caddr_t) is-st;
-   err = ioctl(is-s, SIOCGIWNSTATS, is-ifr);
+   printf(st: %p\n, is-st);
+   d.dst_addr = is-st;
+   d.dst_len = sizeof(is-st);
+   err = ioctl(is-s, SIOCGIWNSTATS, (caddr_t) d);
if (err  0)
-   warn(ioctl: %s, is-ifr.ifr_name);
+   warn(ioctl);
return (err);
 }

Modified: head/tools/tools/iwn/iwnstats/iwn_ioctl.h
==
--- head/tools/tools/iwn/iwnstats/iwn_ioctl.h   Sun Aug 30 21:54:33 2015
(r287312)
+++ head/tools/tools/iwn/iwnstats/iwn_ioctl.h   Sun Aug 30 21:54:47 2015
(r287313)
@@ -31,7 +31,6 @@
 #ifndef__IWN_IOCTL_H__
 #define__IWN_IOCTL_H__
 
-extern void iwn_setifname(struct iwnstats *is, const char *ifname);
 extern void iwn_zerostats(struct iwnstats *is);
 extern int iwn_collect(struct iwnstats *is);
 

Modified: head/tools/tools/iwn/iwnstats/iwnstats.h
==
--- head/tools/tools/iwn/iwnstats/iwnstats.hSun Aug 30 21:54:33 2015
(r287312)
+++ head/tools/tools/iwn/iwnstats/iwnstats.hSun Aug 30 21:54:47 2015
(r287313)
@@ -33,7 +33,6 @@
 
 struct iwnstats {
int s;
-   struct ifreq ifr;
struct iwn_stats st;
 };
 

Modified: head/tools/tools/iwn/iwnstats/main.c
==
--- head/tools/tools/iwn/iwnstats/main.cSun Aug 30 21:54:33 2015
(r287312)
+++ head/tools/tools/iwn/iwnstats/main.cSun Aug 30 21:54:47 2015
(r287313)
@@ -33,6 +33,7 @@
 #include stdio.h
 #include stdlib.h
 #include signal.h
+#include fcntl.h
 #include unistd.h
 #include string.h
 #include err.h
@@ -50,22 +51,23 @@
 #include iwnstats.h
 #include iwn_ioctl.h
 
-#defineIWN_DEFAULT_IF  wlan0
+#defineIWN_DEFAULT_IF  iwn0
 
 static struct iwnstats *
 iwnstats_new(const char *ifname)
 {
struct iwnstats *is;
+   char buf[128];
 
is = calloc(1, sizeof(struct iwnstats));
if (is == NULL)
return (NULL);
 
-   is-s = socket(AF_INET, SOCK_DGRAM, 0);
+   snprintf(buf, sizeof(buf), /dev/%s, ifname);
+   is-s = open(buf, O_RDWR);
if (is-s  0)
-   err(1, socket);
+   err(1, open);
 
-   iwn_setifname(is, ifname);
return (is);
 }
 
___
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: r287302 - head/sys/contrib/dev/ath/ath_hal/ar9300

2015-08-30 Thread Adrian Chadd
Author: adrian
Date: Sun Aug 30 08:46:50 2015
New Revision: 287302
URL: https://svnweb.freebsd.org/changeset/base/287302

Log:
  Fix compilation error on gcc-5.2.0 - it now warns on non-paranthen'ed
  logical negation when used in this fashion.
  
  Tested:
  
  * compile only

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.cSun Aug 30 
08:38:59 2015(r287301)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.cSun Aug 30 
08:46:50 2015(r287302)
@@ -539,7 +539,7 @@ skip_ws_det:
 OS_REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW,
 AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
 }
-if (!is_on != ani_state-ofdm_weak_sig_detect_off) {
+if ((!is_on) != ani_state-ofdm_weak_sig_detect_off) {
 HALDEBUG(ah, HAL_DEBUG_ANI,
 %s: ** ch %d: ofdm weak signal: %s=%s\n,
 __func__, chan-ic_freq,
@@ -684,7 +684,7 @@ skip_ws_det:
 OS_REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL,
 AR_PHY_MRC_CCK_MUX_REG, is_on);
 }
-if (!is_on != ani_state-mrc_cck_off) {
+if ((!is_on) != ani_state-mrc_cck_off) {
 HALDEBUG(ah, HAL_DEBUG_ANI,
 %s: ** ch %d: MRC CCK: %s=%s\n, __func__, chan-ic_freq,
 !ani_state-mrc_cck_off ? on : off, is_on ? on : off);
___
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: r287308 - in head/bin/sh: . tests/builtins

2015-08-30 Thread Jilles Tjoelker
Author: jilles
Date: Sun Aug 30 17:24:22 2015
New Revision: 287308
URL: https://svnweb.freebsd.org/changeset/base/287308

Log:
  sh: Fix read with escaped IFS characters at the end.
  
  Characters escaped with a backslash must be treated as if they were not in
  IFS. This includes stripping trailing IFS characters.

Added:
  head/bin/sh/tests/builtins/read9.0   (contents, props changed)
Modified:
  head/bin/sh/miscbltin.c
  head/bin/sh/tests/builtins/Makefile

Modified: head/bin/sh/miscbltin.c
==
--- head/bin/sh/miscbltin.c Sun Aug 30 16:10:12 2015(r287307)
+++ head/bin/sh/miscbltin.c Sun Aug 30 17:24:22 2015(r287308)
@@ -100,6 +100,7 @@ readcmd(int argc __unused, char **argv _
int i;
int is_ifs;
int saveall = 0;
+   ptrdiff_t lastnonifs, lastnonifsws;
struct timeval tv;
char *tvptr;
fd_set ifds;
@@ -169,6 +170,7 @@ readcmd(int argc __unused, char **argv _
startword = 2;
backslash = 0;
STARTSTACKSTR(p);
+   lastnonifs = lastnonifsws = -1;
for (;;) {
nread = read(STDIN_FILENO, c, 1);
if (nread == -1) {
@@ -193,6 +195,7 @@ readcmd(int argc __unused, char **argv _
backslash = 0;
if (c != '\n') {
startword = 0;
+   lastnonifs = lastnonifsws = p - stackblock();
USTPUTC(c, p);
}
continue;
@@ -218,8 +221,10 @@ readcmd(int argc __unused, char **argv _
if (is_ifs == 2  startword == 1) {
/* Only one non-whitespace IFS per word */
startword = 2;
-   if (saveall)
+   if (saveall) {
+   lastnonifsws = p - stackblock();
USTPUTC(c, p);
+   }
continue;
}
}
@@ -230,6 +235,7 @@ readcmd(int argc __unused, char **argv _
if (saveall)
/* Not just a spare terminator */
saveall++;
+   lastnonifs = lastnonifsws = p - stackblock();
USTPUTC(c, p);
continue;
}
@@ -240,6 +246,8 @@ readcmd(int argc __unused, char **argv _
if (ap[1] == NULL) {
/* Last variable needs all IFS chars */
saveall++;
+   if (is_ifs == 2)
+   lastnonifsws = p - stackblock();
USTPUTC(c, p);
continue;
}
@@ -248,20 +256,17 @@ readcmd(int argc __unused, char **argv _
setvar(*ap, stackblock(), 0);
ap++;
STARTSTACKSTR(p);
+   lastnonifs = lastnonifsws = -1;
}
STACKSTRNUL(p);
 
-   /* Remove trailing IFS chars */
-   for (; stackblock() = --p; *p = 0) {
-   if (!strchr(ifs, *p))
-   break;
-   if (strchr( \t\n, *p))
-   /* Always remove whitespace */
-   continue;
-   if (saveall  1)
-   /* Don't remove non-whitespace unless it was naked */
-   break;
-   }
+   /*
+* Remove trailing IFS chars: always remove whitespace, don't remove
+* non-whitespace unless it was naked
+*/
+   if (saveall = 1)
+   lastnonifsws = lastnonifs;
+   stackblock()[lastnonifsws + 1] = '\0';
setvar(*ap, stackblock(), 0);
 
/* Set any remaining args to  */

Modified: head/bin/sh/tests/builtins/Makefile
==
--- head/bin/sh/tests/builtins/Makefile Sun Aug 30 16:10:12 2015
(r287307)
+++ head/bin/sh/tests/builtins/Makefile Sun Aug 30 17:24:22 2015
(r287308)
@@ -123,6 +123,7 @@ FILES+= read5.0
 FILES+=read6.0
 FILES+=read7.0
 FILES+=read8.0
+FILES+=read9.0
 FILES+=return1.0
 FILES+=return2.1
 FILES+=return3.1

Added: head/bin/sh/tests/builtins/read9.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/builtins/read9.0  Sun Aug 30 17:24:22 2015
(r287308)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+empty=''
+read a b c EOF
+\ \ A B\ \ B C\ \ $empty
+EOF
+read d e EOF
+D\ $empty
+EOF
+[ $a.$b.$c.$d.$e =   A.B  B.C  .D . ]

Re: svn commit: r287299 - head/sys/boot/efi/loader/arch/amd64

2015-08-30 Thread Rui Paulo
On Sun, 2015-08-30 at 01:40 +, Marcel Moolenaar wrote:
 Author: marcel
 Date: Sun Aug 30 01:39:59 2015
 New Revision: 287299
 URL: https://svnweb.freebsd.org/changeset/base/287299
 
 Log:
   Add a gop command to help diagnose VT efifb problems. The gop
   command has the following sub-commands:
 list  - list all possible modes (paged)
 get   - return the current mode
 set mode- set the current mode to mode
 

This is duplicating the functionality of the `mode' command.  Please
remove the mode command.

Also, 'gop' is pretty weird for a command name.  Maybe we can change
that to something more user friendly?

-- 
Rui Paulo
___
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: r287309 - in head/sys: kern sys

2015-08-30 Thread Konstantin Belousov
Author: kib
Date: Sun Aug 30 17:58:11 2015
New Revision: 287309
URL: https://svnweb.freebsd.org/changeset/base/287309

Log:
  Remove single-use macros obfuscating malloc(9) and free(9) calls.
  Style.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/ksched.c
  head/sys/sys/posix4.h

Modified: head/sys/kern/ksched.c
==
--- head/sys/kern/ksched.c  Sun Aug 30 17:24:22 2015(r287308)
+++ head/sys/kern/ksched.c  Sun Aug 30 17:58:11 2015(r287309)
@@ -30,8 +30,7 @@
  * SUCH DAMAGE.
  */
 
-/* ksched: Soft real time scheduling based on rtprio.
- */
+/* ksched: Soft real time scheduling based on rtprio. */
 
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
@@ -51,8 +50,7 @@ __FBSDID($FreeBSD$);
 
 FEATURE(kposix_priority_scheduling, POSIX P1003.1B realtime extensions);
 
-/* ksched: Real-time extension to support POSIX priority scheduling.
- */
+/* ksched: Real-time extension to support POSIX priority scheduling. */
 
 struct ksched {
struct timespec rr_interval;
@@ -61,21 +59,21 @@ struct ksched {
 int
 ksched_attach(struct ksched **p)
 {
-   struct ksched *ksched= p31b_malloc(sizeof(*ksched));
+   struct ksched *ksched;
 
+   ksched = malloc(sizeof(*ksched), M_P31B, M_WAITOK);
ksched-rr_interval.tv_sec = 0;
ksched-rr_interval.tv_nsec = 10L / hz * sched_rr_interval();
-
*p = ksched;
-   return 0;
+   return (0);
 }
 
 int
 ksched_detach(struct ksched *ks)
 {
-   p31b_free(ks);
 
-   return 0;
+   free(ks, M_P31B);
+   return (0);
 }
 
 /*
@@ -108,47 +106,39 @@ static __inline int
 getscheduler(struct ksched *ksched, struct thread *td, int *policy)
 {
struct rtprio rtp;
-   int e = 0;
+   int e;
 
+   e = 0;
pri_to_rtp(td, rtp);
-   switch (rtp.type)
-   {
-   case RTP_PRIO_FIFO:
+   switch (rtp.type) {
+   case RTP_PRIO_FIFO:
*policy = SCHED_FIFO;
break;
-
-   case RTP_PRIO_REALTIME:
+   case RTP_PRIO_REALTIME:
*policy = SCHED_RR;
break;
-
-   default:
+   default:
*policy = SCHED_OTHER;
break;
}
-
-   return e;
+   return (e);
 }
 
 int
 ksched_setparam(struct ksched *ksched,
 struct thread *td, const struct sched_param *param)
 {
-   int policy;
-   int e;
+   int e, policy;
 
e = getscheduler(ksched, td, policy);
-
if (e == 0)
-   {
-   e = ksched_setscheduler(ksched, td, policy, param);
-   }
-
-   return e;
+   e = ksched_setscheduler(ksched, td, policy, param);
+   return (e);
 }
 
 int
-ksched_getparam(struct ksched *ksched,
-struct thread *td, struct sched_param *param)
+ksched_getparam(struct ksched *ksched, struct thread *td,
+struct sched_param *param)
 {
struct rtprio rtp;
 
@@ -159,13 +149,14 @@ ksched_getparam(struct ksched *ksched,
if (PRI_MIN_TIMESHARE  rtp.prio) 
/*
 * The interactive score has it to min realtime
-* so we must show max (64 most likely
+* so we must show max (64 most likely).
 */ 
-   param-sched_priority = (PRI_MAX_TIMESHARE - 
PRI_MIN_TIMESHARE);
+   param-sched_priority = PRI_MAX_TIMESHARE -
+   PRI_MIN_TIMESHARE;
else
param-sched_priority = tsprio_to_p4prio(rtp.prio);
}
-   return 0;
+   return (0);
 }
 
 /*
@@ -176,117 +167,106 @@ ksched_getparam(struct ksched *ksched,
  *
  */
 int
-ksched_setscheduler(struct ksched *ksched,
-struct thread *td, int policy, const struct sched_param *param)
+ksched_setscheduler(struct ksched *ksched, struct thread *td, int policy,
+const struct sched_param *param)
 {
-   int e = 0;
struct rtprio rtp;
+   int e;
 
-   switch(policy)
-   {
-   case SCHED_RR:
-   case SCHED_FIFO:
-
+   e = 0;
+   switch(policy) {
+   case SCHED_RR:
+   case SCHED_FIFO:
if (param-sched_priority = P1B_PRIO_MIN 
-   param-sched_priority = P1B_PRIO_MAX)
-   {
+   param-sched_priority = P1B_PRIO_MAX) {
rtp.prio = p4prio_to_rtpprio(param-sched_priority);
-   rtp.type = (policy == SCHED_FIFO)
-   ? RTP_PRIO_FIFO : RTP_PRIO_REALTIME;
-
+   rtp.type = (policy == SCHED_FIFO) ? RTP_PRIO_FIFO :
+   RTP_PRIO_REALTIME;
rtp_to_pri(rtp, td);
-   }
-   else
+   } else {
e = EPERM;
-
-
+   }
  

svn commit: r287305 - head/sys/kern

2015-08-30 Thread Julien Charbon
Author: jch
Date: Sun Aug 30 13:44:46 2015
New Revision: 287305
URL: https://svnweb.freebsd.org/changeset/base/287305

Log:
  Revert r286880:  If at first this change made sense, it turns out
  it helps only the TCP timers callout(9) usage.  As the benefit for
  others callout(9) usages did not reach a consensus the historical
  usage should prevail.
  
  Differential Revision:  https://reviews.freebsd.org/D3078

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cSun Aug 30 13:44:39 2015
(r287304)
+++ head/sys/kern/kern_timeout.cSun Aug 30 13:44:46 2015
(r287305)
@@ -1151,7 +1151,6 @@ _callout_stop_safe(struct callout *c, in
struct lock_class *class;
int direct, sq_locked, use_lock;
int not_on_a_list;
-   int not_running = 1;
 
if (safe)
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, c-c_lock,
@@ -1379,17 +1378,8 @@ again:
}
}
callout_cc_del(c, cc);
-
-   if (!use_lock) {
-   /*
-* If we are asked to stop a callout which is currently in 
progress
-* and indeed impossible to stop then return 0.
-*/
-   not_running = !(cc_exec_curr(cc, direct) == c);
-   }
-
CC_UNLOCK(cc);
-   return (not_running);
+   return (1);
 }
 
 void
___
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: r287217 - head/usr.sbin/syslogd

2015-08-30 Thread Joerg Sonnenberger
On Sun, Aug 30, 2015 at 03:36:27PM +1000, Bruce Evans wrote:
 On Fri, 28 Aug 2015, Joerg Sonnenberger wrote:
 
 On Fri, Aug 28, 2015 at 10:17:56PM +1000, Bruce Evans wrote:
 -static void   die(int);
 +static void   die(int) __dead2;
 
 Since the function is static, it is very easy for the compiler to see
 that it doesn't return.
 
 But the compiler can't tell if it is the *intention* that the function
 never returns. The warning behavior exists because that can easily
 change with macros etc.
 
 The compiler should trust the programmer to write correct functions.

That's a good one. Programmers are notorious for one thing, which is not
writing correct code.

 Even gcc-4.2.1 does this by default, since
 -O implies -funit-at-a-time for gcc-4.2.1.  For clang, there is no way
 to prevent this (except possibly -O0) since, since -fno-unit-at-a-time
 is broken in clang.
 
 It is not broken. It is loadly ignored as unsupported. The very
 existance of the option in GCC has always been a concession to broken
 and badly written code, including of course GCC's own CRT.
 
 Unsupported == incompatible == broken.
 
 My use of this option can probably be reduced to -fno-toplevel-reorder,
 but that is even more broken in clang (it and -ftoplevel-reorder are
 unknown arguments, while -fno-unit-at-a-time is an unsupported
 optimization, and -funit-at-a-time works).

Neither -fno-unit-at-a-time nor -funit-at-a-time is an optimisation.
Nothing in the standard suggests a specific ordering and well written
programs don't make such assumptions. All use cases I have seen so far
are miswritten and fragile and would be better served by using a
different approach. This is no different from broken code requiring
function calls in a sequence point to be executed in a specific order.

Joerg
___
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: r287306 - head/sys/arm/conf

2015-08-30 Thread Luiz Otavio O Souza
Author: loos
Date: Sun Aug 30 15:38:41 2015
New Revision: 287306
URL: https://svnweb.freebsd.org/changeset/base/287306

Log:
  In preparation to support other A20 based boards, rename the CUBIEBOARD2
  kernel configuration to A20.
  
  There are other boards (namely the banana pi) that use exactly the same
  devices.
  
  Additionally, we are moving from static FDT support (DTB compiled
  in-kernel) to DTB passed to kernel by the boot loader (ubldr).  The u-boot
  for these boards are already available on ports and as the crochet support
  for these boards isn't committed yet, this should not bring any issues.
  
  Discussed with:   ian

Added:
  head/sys/arm/conf/A20
 - copied, changed from r287120, head/sys/arm/conf/CUBIEBOARD2
Deleted:
  head/sys/arm/conf/CUBIEBOARD2

Copied and modified: head/sys/arm/conf/A20 (from r287120, 
head/sys/arm/conf/CUBIEBOARD2)
==
--- head/sys/arm/conf/CUBIEBOARD2   Mon Aug 24 23:40:36 2015
(r287120, copy source)
+++ head/sys/arm/conf/A20   Sun Aug 30 15:38:41 2015(r287306)
@@ -1,6 +1,5 @@
 #
-# CUBIEBOARD2 -- Custom configuration for the CUBIEBOARD2 ARM development
-# platform, check out http://www.cubieboard.org
+# A20 -- Custom configuration for the Allwinner A20 ARM SoC
 #
 # For more information on this file, please read the config(5) manual page,
 # and/or the handbook section on Kernel Configuration Files:
@@ -19,7 +18,7 @@
 #
 # $FreeBSD$
 
-ident  CUBIEBOARD2
+ident  A20
 
 includestd.armv6
 include../allwinner/a20/std.a20
@@ -109,6 +108,4 @@ device  miibus
 
 # Flattened Device Tree
 optionsFDT # Configure using FDT/DTB data
-optionsFDT_DTB_STATIC
-makeoptionsFDT_DTS_FILE=cubieboard2.dts
 makeoptionsMODULES_EXTRA=dtb/allwinner
___
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: r287217 - head/usr.sbin/syslogd

2015-08-30 Thread Bruce Evans

On Sun, 30 Aug 2015, Jilles Tjoelker wrote:


On Sun, Aug 30, 2015 at 11:53:00AM +0200, Ed Schouten wrote:

2015-08-28 16:38 GMT+02:00 Joerg Sonnenberger jo...@britannica.bec.de:

But the compiler can't tell if it is the *intention* that the function
never returns. The warning behavior exists because that can easily
change with macros etc.



I think it's important to keep in mind what this keyword was designed for.



The idea behind this attribute (and the C11 _Noreturn keyword) is to
allow for propagation of optimisation state across compilation units.
You use it to annotate functions in header files, so that the compiler
does not need to handle function return at the call site. This
knowledge can be automatically be inferred if the function is static.


Although you are right philosophically, in practice there are some
compilers and static analyzers that do benefit from noreturn attributes
on static functions. In particular, gcc 4.2.1 generates better code and
fewer warnings if static functions are annotated with noreturn if
appropriate, and some versions of the Clang/LLVM static analyzer do not
do any cross-procedural analysis at all and depend on noreturn
attributes on static functions to avoid false positives.


If this were important, then __dead2 would be used a lot for important
functions, not for usage() and die().  It is in fact so important that
__dead2 is used a whole 86 times in $(find /usr/src -name *.c):
- 10 uses for non-static functions where there is actually a reason to
  use __dead2, but about half of these 10 are due to missing staticization
- 30 uses for static usage().  All of these uses have the correct syntax
  with __dead2 at the end (some versions of gcc only allow attributes
  near the end)
- 46 other uses.  Mostly for functions like panic(), exit() or err().
  18 of these have syntax errors with __dead2 not at the end (or near
  the end, preceding other attributes).  There are 10
  'static __dead2 void's, 7 'static void __dead2's, and 1
  '__dead2 static void'.

Non-FreeBSD spellings of __dead2 are more popular.  $(find /usr/src -name
*.c) has 200 lines matching 'oreturn'.  About 73 of these use the hard-coded
gccism __attribute(()).  The C11ish _Noreturn is used just 4 times (3 times
in rlogin for static functions that don't need it and 1 time in
libstdthreads).  Outside of contrib, there are just 30 lines matching
'oreturn': 11 in crypto/heimdal, 2 in routed/rtqery, 8 in tools/regression
for static usage(), 4 _Noreturns as above, 1 in xlint, 1 in pkill, 2 in
comments and 1 unrelated match.


In practice this means that many compiler warnings need to be disabled
for the affected compilers.


An example is the LLVM static checker in 2008, but hopefully not later
versions if this or any compiler ever used in FreeBSD.  errexit() in
echo/echo.c always compiled at WARNS=6 with gcc, but was changed in
2008 to define (sic) it as __dead2 with the excuse that this reduces
warnings with the static checker.  The change is quite broken:
- it has the syntax error 'static __dead2 void' -
__dead2 is applied to the definition of the function.  It doesn't
  take -funit-at-a-time to see when a static function which is defined
  before it is used doesn't return.  This application point also makes
  the syntax problems larger.  It is now natural to place the attribute
  declaration where it is, and there is a good chance that the old
  versions of gcc that didn't like it there also didn't like it being
  at the end.
The errexit() function has many style bugs:
- no prototype before the function.  This is not a large style bug.
  The function is unsorted before main() so that it can be its own
  protoype.  But this leaves no natural place to put the attribute.
- initialization in declaration - missing blank line after declarations
- garbage reason for existence of the function.  4.4BSD doesn't have
  the function or its style bugs, but just uses printf().  /bin/echo
  was optimized in FreeBSD to avoid using printf().  But with dynamic
  linkage, the space optimization is almost null, and with libc bloat
  for static linkage, the optimization doesn't work (/bin/echo has
  size 11K in my version of 5.2 where the bloat is smaller, but 415K
  in -current).
The main() function in echo/echo.c has rotted similarly.  To avoid
using printf() in a loop, it uses complicated allocation and writev().
This optimization is about 5% faster for 1 args created by $(jot
1 0), but most uses of echo are with only a couple of args.  With
10 args created by $(jot 10 0), the optimization is about 2% slower.

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: r287307 - head/sys/boot/fdt/dts/arm

2015-08-30 Thread Luiz Otavio O Souza
Author: loos
Date: Sun Aug 30 16:10:12 2015
New Revision: 287307
URL: https://svnweb.freebsd.org/changeset/base/287307

Log:
  Reduce the difference to vendor DTS by using the vendor compat strings (at
  some point we have to use the complete vendor DTS files, but we're not
  there yet).

Modified:
  head/sys/boot/fdt/dts/arm/bananapi.dts

Modified: head/sys/boot/fdt/dts/arm/bananapi.dts
==
--- head/sys/boot/fdt/dts/arm/bananapi.dts  Sun Aug 30 15:38:41 2015
(r287306)
+++ head/sys/boot/fdt/dts/arm/bananapi.dts  Sun Aug 30 16:10:12 2015
(r287307)
@@ -31,7 +31,8 @@
 /include/ sun7i-a20.dtsi
 
 / {
-   model = BananaPi;
+   model = LeMaker Banana Pi;
+   compatible = lemaker,bananapi, allwinner,sun7i-a20;
 
memory {
device_type = memory;
___
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: r287217 - head/usr.sbin/syslogd

2015-08-30 Thread Joerg Sonnenberger
On Sun, Aug 30, 2015 at 11:53:00AM +0200, Ed Schouten wrote:
 2015-08-28 16:38 GMT+02:00 Joerg Sonnenberger jo...@britannica.bec.de:
  But the compiler can't tell if it is the *intention* that the function
  never returns. The warning behavior exists because that can easily
  change with macros etc.
 
 I think it's important to keep in mind what this keyword was designed for.
 
 The idea behind this attribute (and the C11 _Noreturn keyword) is to
 allow for propagation of optimisation state across compilation units.
 You use it to annotate functions in header files, so that the compiler
 does not need to handle function return at the call site. This
 knowledge can be automatically be inferred if the function is static.

I disagree that optimisation is the primary design goal. Static analysis
and optimisation just have a huge overlap in this area.

 I agree with Bruce that this change makes little sense. I would even
 go as far as to say that GCC/Clang should just throw warnings if
 _Noreturn is used on a function that is static or used on a definition
 instead of a declaration.

That makes no sense. The presence of the attribute allows the compiler
to *ensure* that the function really does not return. Having done this
in NetBSD, I can assure you that there are often enough cases where the
compiler can not figure it out automatically, especially if the
attribution is missing on some function pulled in externally. GCC at
least up to 4.8 has not warned about such cases and I have multiple bugs
where function *could* fall through.

Joerg
___
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: r287316 - in head/sys: arm/conf boot/fdt/dts/arm

2015-08-30 Thread Luiz Otavio O Souza
Author: loos
Date: Sun Aug 30 23:20:00 2015
New Revision: 287316
URL: https://svnweb.freebsd.org/changeset/base/287316

Log:
  Add the LED definitions from vendor's DTS.
  
  Add gpioled support to A20 kernel.
  
  While here rename the gpio phandle to match the one used in the vendor's
  DTS.

Modified:
  head/sys/arm/conf/A20
  head/sys/boot/fdt/dts/arm/bananapi.dts
  head/sys/boot/fdt/dts/arm/cubieboard2.dts
  head/sys/boot/fdt/dts/arm/sun7i-a20.dtsi

Modified: head/sys/arm/conf/A20
==
--- head/sys/arm/conf/A20   Sun Aug 30 22:38:06 2015(r287315)
+++ head/sys/arm/conf/A20   Sun Aug 30 23:20:00 2015(r287316)
@@ -78,6 +78,7 @@ devicerandom  # Entropy device
 
 # GPIO
 device gpio
+device gpioled
 
 device scbus   # SCSI bus (required for ATA/SCSI)
 device da  # Direct Access (disks)

Modified: head/sys/boot/fdt/dts/arm/bananapi.dts
==
--- head/sys/boot/fdt/dts/arm/bananapi.dts  Sun Aug 30 22:38:06 2015
(r287315)
+++ head/sys/boot/fdt/dts/arm/bananapi.dts  Sun Aug 30 23:20:00 2015
(r287316)
@@ -30,6 +30,8 @@
 
 /include/ sun7i-a20.dtsi
 
+#include dt-bindings/gpio/gpio.h
+
 / {
model = LeMaker Banana Pi;
compatible = lemaker,bananapi, allwinner,sun7i-a20;
@@ -72,6 +74,15 @@
};
};
 
+   leds {
+   compatible = gpio-leds;
+
+   green {
+   label = bananapi:green:usr;
+   gpios = pio 7 24 GPIO_ACTIVE_HIGH;
+   };
+   };
+
chosen {
bootargs = -v;
stdin = UART0;

Modified: head/sys/boot/fdt/dts/arm/cubieboard2.dts
==
--- head/sys/boot/fdt/dts/arm/cubieboard2.dts   Sun Aug 30 22:38:06 2015
(r287315)
+++ head/sys/boot/fdt/dts/arm/cubieboard2.dts   Sun Aug 30 23:20:00 2015
(r287316)
@@ -30,6 +30,8 @@
 
 /include/ sun7i-a20.dtsi
 
+#include dt-bindings/gpio/gpio.h
+
 / {
model = Cubietech Cubieboard2;
 
@@ -70,6 +72,20 @@
};
};
 
+   leds {
+   compatible = gpio-leds;
+
+   blue {
+   label = cubieboard2:blue:usr;
+   gpios = pio 7 21 GPIO_ACTIVE_HIGH;
+   };
+
+   green {
+   label = cubieboard2:green:usr;
+   gpios = pio 7 20 GPIO_ACTIVE_HIGH;
+   };
+   };
+
chosen {
bootargs = -v;
stdin = UART0;

Modified: head/sys/boot/fdt/dts/arm/sun7i-a20.dtsi
==
--- head/sys/boot/fdt/dts/arm/sun7i-a20.dtsiSun Aug 30 22:38:06 2015
(r287315)
+++ head/sys/boot/fdt/dts/arm/sun7i-a20.dtsiSun Aug 30 23:20:00 2015
(r287316)
@@ -86,7 +86,7 @@
reg = 0x01c20c90 0x10;
};
 
-   GPIO: gpio@01c20800 {
+   pio: gpio@01c20800 {
#gpio-cells = 3;
compatible = allwinner,sun4i-gpio;
gpio-controller;
___
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: r287299 - head/sys/boot/efi/loader/arch/amd64

2015-08-30 Thread Marcel Moolenaar

 On Aug 30, 2015, at 11:27 AM, Rui Paulo rpa...@me.com wrote:
 
 On Sun, 2015-08-30 at 01:40 +, Marcel Moolenaar wrote:
 Author: marcel
 Date: Sun Aug 30 01:39:59 2015
 New Revision: 287299
 URL: https://svnweb.freebsd.org/changeset/base/287299
 
 Log:
  Add a gop command to help diagnose VT efifb problems. The gop
  command has the following sub-commands:
list  - list all possible modes (paged)
get   - return the current mode
set mode- set the current mode to mode
 
 
 This is duplicating the functionality of the `mode' command.  Please
 remove the mode command.

It doesn’t. The mode command works on text modes only. This
command works on the Graphics Output Protocol (GOP) modes.

 
 Also, 'gop' is pretty weird for a command name.  Maybe we can change
 that to something more user friendly?

Maybe.

--
Marcel Moolenaar
mar...@xcllnt.net





signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r287315 - head/sys/arm/allwinner

2015-08-30 Thread Luiz Otavio O Souza
Author: loos
Date: Sun Aug 30 22:38:06 2015
New Revision: 287315
URL: https://svnweb.freebsd.org/changeset/base/287315

Log:
  The vendor's DTS for Allwinner A20 uses a different way to map the gpio
  pins, they specify the bank and the pin in two separated cells.
  
  This allow the use of vendor's DTS definitions by adding a gpio map
  routine that copes with that.

Modified:
  head/sys/arm/allwinner/a10_gpio.c

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Sun Aug 30 21:55:01 2015
(r287314)
+++ head/sys/arm/allwinner/a10_gpio.c   Sun Aug 30 22:38:06 2015
(r287315)
@@ -449,6 +449,18 @@ a10_gpio_get_node(device_t dev, device_t
return (ofw_bus_get_node(dev));
 }
 
+static int
+a10_gpio_map_gpios(device_t bus, phandle_t dev, phandle_t gparent, int gcells,
+pcell_t *gpios, uint32_t *pin, uint32_t *flags)
+{
+
+   /* The GPIO pins are mapped as: gpio-phandle bank pin flags. */
+   *pin = gpios[0] * 32 + gpios[1];
+   *flags = gpios[gcells - 1];
+
+   return (0);
+}
+
 static device_method_t a10_gpio_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, a10_gpio_probe),
@@ -465,6 +477,7 @@ static device_method_t a10_gpio_methods[
DEVMETHOD(gpio_pin_get, a10_gpio_pin_get),
DEVMETHOD(gpio_pin_set, a10_gpio_pin_set),
DEVMETHOD(gpio_pin_toggle,  a10_gpio_pin_toggle),
+   DEVMETHOD(gpio_map_gpios,   a10_gpio_map_gpios),
 
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_node, a10_gpio_get_node),
___
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: r287317 - in head/sys/boot/efi: include loader/arch/amd64

2015-08-30 Thread Marcel Moolenaar
Author: marcel
Date: Sun Aug 30 23:58:53 2015
New Revision: 287317
URL: https://svnweb.freebsd.org/changeset/base/287317

Log:
  Add support for the UGA draw protocol. This includes adding a
  command called 'uga' to show whether UGA is implemented by the
  firmware and what the settings are. It also includes filling
  the efi_fb structure from the UGA information when GOP isn't
  implemented by the firmware.
  
  Since UGA does not provide information about the stride, we
  set the stride to the horizontal resolution. This is likely
  not correct and we should determine the stride by trial and
  error. For now, this should show something on the console
  rather than nothing.
  
  Refactor this file to maximize code reuse.
  
  PR:   202730

Added:
  head/sys/boot/efi/include/efipciio.h   (contents, props changed)
  head/sys/boot/efi/include/efiuga.h   (contents, props changed)
Modified:
  head/sys/boot/efi/loader/arch/amd64/framebuffer.c

Added: head/sys/boot/efi/include/efipciio.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/efi/include/efipciio.hSun Aug 30 23:58:53 2015
(r287317)
@@ -0,0 +1,559 @@
+/* $FreeBSD$ */
+/** @file
+  EFI PCI I/O Protocol provides the basic Memory, I/O, PCI configuration, 
+  and DMA interfaces that a driver uses to access its PCI controller.
+
+  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.BR
+  This program and the accompanying materials  
+  are licensed and made available under the terms and conditions of the BSD 
License 
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php   
 
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN AS IS BASIS,
 
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED. 
+
+**/
+
+#ifndef __PCI_IO_H__
+#define __PCI_IO_H__
+
+///
+/// Global ID for the PCI I/O Protocol
+///
+#define EFI_PCI_IO_PROTOCOL_GUID \
+  { \
+0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a 
} \
+  }
+
+typedef struct _EFI_PCI_IO_PROTOCOL  EFI_PCI_IO_PROTOCOL;
+
+///
+/// ***
+/// EFI_PCI_IO_PROTOCOL_WIDTH
+/// ***
+///
+typedef enum {
+  EfiPciIoWidthUint8  = 0,
+  EfiPciIoWidthUint16,
+  EfiPciIoWidthUint32,
+  EfiPciIoWidthUint64,
+  EfiPciIoWidthFifoUint8,
+  EfiPciIoWidthFifoUint16,
+  EfiPciIoWidthFifoUint32,
+  EfiPciIoWidthFifoUint64,
+  EfiPciIoWidthFillUint8,
+  EfiPciIoWidthFillUint16,
+  EfiPciIoWidthFillUint32,
+  EfiPciIoWidthFillUint64,
+  EfiPciIoWidthMaximum
+} EFI_PCI_IO_PROTOCOL_WIDTH;
+
+//
+// Complete PCI address generater
+//
+#define EFI_PCI_IO_PASS_THROUGH_BAR   0xff/// Special BAR 
that passes a memory or I/O cycle through unchanged
+#define EFI_PCI_IO_ATTRIBUTE_MASK 0x077f  /// All the 
following I/O and Memory cycles
+#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO   0x0001  /// I/O cycles 
0x-0x00FF (10 bit decode)
+#define EFI_PCI_IO_ATTRIBUTE_ISA_IO   0x0002  /// I/O cycles 
0x0100-0x03FF or greater (10 bit decode)
+#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO   0x0004  /// I/O cycles 
0x3C6, 0x3C8, 0x3C9 (10 bit decode)
+#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY   0x0008  /// MEM cycles 
0xA-0xB (24 bit decode)
+#define EFI_PCI_IO_ATTRIBUTE_VGA_IO   0x0010  /// I/O cycles 
0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode)
+#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO   0x0020  /// I/O cycles 
0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode)
+#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040  /// I/O cycles 
0x170-0x177, 0x376, 0x377 (10 bit decode)
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080  /// Map a memory 
range so writes are combined
+#define EFI_PCI_IO_ATTRIBUTE_IO   0x0100  /// Enable the I/O 
decode bit in the PCI Config Header
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY   0x0200  /// Enable the 
Memory decode bit in the PCI Config Header
+#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER   0x0400  /// Enable the DMA 
bit in the PCI Config Header
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED0x0800  /// Map a memory 
range so all r/w accesses are cached
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE   0x1000  /// Disable a 
memory range
+#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE  0x2000  /// Clear for an 
add-in PCI Device
+#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000  /// Clear for a 
physical PCI Option ROM accessed through ROM BAR
+#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE   0x8000  /// Clear for PCI 
controllers that can not genrate a DAC
+#define 

svn commit: r287319 - head/usr.bin/iconv

2015-08-30 Thread Xin LI
Author: delphij
Date: Mon Aug 31 05:57:26 2015
New Revision: 287319
URL: https://svnweb.freebsd.org/changeset/base/287319

Log:
  Constify opt_f and opt_t and eliminate unneeded copying.  This fixes
  memory leaks.
  
  Reported by:  clang static analyzer
  MFC after:2 weeks

Modified:
  head/usr.bin/iconv/iconv.c

Modified: head/usr.bin/iconv/iconv.c
==
--- head/usr.bin/iconv/iconv.c  Mon Aug 31 05:03:36 2015(r287318)
+++ head/usr.bin/iconv/iconv.c  Mon Aug 31 05:57:26 2015(r287319)
@@ -156,11 +156,11 @@ int
 main(int argc, char **argv)
 {
FILE *fp;
-   char *opt_f, *opt_t;
+   const char *opt_f, *opt_t;
int ch, i, res;
bool opt_c = false, opt_s = false;
 
-   opt_f = opt_t = strdup("");
+   opt_f = opt_t = "";
 
setlocale(LC_ALL, "");
setprogname(argv[0]);
@@ -186,12 +186,12 @@ main(int argc, char **argv)
case 'f':
/* from */
if (optarg != NULL)
-   opt_f = strdup(optarg);
+   opt_f = optarg;
break;
case 't':
/* to */
if (optarg != NULL)
-   opt_t = strdup(optarg);
+   opt_t = optarg;
break;
default:
usage();
___
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: r287318 - in head/sys: net netinet6

2015-08-30 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Aug 31 05:03:36 2015
New Revision: 287318
URL: https://svnweb.freebsd.org/changeset/base/287318

Log:
  Simplify lla_rt_output()/nd6_add_ifa_lle() by setting lle state in
alloc handler, based on flags.

Modified:
  head/sys/net/if_llatbl.c
  head/sys/netinet6/in6.c
  head/sys/netinet6/nd6.c

Modified: head/sys/net/if_llatbl.c
==
--- head/sys/net/if_llatbl.cSun Aug 30 23:58:53 2015(r287317)
+++ head/sys/net/if_llatbl.cMon Aug 31 05:03:36 2015(r287318)
@@ -592,7 +592,10 @@ lla_rt_output(struct rt_msghdr *rtm, str
switch (rtm-rtm_type) {
case RTM_ADD:
/* Add static LLE */
-   lle = lltable_alloc_entry(llt, 0, dst);
+   laflags = 0;
+   if (rtm-rtm_rmx.rmx_expire == 0)
+   laflags = LLE_STATIC;
+   lle = lltable_alloc_entry(llt, laflags, dst);
if (lle == NULL)
return (ENOMEM);
 
@@ -600,22 +603,8 @@ lla_rt_output(struct rt_msghdr *rtm, str
if ((rtm-rtm_flags  RTF_ANNOUNCE))
lle-la_flags |= LLE_PUB;
lle-la_flags |= LLE_VALID;
-#ifdef INET6
-   /*
-* ND6
-*/
-   if (dst-sa_family == AF_INET6)
-   lle-ln_state = ND6_LLINFO_REACHABLE;
-#endif
-   /*
-* NB: arp and ndp always set (RTF_STATIC | RTF_HOST)
-*/
+   lle-la_expire = rtm-rtm_rmx.rmx_expire;
 
-   if (rtm-rtm_rmx.rmx_expire == 0) {
-   lle-la_flags |= LLE_STATIC;
-   lle-la_expire = 0;
-   } else
-   lle-la_expire = rtm-rtm_rmx.rmx_expire;
laflags = lle-la_flags;
 
/* Try to link new entry */

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Sun Aug 30 23:58:53 2015(r287317)
+++ head/sys/netinet6/in6.c Mon Aug 31 05:03:36 2015(r287318)
@@ -2264,6 +2264,9 @@ in6_lltable_alloc(struct lltable *llt, u
lle-la_flags |= (LLE_VALID | LLE_STATIC);
}
 
+   if ((lle-la_flags  LLE_STATIC) != 0)
+   lle-ln_state = ND6_LLINFO_REACHABLE;
+
return (lle);
 }
 

Modified: head/sys/netinet6/nd6.c
==
--- head/sys/netinet6/nd6.c Sun Aug 30 23:58:53 2015(r287317)
+++ head/sys/netinet6/nd6.c Mon Aug 31 05:03:36 2015(r287318)
@@ -2275,9 +2275,6 @@ nd6_add_ifa_lle(struct in6_ifaddr *ia)
if (ln == NULL)
return (ENOBUFS);
 
-   ln-la_expire = 0;  /* for IPv6 this means permanent */
-   ln-ln_state = ND6_LLINFO_REACHABLE;
-
IF_AFDATA_WLOCK(ifp);
LLE_WLOCK(ln);
/* Unlink any entry if exists */
___
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