Re: CVS commit: src/sbin/devpubd/hooks
Sorry, no idea what happened with that. And thanks Martin for fixing it. kre
CVS commit: src/sbin/devpubd/hooks
Module Name:src Committed By: martin Date: Sun Aug 8 10:48:35 UTC 2021 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: Fix obvious editor mishap in previous To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/hooks/02-wedgenames diff -u src/sbin/devpubd/hooks/02-wedgenames:1.7 src/sbin/devpubd/hooks/02-wedgenames:1.8 --- src/sbin/devpubd/hooks/02-wedgenames:1.7 Thu Aug 5 12:52:47 2021 +++ src/sbin/devpubd/hooks/02-wedgenames Sun Aug 8 10:48:35 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: 02-wedgenames,v 1.7 2021/08/05 12:52:47 kre Exp $ +# $NetBSD: 02-wedgenames,v 1.8 2021/08/08 10:48:35 martin Exp $ # # Try to maintain symlinks to wedge devices # @@ -160,4 +160,4 @@ for device do esac ;; esac -ce-attach +done
CVS commit: src/sbin/devpubd/hooks
Module Name:src Committed By: martin Date: Sun Aug 8 10:48:35 UTC 2021 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: Fix obvious editor mishap in previous To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sbin/devpubd/hooks
The script no longer works: Starting devpubd. /libexec/devpubd-hooks/02-wedgenames: 164: Syntax error: end of file unexpected (expecting "done") Take care, Jared On Thu, 5 Aug 2021, Robert Elz wrote: Module Name:src Committed By: kre Date: Thu Aug 5 12:52:47 UTC 2021 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: Obliterate bogus $@ usage. While here, fix some quoting, change some style, and attempt to properly handle wedge names with embedded newlines, and those that end with a '/' character (not particularly happy with the solution to that last one, but it is better than it was). Is there a reason that characters that need encoding in wedge names (white space, and more) are encoded as %%XX (XX is the hex value of the char - but 2 % chars? Why?). That remains unchanged, but as the script already relied upon sh's $'...' quoting, I think we can rely upon printf as well, so replace the old (very elegant, but slow) encoding function with a much simpler one (does the same thing). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd/hooks
Module Name:src Committed By: kre Date: Thu Aug 5 12:52:47 UTC 2021 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: Obliterate bogus $@ usage. While here, fix some quoting, change some style, and attempt to properly handle wedge names with embedded newlines, and those that end with a '/' character (not particularly happy with the solution to that last one, but it is better than it was). Is there a reason that characters that need encoding in wedge names (white space, and more) are encoded as %%XX (XX is the hex value of the char - but 2 % chars? Why?). That remains unchanged, but as the script already relied upon sh's $'...' quoting, I think we can rely upon printf as well, so replace the old (very elegant, but slow) encoding function with a much simpler one (does the same thing). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/hooks/02-wedgenames diff -u src/sbin/devpubd/hooks/02-wedgenames:1.6 src/sbin/devpubd/hooks/02-wedgenames:1.7 --- src/sbin/devpubd/hooks/02-wedgenames:1.6 Sat Jan 9 16:25:19 2021 +++ src/sbin/devpubd/hooks/02-wedgenames Thu Aug 5 12:52:47 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: 02-wedgenames,v 1.6 2021/01/09 16:25:19 mlelstv Exp $ +# $NetBSD: 02-wedgenames,v 1.7 2021/08/05 12:52:47 kre Exp $ # # Try to maintain symlinks to wedge devices # @@ -9,16 +9,15 @@ export LC_ALL=C event="$1" shift -devices=$@ wedgedir=/dev/wedges recurse() { - test -d "$1" && ls -1af "$1" \ - | while read n; do + test -d "$1" && + ls -1af "$1" | while read n; do case $n in - .|..) ;; + .|..) ;; *) echo "$1/$n" if [ -L "$1/$n" ]; then @@ -28,7 +27,7 @@ recurse() fi ;; esac - done + done } simple_readlink() @@ -41,43 +40,49 @@ simple_readlink() esac } -ordtable=$( - for n1 in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do - for n2 in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do - echo "\$'\x$n1$n2') x=$n1$n2;;" - done - done -) +#ordtable=$( +# for n1 in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do +# for n2 in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do +# echo "\$'\x$n1$n2') x=$n1$n2;;" +# done +# done +#) +# +#ord() +#{ +# local x +# eval "case \$1 in $ordtable esac" +# echo -n $x +#} ord() { - local x - eval "case \$1 in $ordtable esac" - echo -n $x + printf %2.2x "'$1" } encode() { - local a + local a b c a=$1 + b= while [ -n "$a" ]; do c="${a%"${a#?}"}" a=${a#?} case $c in - [[:alnum:]._:\;!^$\&~\(\)[\]{}=,+\-/]) + [][:alnum:]._:\;!^$\&~\(\)[{}=,+/-]) ;; *) - c='%%'$(ord "$c") + c=%%$(ord "$c") ;; esac - echo -n "$c" + b=${b}${c} done + printf %s "$b" } remove_wedge() { - recurse "$wedgedir" \ - | while read w; do + recurse "$wedgedir" | while read w; do t=$(simple_readlink "$w") if [ x"$t" = x"/dev/$1" ]; then rm -f "$w" @@ -87,43 +92,72 @@ remove_wedge() { done } +wedge_label() { + local l + + # dkctl getwedgeinfo always outputs 2 "lines", the first + # contains the label (and may contain embedded \n chars) + # the second contains the size, offset, and type, and one + # trailing \n (stripped by the $()) - so we can safely + # extract the label by deleting from the final \n in the + # value getwedgeinfo prints to the end + + l=$(dkctl "$1" getwedgeinfo) + l=${l%$'\n'*} + case "${l}" in + $1' at '*': '*) + l=${l#*: } + ;; + *) + l=$1 + ;; + esac + + # The trailing is to ensure a trailing \n in the label + # is not deleted by a command substitution which invokes us. + # That will be rmeoved by the caller. + printf %s "${l}" +} + add_wedge() { - dkctl "$1" getwedgeinfo \ - | while read l; do - case $l in - *': '*) - n="${l#*: }" - n=$(encode "$n") - test -d $wedgedir || mkdir -m 755 $wedgedir - basedir="$wedgedir/$n" - basedir=${basedir%/*} - test -d "$basedir" || mkdir -p -m 755 "$basedir" - if oldlink=$(simple_readlink "$wedgedir/$n"); then -if [ x"$oldlink" != x"/dev/$1" ]; then - rm -f "$wedgedir/$n" - ln -s "/dev/$1" "$wedgedir/$n" -fi - else + local l n + + l=$(wedge_label "$1") + l=${l%''} + case "$l" in */) l="${l}Wedge";; esac + + n=$(encode "${l}") + + ( + umask 022 + + test -d "$wedgedir" || mkdir -m 755 "$wedgedir" + basedir="$wedgedir/$n" + basedir=${basedir%/*} + test -d "$basedir" || mkdir -p -m 755 "$basedir" + if oldlink=$(simple_readlink "$wedgedir/$n"); then + if [ x"$oldlink" != x"/dev/$1" ]; then +rm -f "$wedgedir/$n" ln -s "/dev/$1" "$wedgedir/$n" fi - ;; - esac - break - done + else + ln -s "/dev/$1" "$wedgedir/$n" + fi + ) } -for device in $devices; do +for device do case $device in dk*) case $event in device-attach) - remove_wedge $device - add_wedge $device + remove_wedge "$device" + add_wedge "$device" ;; device-detach) -
CVS commit: src/sbin/devpubd/hooks
Module Name:src Committed By: kre Date: Thu Aug 5 12:52:47 UTC 2021 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: Obliterate bogus $@ usage. While here, fix some quoting, change some style, and attempt to properly handle wedge names with embedded newlines, and those that end with a '/' character (not particularly happy with the solution to that last one, but it is better than it was). Is there a reason that characters that need encoding in wedge names (white space, and more) are encoded as %%XX (XX is the hex value of the char - but 2 % chars? Why?). That remains unchanged, but as the script already relied upon sh's $'...' quoting, I think we can rely upon printf as well, so replace the old (very elegant, but slow) encoding function with a much simpler one (does the same thing). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd
Module Name:src Committed By: kre Date: Thu Aug 5 12:45:33 UTC 2021 Modified Files: src/sbin/devpubd: devpubd-run-hooks.in src/sbin/devpubd/hooks: 01-makedev Log Message: Expunge bogus (implementation defined / unspecified) uses of $@ in scripts. $@ is unspecified except when used in a place where field splitting can occur (which is never in an assignment), X=$@ (with or without double quotes) is simply wrong. Use $* instead of $@ in such places, or as here, simply change the way things are done (very very slightly) and DTRT. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sbin/devpubd/devpubd-run-hooks.in cvs rdiff -u -r1.2 -r1.3 src/sbin/devpubd/hooks/01-makedev Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/devpubd-run-hooks.in diff -u src/sbin/devpubd/devpubd-run-hooks.in:1.3 src/sbin/devpubd/devpubd-run-hooks.in:1.4 --- src/sbin/devpubd/devpubd-run-hooks.in:1.3 Sun Feb 15 15:56:30 2015 +++ src/sbin/devpubd/devpubd-run-hooks.in Thu Aug 5 12:45:33 2021 @@ -1,19 +1,19 @@ #!/bin/sh # -# $NetBSD: devpubd-run-hooks.in,v 1.3 2015/02/15 15:56:30 jmcneill Exp $ +# $NetBSD: devpubd-run-hooks.in,v 1.4 2021/08/05 12:45:33 kre Exp $ # # devpubd run hooks devpubd_event=$1 shift -devpubd_devices=$@ + devpubd_hooks_base=@HOOKSDIR@ case $devpubd_event in device-attach|device-detach) for hook in ${devpubd_hooks_base}/*; do if [ -x "${hook}" ]; then - "${hook}" ${devpubd_event} ${devpubd_devices} + "${hook}" ${devpubd_event} "$@" fi done ;; Index: src/sbin/devpubd/hooks/01-makedev diff -u src/sbin/devpubd/hooks/01-makedev:1.2 src/sbin/devpubd/hooks/01-makedev:1.3 --- src/sbin/devpubd/hooks/01-makedev:1.2 Sun Feb 15 15:56:30 2015 +++ src/sbin/devpubd/hooks/01-makedev Thu Aug 5 12:45:33 2021 @@ -1,16 +1,15 @@ #!/bin/sh # -# $NetBSD: 01-makedev,v 1.2 2015/02/15 15:56:30 jmcneill Exp $ +# $NetBSD: 01-makedev,v 1.3 2021/08/05 12:45:33 kre Exp $ # # Try to create a device node if it doesn't exist # event="$1" shift -devices=$@ case $event in device-attach) - cd /dev && sh MAKEDEV -u $devices 2>/dev/null + cd /dev && sh MAKEDEV -u "$@" 2>/dev/null ;; esac
CVS commit: src/sbin/devpubd
Module Name:src Committed By: kre Date: Thu Aug 5 12:45:33 UTC 2021 Modified Files: src/sbin/devpubd: devpubd-run-hooks.in src/sbin/devpubd/hooks: 01-makedev Log Message: Expunge bogus (implementation defined / unspecified) uses of $@ in scripts. $@ is unspecified except when used in a place where field splitting can occur (which is never in an assignment), X=$@ (with or without double quotes) is simply wrong. Use $* instead of $@ in such places, or as here, simply change the way things are done (very very slightly) and DTRT. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sbin/devpubd/devpubd-run-hooks.in cvs rdiff -u -r1.2 -r1.3 src/sbin/devpubd/hooks/01-makedev Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd
Module Name:src Committed By: christos Date: Mon Jun 21 03:14:12 UTC 2021 Modified Files: src/sbin/devpubd: devpubd.c Log Message: fix proplib deprecation To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/devpubd/devpubd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/devpubd.c diff -u src/sbin/devpubd/devpubd.c:1.6 src/sbin/devpubd/devpubd.c:1.7 --- src/sbin/devpubd/devpubd.c:1.6 Mon Feb 24 06:45:30 2020 +++ src/sbin/devpubd/devpubd.c Sun Jun 20 23:14:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: devpubd.c,v 1.6 2020/02/24 11:45:30 mlelstv Exp $ */ +/* $NetBSD: devpubd.c,v 1.7 2021/06/21 03:14:12 christos Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill @@ -36,7 +36,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2011-2015\ Jared D. McNeill . All rights reserved."); -__RCSID("$NetBSD: devpubd.c,v 1.6 2020/02/24 11:45:30 mlelstv Exp $"); +__RCSID("$NetBSD: devpubd.c,v 1.7 2021/06/21 03:14:12 christos Exp $"); #include #include @@ -144,8 +144,8 @@ devpubd_eventloop(void) res = prop_dictionary_recv_ioctl(drvctl_fd, DRVGETEVENT, ); if (res) err(EXIT_FAILURE, "DRVGETEVENT failed"); - prop_dictionary_get_cstring_nocopy(ev, "event", ); - prop_dictionary_get_cstring_nocopy(ev, "device", [0]); + prop_dictionary_get_string(ev, "event", ); + prop_dictionary_get_string(ev, "device", [0]); printf("%s: event='%s', device='%s'\n", __func__, event, device[0]);
CVS commit: src/sbin/devpubd
Module Name:src Committed By: christos Date: Mon Jun 21 03:14:12 UTC 2021 Modified Files: src/sbin/devpubd: devpubd.c Log Message: fix proplib deprecation To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/devpubd/devpubd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd/hooks
Module Name:src Committed By: mlelstv Date: Sat Jan 9 16:25:19 UTC 2021 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: Also replace calls to dirname. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/hooks/02-wedgenames diff -u src/sbin/devpubd/hooks/02-wedgenames:1.5 src/sbin/devpubd/hooks/02-wedgenames:1.6 --- src/sbin/devpubd/hooks/02-wedgenames:1.5 Sat Jan 9 14:00:05 2021 +++ src/sbin/devpubd/hooks/02-wedgenames Sat Jan 9 16:25:19 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: 02-wedgenames,v 1.5 2021/01/09 14:00:05 mlelstv Exp $ +# $NetBSD: 02-wedgenames,v 1.6 2021/01/09 16:25:19 mlelstv Exp $ # # Try to maintain symlinks to wedge devices # @@ -81,7 +81,7 @@ remove_wedge() { t=$(simple_readlink "$w") if [ x"$t" = x"/dev/$1" ]; then rm -f "$w" - basedir=$(dirname "$w") + basedir=${w%/*} rmdir -p "$basedir" 2>/dev/null fi done @@ -95,7 +95,8 @@ add_wedge() { n="${l#*: }" n=$(encode "$n") test -d $wedgedir || mkdir -m 755 $wedgedir - basedir=$(dirname "$wedgedir/$n") + basedir="$wedgedir/$n" + basedir=${basedir%/*} test -d "$basedir" || mkdir -p -m 755 "$basedir" if oldlink=$(simple_readlink "$wedgedir/$n"); then if [ x"$oldlink" != x"/dev/$1" ]; then
CVS commit: src/sbin/devpubd/hooks
Module Name:src Committed By: mlelstv Date: Sat Jan 9 16:25:19 UTC 2021 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: Also replace calls to dirname. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd/hooks
Module Name:src Committed By: mlelstv Date: Sat Jan 9 14:00:05 UTC 2021 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: Remove need for awk/sed/readlink tools. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/hooks/02-wedgenames diff -u src/sbin/devpubd/hooks/02-wedgenames:1.4 src/sbin/devpubd/hooks/02-wedgenames:1.5 --- src/sbin/devpubd/hooks/02-wedgenames:1.4 Mon Aug 15 12:54:40 2016 +++ src/sbin/devpubd/hooks/02-wedgenames Sat Jan 9 14:00:05 2021 @@ -1,21 +1,84 @@ #!/bin/sh # -# $NetBSD: 02-wedgenames,v 1.4 2016/08/15 12:54:40 mlelstv Exp $ +# $NetBSD: 02-wedgenames,v 1.5 2021/01/09 14:00:05 mlelstv Exp $ # # Try to maintain symlinks to wedge devices # +export LC_ALL=C + event="$1" shift devices=$@ wedgedir=/dev/wedges +recurse() +{ + test -d "$1" && ls -1af "$1" \ + | while read n; do + case $n in + .|..) ;; + *) + echo "$1/$n" + if [ -L "$1/$n" ]; then +: #nothing + elif [ -d "$1/$n" ]; then +recurse "$1/$n" + fi + ;; + esac + done +} + +simple_readlink() +{ + local x + + x=$(test -e "$1" && ls -ld "$1") + case $x in + *'-> '*) echo ${x#*-> };; + esac +} + +ordtable=$( + for n1 in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do + for n2 in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do + echo "\$'\x$n1$n2') x=$n1$n2;;" + done + done +) + +ord() +{ + local x + eval "case \$1 in $ordtable esac" + echo -n $x +} + +encode() +{ + local a + + a=$1 + while [ -n "$a" ]; do + c="${a%"${a#?}"}" + a=${a#?} + case $c in + [[:alnum:]._:\;!^$\&~\(\)[\]{}=,+\-/]) + ;; + *) + c='%%'$(ord "$c") + ;; + esac + echo -n "$c" + done +} + remove_wedge() { - test -d $wedgedir && find $wedgedir -print \ - | sed -e 's# #\\ #g' \ + recurse "$wedgedir" \ | while read w; do - t=$(readlink "$w") + t=$(simple_readlink "$w") if [ x"$t" = x"/dev/$1" ]; then rm -f "$w" basedir=$(dirname "$w") @@ -25,43 +88,27 @@ remove_wedge() { } add_wedge() { - n=$(dkctl "$1" getwedgeinfo \ - | sed -ne '1s#^[^:]*: ##p' \ - | awk -v GOOD='._:;!^$&~()[]{}=,+-/' ' - BEGIN { - for (i=0; i<256; ++i) -ord[sprintf("%c",i)] = i - } - { - n = length($0) - o = "" - for (i=1; i<=n; ++i) { -c = substr($0,i,1) -if (c ~ /^[[:alnum:]]$/ || index(GOOD,c) > 0) { - o = o c -} else { - o = o sprintf("%%%02x",ord[c]) -} - } - printf "%s",o - }' - ) - case $n in - "") ;; - *) - test -d $wedgedir || mkdir -m 755 $wedgedir - basedir=$(dirname "$wedgedir/$n") - test -d "$basedir" || mkdir -p -m 755 "$basedir" - if oldlink=$(readlink "$wedgedir/$n"); then - if [ x"$oldlink" != "/dev/$1" ]; then -rm -f "$wedgedir/$n" + dkctl "$1" getwedgeinfo \ + | while read l; do + case $l in + *': '*) + n="${l#*: }" + n=$(encode "$n") + test -d $wedgedir || mkdir -m 755 $wedgedir + basedir=$(dirname "$wedgedir/$n") + test -d "$basedir" || mkdir -p -m 755 "$basedir" + if oldlink=$(simple_readlink "$wedgedir/$n"); then +if [ x"$oldlink" != x"/dev/$1" ]; then + rm -f "$wedgedir/$n" + ln -s "/dev/$1" "$wedgedir/$n" +fi + else ln -s "/dev/$1" "$wedgedir/$n" fi - else - ln -s "/dev/$1" "$wedgedir/$n" - fi - ;; - esac + ;; + esac + break + done } for device in $devices; do
CVS commit: src/sbin/devpubd/hooks
Module Name:src Committed By: mlelstv Date: Sat Jan 9 14:00:05 UTC 2021 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: Remove need for awk/sed/readlink tools. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd
Module Name:src Committed By: wiz Date: Mon Feb 24 11:59:33 UTC 2020 Modified Files: src/sbin/devpubd: devpubd.8 Log Message: New sentence, new line. Bump date for previous. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/devpubd/devpubd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/devpubd.8 diff -u src/sbin/devpubd/devpubd.8:1.6 src/sbin/devpubd/devpubd.8:1.7 --- src/sbin/devpubd/devpubd.8:1.6 Mon Feb 24 11:45:30 2020 +++ src/sbin/devpubd/devpubd.8 Mon Feb 24 11:59:33 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: devpubd.8,v 1.6 2020/02/24 11:45:30 mlelstv Exp $ +.\" $NetBSD: devpubd.8,v 1.7 2020/02/24 11:59:33 wiz Exp $ .\" .\" Copyright (c) 2011-2013 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd September 11, 2016 +.Dd February 24, 2020 .Dt DEVPUBD 8 .Os .Sh NAME @@ -48,7 +48,8 @@ When .Fl f is specified, .Nm -does not go into the background. With the option +does not go into the background. +With the option .Fl 1 it will also exit after the initial setup of device nodes. .Pp
CVS commit: src/sbin/devpubd
Module Name:src Committed By: wiz Date: Mon Feb 24 11:59:33 UTC 2020 Modified Files: src/sbin/devpubd: devpubd.8 Log Message: New sentence, new line. Bump date for previous. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/devpubd/devpubd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd
Module Name:src Committed By: mlelstv Date: Mon Feb 24 11:45:30 UTC 2020 Modified Files: src/sbin/devpubd: devpubd.8 devpubd.c Log Message: Add one-shot mode. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sbin/devpubd/devpubd.8 \ src/sbin/devpubd/devpubd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd
Module Name:src Committed By: mlelstv Date: Mon Feb 24 11:45:30 UTC 2020 Modified Files: src/sbin/devpubd: devpubd.8 devpubd.c Log Message: Add one-shot mode. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sbin/devpubd/devpubd.8 \ src/sbin/devpubd/devpubd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/devpubd.8 diff -u src/sbin/devpubd/devpubd.8:1.5 src/sbin/devpubd/devpubd.8:1.6 --- src/sbin/devpubd/devpubd.8:1.5 Sun Sep 11 01:38:00 2016 +++ src/sbin/devpubd/devpubd.8 Mon Feb 24 11:45:30 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: devpubd.8,v 1.5 2016/09/11 01:38:00 sevan Exp $ +.\" $NetBSD: devpubd.8,v 1.6 2020/02/24 11:45:30 mlelstv Exp $ .\" .\" Copyright (c) 2011-2013 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -35,7 +35,7 @@ .Nd device publish daemon for automatic device node creation .Sh SYNOPSIS .Nm -.Op Fl f +.Op Fl 1f .Sh DESCRIPTION .Nm listens on @@ -48,7 +48,9 @@ When .Fl f is specified, .Nm -does not go into the background. +does not go into the background. With the option +.Fl 1 +it will also exit after the initial setup of device nodes. .Pp .Nm runs Index: src/sbin/devpubd/devpubd.c diff -u src/sbin/devpubd/devpubd.c:1.5 src/sbin/devpubd/devpubd.c:1.6 --- src/sbin/devpubd/devpubd.c:1.5 Thu Feb 6 19:20:21 2020 +++ src/sbin/devpubd/devpubd.c Mon Feb 24 11:45:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: devpubd.c,v 1.5 2020/02/06 19:20:21 kamil Exp $ */ +/* $NetBSD: devpubd.c,v 1.6 2020/02/24 11:45:30 mlelstv Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill @@ -36,7 +36,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2011-2015\ Jared D. McNeill . All rights reserved."); -__RCSID("$NetBSD: devpubd.c,v 1.5 2020/02/06 19:20:21 kamil Exp $"); +__RCSID("$NetBSD: devpubd.c,v 1.6 2020/02/24 11:45:30 mlelstv Exp $"); #include #include @@ -252,7 +252,7 @@ devpubd_init(void) __dead static void usage(void) { - fprintf(stderr, "usage: %s [-f]\n", getprogname()); + fprintf(stderr, "usage: %s [-1f]\n", getprogname()); exit(EXIT_FAILURE); } @@ -260,12 +260,17 @@ int main(int argc, char *argv[]) { bool fflag = false; + bool once = false; int ch; setprogname(argv[0]); - while ((ch = getopt(argc, argv, "fh")) != -1) { + while ((ch = getopt(argc, argv, "1fh")) != -1) { switch (ch) { + case '1': + fflag = true; + once = true; + break; case 'f': fflag = true; break; @@ -295,7 +300,8 @@ main(int argc, char *argv[]) } } - devpubd_eventloop(); + if (!once) + devpubd_eventloop(); return EXIT_SUCCESS; }
CVS commit: src/sbin/devpubd
Module Name:src Committed By: kamil Date: Thu Feb 6 19:20:21 UTC 2020 Modified Files: src/sbin/devpubd: devpubd.c Log Message: Stop including unused header To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/devpubd/devpubd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd
Module Name:src Committed By: kamil Date: Thu Feb 6 19:20:21 UTC 2020 Modified Files: src/sbin/devpubd: devpubd.c Log Message: Stop including unused header To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/devpubd/devpubd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/devpubd.c diff -u src/sbin/devpubd/devpubd.c:1.4 src/sbin/devpubd/devpubd.c:1.5 --- src/sbin/devpubd/devpubd.c:1.4 Sun Feb 15 21:46:49 2015 +++ src/sbin/devpubd/devpubd.c Thu Feb 6 19:20:21 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: devpubd.c,v 1.4 2015/02/15 21:46:49 christos Exp $ */ +/* $NetBSD: devpubd.c,v 1.5 2020/02/06 19:20:21 kamil Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill @@ -36,14 +36,13 @@ #include __COPYRIGHT("@(#) Copyright (c) 2011-2015\ Jared D. McNeill . All rights reserved."); -__RCSID("$NetBSD: devpubd.c,v 1.4 2015/02/15 21:46:49 christos Exp $"); +__RCSID("$NetBSD: devpubd.c,v 1.5 2020/02/06 19:20:21 kamil Exp $"); #include #include #include #include #include -#include #include #include
CVS commit: src/sbin/devpubd
Module Name:src Committed By: sevan Date: Sun Sep 11 01:38:00 UTC 2016 Modified Files: src/sbin/devpubd: devpubd.8 Log Message: Document the version devpubd first appeared. Bump date. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/devpubd/devpubd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd/hooks
Module Name:src Committed By: mlelstv Date: Mon Aug 15 12:54:40 UTC 2016 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: Avoid error message when /dev/wedges doesn't exist yet. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/hooks/02-wedgenames diff -u src/sbin/devpubd/hooks/02-wedgenames:1.3 src/sbin/devpubd/hooks/02-wedgenames:1.4 --- src/sbin/devpubd/hooks/02-wedgenames:1.3 Sun Mar 1 14:21:17 2015 +++ src/sbin/devpubd/hooks/02-wedgenames Mon Aug 15 12:54:40 2016 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: 02-wedgenames,v 1.3 2015/03/01 14:21:17 mlelstv Exp $ +# $NetBSD: 02-wedgenames,v 1.4 2016/08/15 12:54:40 mlelstv Exp $ # # Try to maintain symlinks to wedge devices # @@ -12,7 +12,7 @@ devices=$@ wedgedir=/dev/wedges remove_wedge() { - find $wedgedir -print \ + test -d $wedgedir && find $wedgedir -print \ | sed -e 's# #\\ #g' \ | while read w; do t=$(readlink "$w")
CVS commit: src/sbin/devpubd/hooks
Module Name:src Committed By: mlelstv Date: Mon Aug 15 12:54:40 UTC 2016 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: Avoid error message when /dev/wedges doesn't exist yet. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd/hooks
Module Name:src Committed By: mlelstv Date: Sun Mar 1 14:21:17 UTC 2015 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: safely update existing wedge links To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd/hooks
Module Name:src Committed By: mlelstv Date: Sun Mar 1 14:21:17 UTC 2015 Modified Files: src/sbin/devpubd/hooks: 02-wedgenames Log Message: safely update existing wedge links To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/hooks/02-wedgenames diff -u src/sbin/devpubd/hooks/02-wedgenames:1.2 src/sbin/devpubd/hooks/02-wedgenames:1.3 --- src/sbin/devpubd/hooks/02-wedgenames:1.2 Sun Feb 15 15:56:30 2015 +++ src/sbin/devpubd/hooks/02-wedgenames Sun Mar 1 14:21:17 2015 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: 02-wedgenames,v 1.2 2015/02/15 15:56:30 jmcneill Exp $ +# $NetBSD: 02-wedgenames,v 1.3 2015/03/01 14:21:17 mlelstv Exp $ # # Try to maintain symlinks to wedge devices # @@ -52,7 +52,14 @@ add_wedge() { test -d $wedgedir || mkdir -m 755 $wedgedir basedir=$(dirname $wedgedir/$n) test -d $basedir || mkdir -p -m 755 $basedir - ln -s /dev/$1 $wedgedir/$n + if oldlink=$(readlink $wedgedir/$n); then + if [ x$oldlink != /dev/$1 ]; then +rm -f $wedgedir/$n +ln -s /dev/$1 $wedgedir/$n + fi + else + ln -s /dev/$1 $wedgedir/$n + fi ;; esac }
CVS commit: src/sbin/devpubd
Module Name:src Committed By: jmcneill Date: Sun Feb 15 15:56:30 UTC 2015 Modified Files: src/sbin/devpubd: devpubd-run-hooks.in devpubd.c src/sbin/devpubd/hooks: 01-makedev 02-wedgenames Log Message: At startup, instead of doing run-hooks for each device, call run-hooks once with a list of all found devices. This lets us batch calls to MAKEDEV which results in a noticeable improvement in Raspberry Pi boot time. Run the initial device enumeration hooks before detaching from the foreground, ensuring that any required devices have been created before the rc.d script exits. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sbin/devpubd/devpubd-run-hooks.in \ src/sbin/devpubd/devpubd.c cvs rdiff -u -r1.1 -r1.2 src/sbin/devpubd/hooks/01-makedev \ src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/devpubd-run-hooks.in diff -u src/sbin/devpubd/devpubd-run-hooks.in:1.2 src/sbin/devpubd/devpubd-run-hooks.in:1.3 --- src/sbin/devpubd/devpubd-run-hooks.in:1.2 Sun Dec 4 13:01:54 2011 +++ src/sbin/devpubd/devpubd-run-hooks.in Sun Feb 15 15:56:30 2015 @@ -1,18 +1,19 @@ #!/bin/sh # -# $NetBSD: devpubd-run-hooks.in,v 1.2 2011/12/04 13:01:54 jmcneill Exp $ +# $NetBSD: devpubd-run-hooks.in,v 1.3 2015/02/15 15:56:30 jmcneill Exp $ # # devpubd run hooks devpubd_event=$1 -devpubd_device=$2 +shift +devpubd_devices=$@ devpubd_hooks_base=@HOOKSDIR@ case $devpubd_event in device-attach|device-detach) for hook in ${devpubd_hooks_base}/*; do if [ -x ${hook} ]; then - ${hook} ${devpubd_event} ${devpubd_device} + ${hook} ${devpubd_event} ${devpubd_devices} fi done ;; Index: src/sbin/devpubd/devpubd.c diff -u src/sbin/devpubd/devpubd.c:1.2 src/sbin/devpubd/devpubd.c:1.3 --- src/sbin/devpubd/devpubd.c:1.2 Fri Sep 16 15:42:56 2011 +++ src/sbin/devpubd/devpubd.c Sun Feb 15 15:56:30 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: devpubd.c,v 1.2 2011/09/16 15:42:56 joerg Exp $ */ +/* $NetBSD: devpubd.c,v 1.3 2015/02/15 15:56:30 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -34,10 +34,11 @@ */ #include sys/cdefs.h -__COPYRIGHT(@(#) Copyright (c) 2011\ +__COPYRIGHT(@(#) Copyright (c) 2011-2015\ Jared D. McNeill jmcne...@invisible.ca. All rights reserved.); -__RCSID($NetBSD: devpubd.c,v 1.2 2011/09/16 15:42:56 joerg Exp $); +__RCSID($NetBSD: devpubd.c,v 1.3 2015/02/15 15:56:30 jmcneill Exp $); +#include sys/queue.h #include sys/types.h #include sys/ioctl.h #include sys/drvctlio.h @@ -57,18 +58,24 @@ __RCSID($NetBSD: devpubd.c,v 1.2 2011/0 static int drvctl_fd = -1; static const char devpubd_script[] = DEVPUBD_RUN_HOOKS; +struct devpubd_probe_event { + char *device; + TAILQ_ENTRY(devpubd_probe_event) entries; +}; + +static TAILQ_HEAD(, devpubd_probe_event) devpubd_probe_events; + #define DEVPUBD_ATTACH_EVENT device-attach #define DEVPUBD_DETACH_EVENT device-detach __dead static void -devpubd_exec(const char *path, const char *event, const char *device) +devpubd_exec(const char *path, char * const *argv) { int error; - error = execl(path, path, event, device, NULL); + error = execv(path, argv); if (error) { - syslog(LOG_ERR, couldn't exec '%s %s %s': %m, - path, event, device); + syslog(LOG_ERR, couldn't exec '%s': %m, path); exit(EXIT_FAILURE); } @@ -76,12 +83,25 @@ devpubd_exec(const char *path, const cha } static void -devpubd_eventhandler(const char *event, const char *device) +devpubd_eventhandler(const char *event, const char **device) { + char **argv; pid_t pid; - int status; + int status, i, ndevs; + + for (ndevs = 0, i = 0; device[i] != NULL; i++) { + ++ndevs; + syslog(LOG_DEBUG, event = '%s', device = '%s', event, + device[i]); + } - syslog(LOG_DEBUG, event = '%s', device = '%s', event, device); + argv = calloc(3 + ndevs, sizeof(char *)); + argv[0] = __UNCONST(devpubd_script); + argv[1] = __UNCONST(event); + for (i = 0; i ndevs; i++) { + argv[2 + i] = __UNCONST(device[i]); + } + argv[2 + i] = NULL; pid = fork(); switch (pid) { @@ -89,7 +109,7 @@ devpubd_eventhandler(const char *event, syslog(LOG_ERR, fork failed: %m); break; case 0: - devpubd_exec(devpubd_script, event, device); + devpubd_exec(devpubd_script, argv); /* NOTREACHED */ default: if (waitpid(pid, status, 0) == -1) { @@ -105,23 +125,27 @@ devpubd_eventhandler(const char *event, } break; } + + free(argv); } __dead static void devpubd_eventloop(void) { - const char *event, *device; + const char *event, *device[2]; prop_dictionary_t ev; int res; assert(drvctl_fd != -1); + device[1] = NULL; + for (;;) { res = prop_dictionary_recv_ioctl(drvctl_fd, DRVGETEVENT, ev); if (res) err(EXIT_FAILURE, DRVGETEVENT failed); prop_dictionary_get_cstring_nocopy(ev, event, event); -
CVS commit: src/sbin/devpubd
Module Name:src Committed By: jmcneill Date: Sun Feb 15 15:56:30 UTC 2015 Modified Files: src/sbin/devpubd: devpubd-run-hooks.in devpubd.c src/sbin/devpubd/hooks: 01-makedev 02-wedgenames Log Message: At startup, instead of doing run-hooks for each device, call run-hooks once with a list of all found devices. This lets us batch calls to MAKEDEV which results in a noticeable improvement in Raspberry Pi boot time. Run the initial device enumeration hooks before detaching from the foreground, ensuring that any required devices have been created before the rc.d script exits. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sbin/devpubd/devpubd-run-hooks.in \ src/sbin/devpubd/devpubd.c cvs rdiff -u -r1.1 -r1.2 src/sbin/devpubd/hooks/01-makedev \ src/sbin/devpubd/hooks/02-wedgenames Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd
Module Name:src Committed By: christos Date: Sun Feb 15 21:46:49 UTC 2015 Modified Files: src/sbin/devpubd: Makefile devpubd.c Log Message: let's make this compile again. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/devpubd/Makefile cvs rdiff -u -r1.3 -r1.4 src/sbin/devpubd/devpubd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/Makefile diff -u src/sbin/devpubd/Makefile:1.4 src/sbin/devpubd/Makefile:1.5 --- src/sbin/devpubd/Makefile:1.4 Sun Aug 11 02:04:38 2013 +++ src/sbin/devpubd/Makefile Sun Feb 15 16:46:49 2015 @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.4 2013/08/11 06:04:38 dholland Exp $ +# $NetBSD: Makefile,v 1.5 2015/02/15 21:46:49 christos Exp $ PROG= devpubd SRCS= devpubd.c MAN= devpubd.8 +WARNS= 6 BINDIR?= /sbin Index: src/sbin/devpubd/devpubd.c diff -u src/sbin/devpubd/devpubd.c:1.3 src/sbin/devpubd/devpubd.c:1.4 --- src/sbin/devpubd/devpubd.c:1.3 Sun Feb 15 10:56:30 2015 +++ src/sbin/devpubd/devpubd.c Sun Feb 15 16:46:49 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: devpubd.c,v 1.3 2015/02/15 15:56:30 jmcneill Exp $ */ +/* $NetBSD: devpubd.c,v 1.4 2015/02/15 21:46:49 christos Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -36,7 +36,7 @@ #include sys/cdefs.h __COPYRIGHT(@(#) Copyright (c) 2011-2015\ Jared D. McNeill jmcne...@invisible.ca. All rights reserved.); -__RCSID($NetBSD: devpubd.c,v 1.3 2015/02/15 15:56:30 jmcneill Exp $); +__RCSID($NetBSD: devpubd.c,v 1.4 2015/02/15 21:46:49 christos Exp $); #include sys/queue.h #include sys/types.h @@ -87,7 +87,8 @@ devpubd_eventhandler(const char *event, { char **argv; pid_t pid; - int status, i, ndevs; + int status; + size_t i, ndevs; for (ndevs = 0, i = 0; device[i] != NULL; i++) { ++ndevs; @@ -95,7 +96,7 @@ devpubd_eventhandler(const char *event, device[i]); } - argv = calloc(3 + ndevs, sizeof(char *)); + argv = calloc(3 + ndevs, sizeof(*argv)); argv[0] = __UNCONST(devpubd_script); argv[1] = __UNCONST(event); for (i = 0; i ndevs; i++) { @@ -148,7 +149,7 @@ devpubd_eventloop(void) prop_dictionary_get_cstring_nocopy(ev, device, device[0]); printf(%s: event='%s', device='%s'\n, __func__, - event, device); + event, device[0]); devpubd_eventhandler(event, device); @@ -227,7 +228,7 @@ devpubd_init(void) { struct devpubd_probe_event *ev; const char **devs; - int ndevs, i; + size_t ndevs, i; TAILQ_INIT(devpubd_probe_events); devpubd_probe(NULL); @@ -242,7 +243,7 @@ devpubd_init(void) } devpubd_eventhandler(DEVPUBD_ATTACH_EVENT, devs); free(devs); - while (ev = TAILQ_FIRST(devpubd_probe_events)) { + while ((ev = TAILQ_FIRST(devpubd_probe_events)) != NULL) { TAILQ_REMOVE(devpubd_probe_events, ev, entries); free(ev-device); free(ev);
CVS commit: src/sbin/devpubd
Module Name:src Committed By: christos Date: Sun Feb 15 21:46:49 UTC 2015 Modified Files: src/sbin/devpubd: Makefile devpubd.c Log Message: let's make this compile again. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/devpubd/Makefile cvs rdiff -u -r1.3 -r1.4 src/sbin/devpubd/devpubd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd
Module Name:src Committed By: wiz Date: Sat Jan 12 10:19:01 UTC 2013 Modified Files: src/sbin/devpubd: devpubd.8 Log Message: Bump date for previous. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sbin/devpubd/devpubd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/devpubd.8 diff -u src/sbin/devpubd/devpubd.8:1.3 src/sbin/devpubd/devpubd.8:1.4 --- src/sbin/devpubd/devpubd.8:1.3 Fri Jan 11 23:49:23 2013 +++ src/sbin/devpubd/devpubd.8 Sat Jan 12 10:19:01 2013 @@ -1,6 +1,6 @@ -.\ $NetBSD: devpubd.8,v 1.3 2013/01/11 23:49:23 mlelstv Exp $ +.\ $NetBSD: devpubd.8,v 1.4 2013/01/12 10:19:01 wiz Exp $ .\ -.\ Copyright (c) 2011 The NetBSD Foundation, Inc. +.\ Copyright (c) 2011-2013 The NetBSD Foundation, Inc. .\ All rights reserved. .\ .\ This code is derived from software contributed to The NetBSD Foundation @@ -27,7 +27,7 @@ .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\ POSSIBILITY OF SUCH DAMAGE. .\ -.Dd November 22, 2012 +.Dd January 12, 2013 .Dt DEVPUBD 8 .Os .Sh NAME
CVS commit: src/sbin/devpubd
Module Name:src Committed By: wiz Date: Sat Jan 12 10:19:01 UTC 2013 Modified Files: src/sbin/devpubd: devpubd.8 Log Message: Bump date for previous. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sbin/devpubd/devpubd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd
Module Name:src Committed By: reed Date: Thu Nov 22 17:16:30 UTC 2012 Modified Files: src/sbin/devpubd: devpubd.8 Log Message: Add some details about the hook scripts. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sbin/devpubd/devpubd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/devpubd.8 diff -u src/sbin/devpubd/devpubd.8:1.1 src/sbin/devpubd/devpubd.8:1.2 --- src/sbin/devpubd/devpubd.8:1.1 Mon Aug 29 14:21:50 2011 +++ src/sbin/devpubd/devpubd.8 Thu Nov 22 17:16:30 2012 @@ -1,4 +1,4 @@ -.\ $NetBSD: devpubd.8,v 1.1 2011/08/29 14:21:50 wiz Exp $ +.\ $NetBSD: devpubd.8,v 1.2 2012/11/22 17:16:30 reed Exp $ .\ .\ Copyright (c) 2011 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -27,7 +27,7 @@ .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\ POSSIBILITY OF SUCH DAMAGE. .\ -.Dd August 29, 2011 +.Dd November 22, 2012 .Dt DEVPUBD 8 .Os .Sh NAME @@ -49,6 +49,21 @@ When is specified, .Nm does not go into the background. +.Pp +.Nm +runs +.Pa /libexec/devpubd-run-hooks . +This script runs each script found in +.Pa /libexec/devpubd-hooks +in a lexical order with two arguments: +.Ar device-attach +or +.Ar device-detach +and the device file name. +The default installation supplies the +.Pa 01-makedev +script for creating a device node. +Additional scripts may be added for other dynamic device actions. .Sh SEE ALSO .Xr drvctl 8 , .Xr MAKEDEV 8
CVS commit: src/sbin/devpubd
Module Name:src Committed By: reed Date: Thu Nov 22 17:16:30 UTC 2012 Modified Files: src/sbin/devpubd: devpubd.8 Log Message: Add some details about the hook scripts. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sbin/devpubd/devpubd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd
Module Name:src Committed By: jmcneill Date: Sun Dec 4 13:01:54 UTC 2011 Modified Files: src/sbin/devpubd: devpubd-run-hooks.in Log Message: exit 0 on success To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sbin/devpubd/devpubd-run-hooks.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/devpubd-run-hooks.in diff -u src/sbin/devpubd/devpubd-run-hooks.in:1.1 src/sbin/devpubd/devpubd-run-hooks.in:1.2 --- src/sbin/devpubd/devpubd-run-hooks.in:1.1 Mon Aug 29 11:38:48 2011 +++ src/sbin/devpubd/devpubd-run-hooks.in Sun Dec 4 13:01:54 2011 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: devpubd-run-hooks.in,v 1.1 2011/08/29 11:38:48 mrg Exp $ +# $NetBSD: devpubd-run-hooks.in,v 1.2 2011/12/04 13:01:54 jmcneill Exp $ # # devpubd run hooks @@ -19,3 +19,5 @@ device-attach|device-detach) *) ;; esac + +exit 0
CVS commit: src/sbin/devpubd
Module Name:src Committed By: jmcneill Date: Sun Dec 4 13:01:54 UTC 2011 Modified Files: src/sbin/devpubd: devpubd-run-hooks.in Log Message: exit 0 on success To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sbin/devpubd/devpubd-run-hooks.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd
Module Name:src Committed By: joerg Date: Fri Sep 16 15:42:56 UTC 2011 Modified Files: src/sbin/devpubd: devpubd.c Log Message: Use __dead. Save a pointer. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sbin/devpubd/devpubd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/devpubd/devpubd.c diff -u src/sbin/devpubd/devpubd.c:1.1 src/sbin/devpubd/devpubd.c:1.2 --- src/sbin/devpubd/devpubd.c:1.1 Mon Aug 29 11:38:48 2011 +++ src/sbin/devpubd/devpubd.c Fri Sep 16 15:42:56 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: devpubd.c,v 1.1 2011/08/29 11:38:48 mrg Exp $ */ +/* $NetBSD: devpubd.c,v 1.2 2011/09/16 15:42:56 joerg Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -36,7 +36,7 @@ #include sys/cdefs.h __COPYRIGHT(@(#) Copyright (c) 2011\ Jared D. McNeill jmcne...@invisible.ca. All rights reserved.); -__RCSID($NetBSD: devpubd.c,v 1.1 2011/08/29 11:38:48 mrg Exp $); +__RCSID($NetBSD: devpubd.c,v 1.2 2011/09/16 15:42:56 joerg Exp $); #include sys/types.h #include sys/ioctl.h @@ -55,12 +55,12 @@ #include unistd.h static int drvctl_fd = -1; -static const char *devpubd_script = DEVPUBD_RUN_HOOKS; +static const char devpubd_script[] = DEVPUBD_RUN_HOOKS; #define DEVPUBD_ATTACH_EVENT device-attach #define DEVPUBD_DETACH_EVENT device-detach -static void +__dead static void devpubd_exec(const char *path, const char *event, const char *device) { int error; @@ -107,7 +107,7 @@ } } -static void +__dead static void devpubd_eventloop(void) { const char *event, *device; @@ -195,7 +195,7 @@ return; } -static void +__dead static void usage(void) { fprintf(stderr, usage: %s [-f]\n, getprogname());
CVS commit: src/sbin/devpubd
Module Name:src Committed By: joerg Date: Fri Sep 16 15:42:56 UTC 2011 Modified Files: src/sbin/devpubd: devpubd.c Log Message: Use __dead. Save a pointer. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sbin/devpubd/devpubd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/devpubd
Module Name:src Committed By: wiz Date: Mon Aug 29 14:21:50 UTC 2011 Added Files: src/sbin/devpubd: devpubd.8 Log Message: Add minimal devpubd man page, not hooked into the build yet. XXX: someone should write drvctl(4) To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sbin/devpubd/devpubd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sbin/devpubd/devpubd.8 diff -u /dev/null src/sbin/devpubd/devpubd.8:1.1 --- /dev/null Mon Aug 29 14:21:50 2011 +++ src/sbin/devpubd/devpubd.8 Mon Aug 29 14:21:50 2011 @@ -0,0 +1,54 @@ +.\ $NetBSD: devpubd.8,v 1.1 2011/08/29 14:21:50 wiz Exp $ +.\ +.\ Copyright (c) 2011 The NetBSD Foundation, Inc. +.\ All rights reserved. +.\ +.\ This code is derived from software contributed to The NetBSD Foundation +.\ by Thomas Klausner. +.\ +.\ Redistribution and use in source and binary forms, with or without +.\ modification, are permitted provided that the following conditions +.\ are met: +.\ 1. Redistributions of source code must retain the above copyright +.\notice, this list of conditions and the following disclaimer. +.\ 2. Redistributions in binary form must reproduce the above copyright +.\notice, this list of conditions and the following disclaimer in the +.\documentation and/or other materials provided with the distribution. +.\ +.\ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\ POSSIBILITY OF SUCH DAMAGE. +.\ +.Dd August 29, 2011 +.Dt DEVPUBD 8 +.Os +.Sh NAME +.Nm devpubd +.Nd device publish daemon for automatic device node creation +.Sh SYNOPSIS +.Nm +.Op Fl f +.Sh DESCRIPTION +.Nm +listens on +.Xr drvctl 4 +for new devices and creates their device nodes using +.Xr MAKEDEV 8 +if they are missing. +.Pp +When +.Fl f +is specified, +.Nm +does not go into the background. +.Sh SEE ALSO +.Xr drvctl 8 , +.Xr MAKEDEV 8
CVS commit: src/sbin/devpubd
Module Name:src Committed By: wiz Date: Mon Aug 29 14:21:50 UTC 2011 Added Files: src/sbin/devpubd: devpubd.8 Log Message: Add minimal devpubd man page, not hooked into the build yet. XXX: someone should write drvctl(4) To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sbin/devpubd/devpubd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.