Re: Stop using direct syscall(2) from perl(1)
On Thu, 3 Aug 2023 18:43:21 -0700 Andrew Hewus Fresh wrote: > Here's a new version, I think I addressed all of the feedback I got, > although may have missed something. ok gkoehler@ You sent this new version 2 weeks ago, but I didn't build it until yesterday. syscall_emulator.t passes on macppc and powerpc64. > Index: gnu/usr.bin/perl/MANIFEST > === > RCS file: /home/afresh1/OpenBSD-perl/OP/cvs/src/gnu/usr.bin/perl/MANIFEST,v > retrieving revision 1.67 > diff -u -p -a -u -p -r1.67 MANIFEST > --- gnu/usr.bin/perl/MANIFEST 8 Jul 2023 14:18:35 - 1.67 > +++ gnu/usr.bin/perl/MANIFEST 3 Aug 2023 04:34:38 - > @@ -6605,6 +6605,7 @@ t/op/svleak.pl Test file for svleak.t > t/op/svleak.tSee if stuff leaks SVs > t/op/switch.tSee if switches (given/when) work > t/op/symbolcache.t See if undef/delete works on stashes with > functions > +t/op/syscall_emulator.t Tests that syscall works via the > emulator > t/op/sysio.t See if sysread and syswrite work > t/op/taint.t See if tainting works > t/op/threads.t Misc. tests for perl features with > threads > Index: gnu/usr.bin/perl/Makefile.SH > === > RCS file: /home/afresh1/OpenBSD-perl/OP/cvs/src/gnu/usr.bin/perl/Makefile.SH,v > retrieving revision 1.60 > diff -u -p -a -u -p -r1.60 Makefile.SH > --- gnu/usr.bin/perl/Makefile.SH 8 Jul 2023 14:18:35 - 1.60 > +++ gnu/usr.bin/perl/Makefile.SH 3 Aug 2023 04:34:38 - > @@ -541,7 +541,7 @@ c1 = av.c scope.c op.c doop.c doio.c dum > c2 = perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c sv.c > c3 = taint.c toke.c util.c deb.c run.c builtin.c universal.c pad.c globals.c > keywords.c > c4 = perlio.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c caretx.c > dquote.c time64.c > -c5 = $(mallocsrc) > +c5 = $(mallocsrc) syscall_emulator.c > > !NO!SUBS! > > @@ -557,7 +557,7 @@ c = $(c1) $(c2) $(c3) $(c4) $(c5) minipe > > obj1 = $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) > pad$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) > reentr$(OBJ_EXT) mro_core$(OBJ_EXT) keywords$(OBJ_EXT) builtin$(OBJ_EXT) > obj2 = hv$(OBJ_EXT) av$(OBJ_EXT) run$(OBJ_EXT) pp_hot$(OBJ_EXT) sv$(OBJ_EXT) > pp$(OBJ_EXT) scope$(OBJ_EXT) pp_ctl$(OBJ_EXT) pp_sys$(OBJ_EXT) > -obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) utf8$(OBJ_EXT) > taint$(OBJ_EXT) deb$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT) > numeric$(OBJ_EXT) mathoms$(OBJ_EXT) locale$(OBJ_EXT) pp_pack$(OBJ_EXT) > pp_sort$(OBJ_EXT) caretx$(OBJ_EXT) dquote$(OBJ_EXT) time64$(OBJ_EXT) > +obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) utf8$(OBJ_EXT) > taint$(OBJ_EXT) deb$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT) > numeric$(OBJ_EXT) mathoms$(OBJ_EXT) locale$(OBJ_EXT) pp_pack$(OBJ_EXT) > pp_sort$(OBJ_EXT) caretx$(OBJ_EXT) dquote$(OBJ_EXT) time64$(OBJ_EXT) > syscall_emulator$(OBJ_EXT) > > # split the objects into 3 exclusive sets: those used by both miniperl and > # perl, and those used by just one or the other. Doesn't include the > Index: gnu/usr.bin/perl/Makefile.bsd-wrapper > === > RCS file: > /home/afresh1/OpenBSD-perl/OP/cvs/src/gnu/usr.bin/perl/Makefile.bsd-wrapper,v > retrieving revision 1.113 > diff -u -p -a -u -p -r1.113 Makefile.bsd-wrapper > --- gnu/usr.bin/perl/Makefile.bsd-wrapper 15 Feb 2023 01:38:20 - > 1.113 > +++ gnu/usr.bin/perl/Makefile.bsd-wrapper 3 Aug 2023 04:34:38 - > @@ -39,11 +39,18 @@ cleandir: > fi > cd ${.CURDIR} && ${MAKE} -f Makefile.bsd-wrapper1 cleandir > > -all: config.sh > +all: syscall_emulator.c config.sh > cd ${.CURDIR} && exec ${MAKE} -f Makefile.bsd-wrapper1 perl.build > cd ${.CURDIR} && exec ${MAKE} -f Makefile.bsd-wrapper1 mansrc.build > > install: > cd ${.CURDIR} && exec ${MAKE} -f Makefile.bsd-wrapper1 install > + > + > +syscall_emulator.c: gen_syscall_emulator.pl syscall_emulator.h > /usr/include/sys/syscall.h /usr/include/sys/syscallargs.h > + /usr/bin/perl $(.CURDIR)/gen_syscall_emulator.pl > $@ > + > +syscall_emulator.h: > + ln -sf $(.CURDIR)/$@ $@ > > .include > Index: gnu/usr.bin/perl/config.over > === > RCS file: /home/afresh1/OpenBSD-perl/OP/cvs/src/gnu/usr.bin/perl/config.over,v > retrieving revision 1.22 > diff -u -p -a -u -p -r1.22 config.over > --- gnu/usr.bin/perl/config.over 5 Feb 2017 00:33:38 - 1.22 > +++ gnu/usr.bin/perl/config.over 3 Aug 2023 04:34:38 - > @@ -64,3 +64,9 @@ myuname='openbsd' > > # force to use ranlib > ranlib='ranlib' > + > +# Enable the syscall emulator, > +# enabling syscall even if we don't have it >
Re: bioctl: do not confirm new passphrases on stdin
On 2023/08/17 09:32:43 +, Klemens Nanni wrote: > > I think it would be less ugly to have an iteractive global (or similar) > > and clear that when -s is given (the correct way to write the above would > > require masking rpp_flag). > > Done. This makes all of the following behave as expected > bioctl -cC -lvnd0a softraid0 > bioctl -d sd2 > bioctl -s -cC -lvnd0a softraid0 > bioctl -P sd2 > bioctl -s -P sd2 > > Feedback? OK? I like this more since using the flags in the global was meh. > [...] > @@ -1316,6 +1316,7 @@ derive_key(u_int32_t type, int rounds, u > size_t pl; > struct stat sb; > charpassphrase[1024], verifybuf[1024]; > + int rpp_flag = RPP_ECHO_OFF; since this is the default... > if (!key) > errx(1, "Invalid key"); > @@ -1351,6 +1352,8 @@ derive_key(u_int32_t type, int rounds, u > > fclose(f); > } else { > + rpp_flag |= interactive ? RPP_REQUIRE_TTY : RPP_STDIN; > + I'd find slightly easier to read + rpp_flag = interactive ? RPP_REQUIRE_TTY : RPP_STDIN but no strong opinion. > if (readpassphrase(prompt, passphrase, sizeof(passphrase), > rpp_flag) == NULL) > err(1, "unable to read passphrase"); still ok for me whichever option you prefer. Thanks, Omar Polo
Re: diff: trigger acpiac_refresh when acpibat notification
On Thu, 17 Aug 2023 at 16:12:07 +0900, YASUOKA Masahiko wrote: > Hi, > > Update the AC status when the battery notification is happened. > Because the AC status notification doesn't happen on some machines. > My vaio actually has this problem. > > Also Linux is doing the same thing > > https://github.com/torvalds/linux/blob/v6.4/drivers/acpi/ac.c#L165-L183 > > ok? comments? When does acpiac_notify_triggered get reset back to 0 to run again on the next battery notification? > Index: sys/dev/acpi/acpiac.c > === > RCS file: /cvs/src/sys/dev/acpi/acpiac.c,v > retrieving revision 1.36 > diff -u -p -r1.36 acpiac.c > --- sys/dev/acpi/acpiac.c 6 Apr 2022 18:59:27 - 1.36 > +++ sys/dev/acpi/acpiac.c 17 Aug 2023 06:57:44 - > @@ -140,6 +140,8 @@ acpiac_getpsr(struct acpiac_softc *sc) > return (0); > } > > +static int acpiac_notify_triggered = 0; > + > int > acpiac_notify(struct aml_node *node, int notify_type, void *arg) > { > @@ -148,6 +150,8 @@ acpiac_notify(struct aml_node *node, int > dnprintf(10, "acpiac_notify: %.2x %s\n", notify_type, > DEVNAME(sc)); > > + acpiac_notify_triggered = 1; > + > switch (notify_type) { > case 0x00: > case 0x01: > @@ -164,4 +168,22 @@ acpiac_notify(struct aml_node *node, int > break; > } > return (0); > +} > + > +void > +acpiac_battery_notify(void) > +{ > + struct acpi_softc *sc = acpi_softc; > + struct acpi_ac *ac; > + > + if (acpiac_notify_triggered) > + return; > + /* > + * On some machines (vaio VJPK23 at least) AC status notifications > + * are not triggered. Update the AC status when battery notifications. > + */ > + SLIST_FOREACH(ac, >sc_ac, aac_link) { > + acpiac_refresh(ac->aac_softc); > + acpi_record_event(sc, APM_POWER_CHANGE); > + } > } > Index: sys/dev/acpi/acpibat.c > === > RCS file: /cvs/src/sys/dev/acpi/acpibat.c,v > retrieving revision 1.70 > diff -u -p -r1.70 acpibat.c > --- sys/dev/acpi/acpibat.c6 Apr 2022 18:59:27 - 1.70 > +++ sys/dev/acpi/acpibat.c17 Aug 2023 06:57:45 - > @@ -536,5 +536,7 @@ acpibat_notify(struct aml_node *node, in > acpibat_refresh(sc); > acpi_record_event(sc->sc_acpi, APM_POWER_CHANGE); > > + acpiac_battery_notify(); > + > return (0); > } > Index: sys/dev/acpi/acpidev.h > === > RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v > retrieving revision 1.44 > diff -u -p -r1.44 acpidev.h > --- sys/dev/acpi/acpidev.h29 Jun 2018 17:39:18 - 1.44 > +++ sys/dev/acpi/acpidev.h17 Aug 2023 06:57:45 - > @@ -306,6 +306,8 @@ struct acpiac_softc { > struct ksensordev sc_sensdev; > }; > > +void acpiac_battery_notify(void); > + > struct acpibat_softc { > struct device sc_dev; > >
Re: diff: trigger acpiac_refresh when acpibat notification
Let me clarify some. On Thu, 17 Aug 2023 16:12:07 +0900 (JST) YASUOKA Masahiko wrote: > Update the AC status when the battery notification is happened. > Because the AC status notification doesn't happen on some machines. At that time (plugging or unpluggin the AC), a battery notification always happens. So the diff is to use the battery notification instead of the AC status notification. > My vaio actually has this problem. > > Also Linux is doing the same thing > > https://github.com/torvalds/linux/blob/v6.4/drivers/acpi/ac.c#L165-L183 > > ok? comments? > > Index: sys/dev/acpi/acpiac.c > === > RCS file: /cvs/src/sys/dev/acpi/acpiac.c,v > retrieving revision 1.36 > diff -u -p -r1.36 acpiac.c > --- sys/dev/acpi/acpiac.c 6 Apr 2022 18:59:27 - 1.36 > +++ sys/dev/acpi/acpiac.c 17 Aug 2023 06:57:44 - > @@ -140,6 +140,8 @@ acpiac_getpsr(struct acpiac_softc *sc) > return (0); > } > > +static int acpiac_notify_triggered = 0; > + > int > acpiac_notify(struct aml_node *node, int notify_type, void *arg) > { > @@ -148,6 +150,8 @@ acpiac_notify(struct aml_node *node, int > dnprintf(10, "acpiac_notify: %.2x %s\n", notify_type, > DEVNAME(sc)); > > + acpiac_notify_triggered = 1; > + > switch (notify_type) { > case 0x00: > case 0x01: > @@ -164,4 +168,22 @@ acpiac_notify(struct aml_node *node, int > break; > } > return (0); > +} > + > +void > +acpiac_battery_notify(void) > +{ > + struct acpi_softc *sc = acpi_softc; > + struct acpi_ac *ac; > + > + if (acpiac_notify_triggered) > + return; > + /* > + * On some machines (vaio VJPK23 at least) AC status notifications > + * are not triggered. Update the AC status when battery notifications. > + */ > + SLIST_FOREACH(ac, >sc_ac, aac_link) { > + acpiac_refresh(ac->aac_softc); > + acpi_record_event(sc, APM_POWER_CHANGE); > + } > } > Index: sys/dev/acpi/acpibat.c > === > RCS file: /cvs/src/sys/dev/acpi/acpibat.c,v > retrieving revision 1.70 > diff -u -p -r1.70 acpibat.c > --- sys/dev/acpi/acpibat.c6 Apr 2022 18:59:27 - 1.70 > +++ sys/dev/acpi/acpibat.c17 Aug 2023 06:57:45 - > @@ -536,5 +536,7 @@ acpibat_notify(struct aml_node *node, in > acpibat_refresh(sc); > acpi_record_event(sc->sc_acpi, APM_POWER_CHANGE); > > + acpiac_battery_notify(); > + > return (0); > } > Index: sys/dev/acpi/acpidev.h > === > RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v > retrieving revision 1.44 > diff -u -p -r1.44 acpidev.h > --- sys/dev/acpi/acpidev.h29 Jun 2018 17:39:18 - 1.44 > +++ sys/dev/acpi/acpidev.h17 Aug 2023 06:57:45 - > @@ -306,6 +306,8 @@ struct acpiac_softc { > struct ksensordev sc_sensdev; > }; > > +void acpiac_battery_notify(void); > + > struct acpibat_softc { > struct device sc_dev; > >
Re: bioctl: do not confirm new passphrases on stdin
On Thu, Aug 17, 2023 at 06:43:36PM +1000, Joel Sing wrote: > I agree with the intent, however the man page should probably reflect this > change (i.e. -s makes it non-interactive and you will not get confirmation). Done. > > > Index: bioctl.c > > === > > RCS file: /cvs/src/sbin/bioctl/bioctl.c,v > > retrieving revision 1.151 > > diff -u -p -r1.151 bioctl.c > > --- bioctl.c18 Oct 2022 07:04:20 - 1.151 > > +++ bioctl.c17 Aug 2023 02:16:37 - > > @@ -989,7 +989,7 @@ bio_kdf_generate(struct sr_crypto_kdfinf > > derive_key(kdfinfo->pbkdf.generic.type, kdfinfo->pbkdf.rounds, > > kdfinfo->maskkey, sizeof(kdfinfo->maskkey), > > kdfinfo->pbkdf.salt, sizeof(kdfinfo->pbkdf.salt), > > - "New passphrase: ", 1); > > + "New passphrase: ", rpp_flag == RPP_REQUIRE_TTY ? 1 : 0); > > I think it would be less ugly to have an iteractive global (or similar) > and clear that when -s is given (the correct way to write the above would > require masking rpp_flag). Done. This makes all of the following behave as expected bioctl -cC -lvnd0a softraid0 bioctl -d sd2 bioctl -s -cC -lvnd0a softraid0 bioctl -P sd2 bioctl -s -P sd2 Feedback? OK? Index: bioctl.8 === RCS file: /cvs/src/sbin/bioctl/bioctl.8,v retrieving revision 1.111 diff -u -p -r1.111 bioctl.8 --- bioctl.86 Jul 2023 21:08:50 - 1.111 +++ bioctl.817 Aug 2023 09:24:28 - @@ -288,7 +288,7 @@ is specified as "auto", the number of ro based on system performance. Otherwise the minimum is 4 rounds and the default is 16. .It Fl s -Read the passphrase for the selected crypto volume from +Omit prompts and read passphrases without confirmation from .Pa /dev/stdin rather than .Pa /dev/tty . Index: bioctl.c === RCS file: /cvs/src/sbin/bioctl/bioctl.c,v retrieving revision 1.151 diff -u -p -r1.151 bioctl.c --- bioctl.c18 Oct 2022 07:04:20 - 1.151 +++ bioctl.c17 Aug 2023 09:23:13 - @@ -94,7 +94,7 @@ char *password; void *bio_cookie; -int rpp_flag = RPP_REQUIRE_TTY; +int interactive = 1; int main(int argc, char *argv[]) @@ -200,7 +200,7 @@ main(int argc, char *argv[]) al_arg = optarg; break; case 's': - rpp_flag = RPP_STDIN; + interactive = 0; break; case 't': /* patrol */ func |= BIOC_PATROL; @@ -989,7 +989,7 @@ bio_kdf_generate(struct sr_crypto_kdfinf derive_key(kdfinfo->pbkdf.generic.type, kdfinfo->pbkdf.rounds, kdfinfo->maskkey, sizeof(kdfinfo->maskkey), kdfinfo->pbkdf.salt, sizeof(kdfinfo->pbkdf.salt), - "New passphrase: ", 1); + "New passphrase: ", interactive); } int @@ -1316,6 +1316,7 @@ derive_key(u_int32_t type, int rounds, u size_t pl; struct stat sb; charpassphrase[1024], verifybuf[1024]; + int rpp_flag = RPP_ECHO_OFF; if (!key) errx(1, "Invalid key"); @@ -1351,6 +1352,8 @@ derive_key(u_int32_t type, int rounds, u fclose(f); } else { + rpp_flag |= interactive ? RPP_REQUIRE_TTY : RPP_STDIN; + if (readpassphrase(prompt, passphrase, sizeof(passphrase), rpp_flag) == NULL) err(1, "unable to read passphrase");
Re: diff: trigger acpiac_refresh when acpibat notification
Hi, Thank you for the Japanese subtitle. It helps me. :) On Thu, 17 Aug 2023 17:10:51 +0900 "lain." wrote: > If I understand correctly, you want to check the battery level, and give > you a notification when battery is low, right? > 正しく理解しているなら、YASUOKAさんはバッテリーのレベルを確認し、 > バッテリーが低くなったら通知を受け取りたい、ということですよね? No, I'd like to fix hw_power (hw.power in sysctl) variable to be changed properly. On my vaio it doesn't change when the AC is plugged or unplugged. What I actually want to fix is a problem of "apm -A". "Performance adjustment mode" uses "hw_power" variable. For example, hw.set_perf is always 100 if the vaio booted with the AC connected because hw_power is always 1. I suppose that hw.set_perf should be lower when the PC is idle and the AC is unplugged. > In this case, you can use apm for that. > その場合、それには「apm」を使うことができます。 > > Battery level (percent) checking/バッテリーのレベル(パーセント)を確認するため:apm -l > Estimated battery duration (minutes)/バッテリーが持つ予定の時間まで(分)を確認するため:apm -m > > On 2023年08月17日 16:12, YASUOKA Masahiko wrote: >> Hi, >> >> Update the AC status when the battery notification is happened. >> Because the AC status notification doesn't happen on some machines. >> My vaio actually has this problem. >> >> Also Linux is doing the same thing >> >> https://github.com/torvalds/linux/blob/v6.4/drivers/acpi/ac.c#L165-L183 >> >> ok? comments? >> >> Index: sys/dev/acpi/acpiac.c >> === >> RCS file: /cvs/src/sys/dev/acpi/acpiac.c,v >> retrieving revision 1.36 >> diff -u -p -r1.36 acpiac.c >> --- sys/dev/acpi/acpiac.c6 Apr 2022 18:59:27 - 1.36 >> +++ sys/dev/acpi/acpiac.c17 Aug 2023 06:57:44 - >> @@ -140,6 +140,8 @@ acpiac_getpsr(struct acpiac_softc *sc) >> return (0); >> } >> >> +static int acpiac_notify_triggered = 0; >> + >> int >> acpiac_notify(struct aml_node *node, int notify_type, void *arg) >> { >> @@ -148,6 +150,8 @@ acpiac_notify(struct aml_node *node, int >> dnprintf(10, "acpiac_notify: %.2x %s\n", notify_type, >> DEVNAME(sc)); >> >> +acpiac_notify_triggered = 1; >> + >> switch (notify_type) { >> case 0x00: >> case 0x01: >> @@ -164,4 +168,22 @@ acpiac_notify(struct aml_node *node, int >> break; >> } >> return (0); >> +} >> + >> +void >> +acpiac_battery_notify(void) >> +{ >> +struct acpi_softc *sc = acpi_softc; >> +struct acpi_ac *ac; >> + >> +if (acpiac_notify_triggered) >> +return; >> +/* >> + * On some machines (vaio VJPK23 at least) AC status notifications >> + * are not triggered. Update the AC status when battery notifications. >> + */ >> +SLIST_FOREACH(ac, >sc_ac, aac_link) { >> +acpiac_refresh(ac->aac_softc); >> +acpi_record_event(sc, APM_POWER_CHANGE); >> +} >> } >> Index: sys/dev/acpi/acpibat.c >> === >> RCS file: /cvs/src/sys/dev/acpi/acpibat.c,v >> retrieving revision 1.70 >> diff -u -p -r1.70 acpibat.c >> --- sys/dev/acpi/acpibat.c 6 Apr 2022 18:59:27 - 1.70 >> +++ sys/dev/acpi/acpibat.c 17 Aug 2023 06:57:45 - >> @@ -536,5 +536,7 @@ acpibat_notify(struct aml_node *node, in >> acpibat_refresh(sc); >> acpi_record_event(sc->sc_acpi, APM_POWER_CHANGE); >> >> +acpiac_battery_notify(); >> + >> return (0); >> } >> Index: sys/dev/acpi/acpidev.h >> === >> RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v >> retrieving revision 1.44 >> diff -u -p -r1.44 acpidev.h >> --- sys/dev/acpi/acpidev.h 29 Jun 2018 17:39:18 - 1.44 >> +++ sys/dev/acpi/acpidev.h 17 Aug 2023 06:57:45 - >> @@ -306,6 +306,8 @@ struct acpiac_softc { >> struct ksensordev sc_sensdev; >> }; >> >> +void acpiac_battery_notify(void); >> + >> struct acpibat_softc { >> struct device sc_dev; >> >> > > -- > lain.
Re: bioctl: do not confirm new passphrases on stdin
On 23-08-17 02:21:18, Klemens Nanni wrote: > On Fri, Aug 11, 2023 at 03:44:46PM +, Klemens Nanni wrote: > > On Wed, Aug 02, 2023 at 10:37:36AM +, Klemens Nanni wrote: > > > Creating new volumes prompts > > > Passphrase: > > > Re-type passphrase: > > > which is sane for interative usage, but -s (which omits prompts) to read > > > from stdin also prompts twice. > > > > > > I think that's neither intuitive nor ergonomical and as intended for > > > non-interactive scripts, -s should take a new passphase just once. > > > > > > Until a month ago, the manual errorneously said -s could not be used > > > during > > > initial creation anyway, so I worry little about existing scripts like > > > > > > printf '%s\n%s\n' "$pw" "$pw" | bioctl -s -cC -lsd0a softraid0 > > > > > > Diff below makes -s create new volumes with a single passphase: > > > > > > # echo secret | bioctl -s -Cforce -cC -lvnd0a softraid0 > > > bioctl: Passphrases did not match > > > # echo secret | ./obj/bioctl -s -Cforce -cC -lvnd0a softraid0 > > > softraid0: CRYPTO volume attached as sd3 > > > > > > Feedback? Objection? OK? > > > > Ping. > > I'll commit this in a few days unless I hear objections. > > The current -s behaviour is stupid; nothing else I know *silently* prompts > for passphrase *and* confirmation without anything in between. > > This stuff must be either interactive or quiet and one-shot, not in between. I agree with the intent, however the man page should probably reflect this change (i.e. -s makes it non-interactive and you will not get confirmation). > Index: bioctl.c > === > RCS file: /cvs/src/sbin/bioctl/bioctl.c,v > retrieving revision 1.151 > diff -u -p -r1.151 bioctl.c > --- bioctl.c 18 Oct 2022 07:04:20 - 1.151 > +++ bioctl.c 17 Aug 2023 02:16:37 - > @@ -989,7 +989,7 @@ bio_kdf_generate(struct sr_crypto_kdfinf > derive_key(kdfinfo->pbkdf.generic.type, kdfinfo->pbkdf.rounds, > kdfinfo->maskkey, sizeof(kdfinfo->maskkey), > kdfinfo->pbkdf.salt, sizeof(kdfinfo->pbkdf.salt), > - "New passphrase: ", 1); > + "New passphrase: ", rpp_flag == RPP_REQUIRE_TTY ? 1 : 0); I think it would be less ugly to have an iteractive global (or similar) and clear that when -s is given (the correct way to write the above would require masking rpp_flag). > } > > int
Re: diff: trigger acpiac_refresh when acpibat notification
If I understand correctly, you want to check the battery level, and give you a notification when battery is low, right? 正しく理解しているなら、YASUOKAさんはバッテリーのレベルを確認し、 バッテリーが低くなったら通知を受け取りたい、ということですよね? In this case, you can use apm for that. その場合、それには「apm」を使うことができます。 Battery level (percent) checking/バッテリーのレベル(パーセント)を確認するため:apm -l Estimated battery duration (minutes)/バッテリーが持つ予定の時間まで(分)を確認するため:apm -m On 2023年08月17日 16:12, YASUOKA Masahiko wrote: > Hi, > > Update the AC status when the battery notification is happened. > Because the AC status notification doesn't happen on some machines. > My vaio actually has this problem. > > Also Linux is doing the same thing > > https://github.com/torvalds/linux/blob/v6.4/drivers/acpi/ac.c#L165-L183 > > ok? comments? > > Index: sys/dev/acpi/acpiac.c > === > RCS file: /cvs/src/sys/dev/acpi/acpiac.c,v > retrieving revision 1.36 > diff -u -p -r1.36 acpiac.c > --- sys/dev/acpi/acpiac.c 6 Apr 2022 18:59:27 - 1.36 > +++ sys/dev/acpi/acpiac.c 17 Aug 2023 06:57:44 - > @@ -140,6 +140,8 @@ acpiac_getpsr(struct acpiac_softc *sc) > return (0); > } > > +static int acpiac_notify_triggered = 0; > + > int > acpiac_notify(struct aml_node *node, int notify_type, void *arg) > { > @@ -148,6 +150,8 @@ acpiac_notify(struct aml_node *node, int > dnprintf(10, "acpiac_notify: %.2x %s\n", notify_type, > DEVNAME(sc)); > > + acpiac_notify_triggered = 1; > + > switch (notify_type) { > case 0x00: > case 0x01: > @@ -164,4 +168,22 @@ acpiac_notify(struct aml_node *node, int > break; > } > return (0); > +} > + > +void > +acpiac_battery_notify(void) > +{ > + struct acpi_softc *sc = acpi_softc; > + struct acpi_ac *ac; > + > + if (acpiac_notify_triggered) > + return; > + /* > + * On some machines (vaio VJPK23 at least) AC status notifications > + * are not triggered. Update the AC status when battery notifications. > + */ > + SLIST_FOREACH(ac, >sc_ac, aac_link) { > + acpiac_refresh(ac->aac_softc); > + acpi_record_event(sc, APM_POWER_CHANGE); > + } > } > Index: sys/dev/acpi/acpibat.c > === > RCS file: /cvs/src/sys/dev/acpi/acpibat.c,v > retrieving revision 1.70 > diff -u -p -r1.70 acpibat.c > --- sys/dev/acpi/acpibat.c6 Apr 2022 18:59:27 - 1.70 > +++ sys/dev/acpi/acpibat.c17 Aug 2023 06:57:45 - > @@ -536,5 +536,7 @@ acpibat_notify(struct aml_node *node, in > acpibat_refresh(sc); > acpi_record_event(sc->sc_acpi, APM_POWER_CHANGE); > > + acpiac_battery_notify(); > + > return (0); > } > Index: sys/dev/acpi/acpidev.h > === > RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v > retrieving revision 1.44 > diff -u -p -r1.44 acpidev.h > --- sys/dev/acpi/acpidev.h29 Jun 2018 17:39:18 - 1.44 > +++ sys/dev/acpi/acpidev.h17 Aug 2023 06:57:45 - > @@ -306,6 +306,8 @@ struct acpiac_softc { > struct ksensordev sc_sensdev; > }; > > +void acpiac_battery_notify(void); > + > struct acpibat_softc { > struct device sc_dev; > > -- lain.
Re: bioctl: do not confirm new passphrases on stdin
On 2023/08/17 02:21:18 +, Klemens Nanni wrote: > On Fri, Aug 11, 2023 at 03:44:46PM +, Klemens Nanni wrote: > > On Wed, Aug 02, 2023 at 10:37:36AM +, Klemens Nanni wrote: > > > Creating new volumes prompts > > > Passphrase: > > > Re-type passphrase: > > > which is sane for interative usage, but -s (which omits prompts) to read > > > from stdin also prompts twice. > > > > > > I think that's neither intuitive nor ergonomical and as intended for > > > non-interactive scripts, -s should take a new passphase just once. > > > > > > Until a month ago, the manual errorneously said -s could not be used > > > during > > > initial creation anyway, so I worry little about existing scripts like > > > > > > printf '%s\n%s\n' "$pw" "$pw" | bioctl -s -cC -lsd0a softraid0 > > > > > > Diff below makes -s create new volumes with a single passphase: > > > > > > # echo secret | bioctl -s -Cforce -cC -lvnd0a softraid0 > > > bioctl: Passphrases did not match > > > # echo secret | ./obj/bioctl -s -Cforce -cC -lvnd0a softraid0 > > > softraid0: CRYPTO volume attached as sd3 > > > > > > Feedback? Objection? OK? > > > > Ping. > > I'll commit this in a few days unless I hear objections. > > The current -s behaviour is stupid; nothing else I know *silently* prompts > for passphrase *and* confirmation without anything in between. > > This stuff must be either interactive or quiet and one-shot, not in between. fwiw I agree, i find it dumb too to read the password twice when reading from, for e.g., a pipe. Outside of my comfort zone but it reads fine so ok op@. > Index: bioctl.c > === > RCS file: /cvs/src/sbin/bioctl/bioctl.c,v > retrieving revision 1.151 > diff -u -p -r1.151 bioctl.c > --- bioctl.c 18 Oct 2022 07:04:20 - 1.151 > +++ bioctl.c 17 Aug 2023 02:16:37 - > @@ -989,7 +989,7 @@ bio_kdf_generate(struct sr_crypto_kdfinf > derive_key(kdfinfo->pbkdf.generic.type, kdfinfo->pbkdf.rounds, > kdfinfo->maskkey, sizeof(kdfinfo->maskkey), > kdfinfo->pbkdf.salt, sizeof(kdfinfo->pbkdf.salt), > - "New passphrase: ", 1); > + "New passphrase: ", rpp_flag == RPP_REQUIRE_TTY ? 1 : 0); > } > > int
diff: trigger acpiac_refresh when acpibat notification
Hi, Update the AC status when the battery notification is happened. Because the AC status notification doesn't happen on some machines. My vaio actually has this problem. Also Linux is doing the same thing https://github.com/torvalds/linux/blob/v6.4/drivers/acpi/ac.c#L165-L183 ok? comments? Index: sys/dev/acpi/acpiac.c === RCS file: /cvs/src/sys/dev/acpi/acpiac.c,v retrieving revision 1.36 diff -u -p -r1.36 acpiac.c --- sys/dev/acpi/acpiac.c 6 Apr 2022 18:59:27 - 1.36 +++ sys/dev/acpi/acpiac.c 17 Aug 2023 06:57:44 - @@ -140,6 +140,8 @@ acpiac_getpsr(struct acpiac_softc *sc) return (0); } +static int acpiac_notify_triggered = 0; + int acpiac_notify(struct aml_node *node, int notify_type, void *arg) { @@ -148,6 +150,8 @@ acpiac_notify(struct aml_node *node, int dnprintf(10, "acpiac_notify: %.2x %s\n", notify_type, DEVNAME(sc)); + acpiac_notify_triggered = 1; + switch (notify_type) { case 0x00: case 0x01: @@ -164,4 +168,22 @@ acpiac_notify(struct aml_node *node, int break; } return (0); +} + +void +acpiac_battery_notify(void) +{ + struct acpi_softc *sc = acpi_softc; + struct acpi_ac *ac; + + if (acpiac_notify_triggered) + return; + /* +* On some machines (vaio VJPK23 at least) AC status notifications +* are not triggered. Update the AC status when battery notifications. +*/ + SLIST_FOREACH(ac, >sc_ac, aac_link) { + acpiac_refresh(ac->aac_softc); + acpi_record_event(sc, APM_POWER_CHANGE); + } } Index: sys/dev/acpi/acpibat.c === RCS file: /cvs/src/sys/dev/acpi/acpibat.c,v retrieving revision 1.70 diff -u -p -r1.70 acpibat.c --- sys/dev/acpi/acpibat.c 6 Apr 2022 18:59:27 - 1.70 +++ sys/dev/acpi/acpibat.c 17 Aug 2023 06:57:45 - @@ -536,5 +536,7 @@ acpibat_notify(struct aml_node *node, in acpibat_refresh(sc); acpi_record_event(sc->sc_acpi, APM_POWER_CHANGE); + acpiac_battery_notify(); + return (0); } Index: sys/dev/acpi/acpidev.h === RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v retrieving revision 1.44 diff -u -p -r1.44 acpidev.h --- sys/dev/acpi/acpidev.h 29 Jun 2018 17:39:18 - 1.44 +++ sys/dev/acpi/acpidev.h 17 Aug 2023 06:57:45 - @@ -306,6 +306,8 @@ struct acpiac_softc { struct ksensordev sc_sensdev; }; +void acpiac_battery_notify(void); + struct acpibat_softc { struct device sc_dev;