From owner-svn-src-head@freebsd.org Mon Mar 28 04:22:23 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94484AE065E; Mon, 28 Mar 2016 04:22:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C7131319; Mon, 28 Mar 2016 04:22:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2S4MM0e012242; Mon, 28 Mar 2016 04:22:22 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2S4MMRH012240; Mon, 28 Mar 2016 04:22:22 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201603280422.u2S4MMRH012240@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 28 Mar 2016 04:22:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297331 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Mar 2016 04:22:23 -0000 Author: imp Date: Mon Mar 28 04:22:22 2016 New Revision: 297331 URL: https://svnweb.freebsd.org/changeset/base/297331 Log: Sometimes, it's useful to export the entire line to an external program without listening to the devd socket for all events. Define two new pseudo variables $*, the entire event from devctl and $_, the entire event without the type character, since it might be easier to use in some circumstances. Modified: head/sbin/devd/devd.cc head/sbin/devd/devd.conf.5 Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Mon Mar 28 02:05:35 2016 (r297330) +++ head/sbin/devd/devd.cc Mon Mar 28 04:22:22 2016 (r297331) @@ -648,8 +648,8 @@ config::expand_one(const char *&src, str return; } - // $[^A-Za-z] -> $\1 - if (!isalpha(*src)) { + // $[^-A-Za-z_*] -> $\1 + if (!isalpha(*src) && *src != '_' && *src != '-' && *src != '*') { dst += '$'; dst += *src++; return; @@ -793,10 +793,15 @@ process_event(char *buffer) devdlog(LOG_INFO, "Processing event '%s'\n", buffer); type = *buffer++; cfg.push_var_table(); + // $* is the entire line + cfg.set_variable("*", buffer - 1); + // $_ is the entire line without the initial character + cfg.set_variable("_", buffer - 1); // No match doesn't have a device, and the format is a little // different, so handle it separately. switch (type) { case notify: + //! (k=v)* sp = cfg.set_vars(sp); break; case nomatch: Modified: head/sbin/devd/devd.conf.5 ============================================================================== --- head/sbin/devd/devd.conf.5 Mon Mar 28 02:05:35 2016 (r297330) +++ head/sbin/devd/devd.conf.5 Mon Mar 28 04:22:22 2016 (r297331) @@ -41,7 +41,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd July 11, 2015 +.Dd March 28, 2016 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -234,10 +234,17 @@ A partial list of variables and their po with the .Ic match statement. +The variables are published by the bus based on characteristics of the device +that generated the event (for device events). +Variables for other classes of events are dependent on those events. .Pp .Bl -tag -width ".Li manufacturer" -compact .It Ic Variable .Ic Description +.It Li * +The entire message from the current event +.It Li _ +The entire message from the current event, after the initial type character .It Li bus Device name of parent bus. .It Li cdev