On non-Linux, it's []u8, which renders assignments of arrays of u8 to
([]u8 | keystore::key) illegal.
---
secstore/secstore.ha | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/secstore/secstore.ha b/secstore/secstore.ha
index b67054d..1612611 100644
--- a/secstore/secstore.ha
+++ b/secstore/secstore.ha
@@ -446,7 +446,7 @@ fn load_index(store: *secstore) (void | io::error | errors::invalid) = {
const buf = memio::fixed(line);
const dec = base64::newdecoder(&base64::std_encoding, &buf);
- const plaintext = secunbox(&dec, key)?;
+ const plaintext = secunbox(&dec, key: []u8)?;
const buf = memio::fixed(plaintext);
const q = match (query::parse(&buf)) {
--
2.43.0
It's a GNU-ism.
---
Makefile | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index c861fef..fcaf6fe 100644
--- a/Makefile
+++ b/Makefile
@@ -41,25 +41,25 @@ DOCS=\
docs: $(DOCS)
himitsud.1: docs/himitsud.1.scd
- $(SCDOC) <$< >$@
+ $(SCDOC) <docs/himitsud.1.scd >$@
himitsu-store.1: docs/himitsu-store.1.scd
- $(SCDOC) <$< >$@
+ $(SCDOC) <docs/himitsu-store.1.scd >$@
hiq.1: docs/hiq.1.scd
- $(SCDOC) <$< >$@
+ $(SCDOC) <docs/hiq.1.scd >$@
himitsu.ini.5: docs/himitsu.ini.5.scd
- $(SCDOC) <$< >$@
+ $(SCDOC) <docs/himitsu.ini.5.scd >$@
himitsu-ipc.5: docs/himitsu-ipc.5.scd
- $(SCDOC) <$< >$@
+ $(SCDOC) <docs/himitsu-ipc.5.scd >$@
himitsu-prompter.5: docs/himitsu-prompter.5.scd
- $(SCDOC) <$< >$@
+ $(SCDOC) <docs/himitsu-prompter.5.scd >$@
himitsu.7: docs/himitsu.7.scd
- $(SCDOC) <$< >$@
+ $(SCDOC) <docs/himitsu.7.scd >$@
clean:
rm -f himitsud himitsu-store hiq $(DOCS)
--
2.43.0
Signalfds are Linux-specific and not beneficial over self-pipes.
---
cmd/himitsud/main.ha | 15 +++++++++++----
cmd/himitsud/socket.ha | 11 ++++++-----
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/cmd/himitsud/main.ha b/cmd/himitsud/main.ha
index 303c7c1..607a724 100644
--- a/cmd/himitsud/main.ha
+++ b/cmd/himitsud/main.ha
@@ -10,6 +10,12 @@ use secstore;
use unix::signal;
use unix;
+fn handle(sig: signal::sig, info: *signal::siginfo, ucontext: *opaque) void = {
+ io::write(sigwrite, [sig: u8])!;
+};
+
+let sigwrite: io::file = -1;
+
export fn main() void = {
const cmd = getopt::parse(os::args,
// TODO: Add note warning against using this to himitsu man page
@@ -34,9 +40,10 @@ export fn main() void = {
};
defer secstore::close(&store);
- signal::block(signal::sig::INT, signal::sig::TERM);
- const sigfd = signal::signalfd(signal::sig::INT, signal::sig::TERM)!;
- defer io::close(sigfd)!;
+ let pipe = unix::pipe()!;
+ sigwrite = pipe.1;
+ signal::handle(signal::sig::INT, &handle);
+ signal::handle(signal::sig::TERM, &handle);
const conf = match (config::load()) {
case let conf: config::config =>
@@ -46,7 +53,7 @@ export fn main() void = {
};
defer config::finish(&conf);
- const sock = bind(&store, &conf, sigfd, daemonize);
+ const sock = bind(&store, &conf, pipe.0, daemonize);
if (daemonize) {
match (exec::fork()) {
diff --git a/cmd/himitsud/socket.ha b/cmd/himitsud/socket.ha
index 17f697f..38138c8 100644
--- a/cmd/himitsud/socket.ha
+++ b/cmd/himitsud/socket.ha
@@ -25,7 +25,7 @@ type server = struct {
store: *secstore::secstore,
conf: *config::config,
sock: net::socket,
- signalfd: io::file,
+ sigpipe: io::file,
pollfd: []poll::pollfd,
clients: []client,
disconnected: bool, // XXX: Bit of a hack here
@@ -37,7 +37,7 @@ type server = struct {
fn bind(
store: *secstore::secstore,
conf: *config::config,
- signalfd: io::file,
+ sigpipe: io::file,
daemonize: bool,
) server = {
const statedir = match (dirs::runtime()) {
@@ -77,7 +77,7 @@ fn bind(
events = event::POLLIN,
...
}, poll::pollfd {
- fd = signalfd,
+ fd = sigpipe,
events = event::POLLIN,
...
}]);
@@ -85,7 +85,7 @@ fn bind(
return server {
sock = sock,
conf = conf,
- signalfd = signalfd,
+ sigpipe = sigpipe,
pollfd = pollfd,
store = store,
daemonized = daemonize,
@@ -120,7 +120,8 @@ fn dispatch(serv: *server) bool = {
accept(serv);
};
if (serv.pollfd[1].revents & event::POLLIN != 0) {
- signal::read(serv.signalfd)!;
+ let buf: [1]u8 = [0];
+ io::read(serv.sigpipe, buf)!;
return false;
};
for (let i = POLLFD_RESERVED; i < len(serv.pollfd); i += 1) {
--
2.43.0
Specific ioctls in general aren't portable: There should be a function
for this in unix::tty.
---
cmd/hiprompt-tty/main.ha | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmd/hiprompt-tty/main.ha b/cmd/hiprompt-tty/main.ha
index 5590763..fd3a74e 100644
--- a/cmd/hiprompt-tty/main.ha
+++ b/cmd/hiprompt-tty/main.ha
@@ -32,7 +32,7 @@ export fn main() void = {
signal::block(signal::sig::TTOU);
let pgid = rt::getpgid(0)!;
- rt::ioctl(tty, 21520, &pgid)!; // TIOCSPGRP
+ rt::ioctl(tty, rt::TIOCSPGRP, &pgid)!;
let ctx = context {
tty = tty,
--
2.43.0