73987be7d4
internal/pipewire: size without serialisation
...
This is required to achieve zero allocation (other than reflect).
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-27 02:17:38 +09:00
563b5e66fc
internal/pipewire: simplify spa_dict appends
...
This change uses the (somewhat) newly exposed MarshalAppend which improves readability.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-27 01:52:13 +09:00
2edcfe1e68
internal/pipewire: define size constants
...
This gets rid of magic numbers in marshal/unmarshal.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-27 00:54:56 +09:00
2698ca00e8
internal/pipewire: implement Core::Done
...
The message in the sample does not correspond to any known method call. The spec does not mention what to do with messages like this, but all existing usage code simply drops it.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-26 19:02:21 +09:00
1d0143386d
internal/pipewire: optional final trailing garbage check
...
Omitting the check is only useful for custom unmarshaler.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-26 18:50:39 +09:00
a55c209099
internal/pipewire: additional Client::Info test case
...
This appears to add *one single entry* compared to the message before it. The inefficiency of this protocol is beyond imagination.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-26 16:28:57 +09:00
10ff276da1
internal/pipewire: additional Client::Info test case
...
This message follows the other Client::Info event before it. No idea why.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-26 16:17:38 +09:00
fd4d379b67
internal/pipewire: implement Client::Info
...
Everything is already supported, as usual.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-26 16:05:46 +09:00
77f5b89a41
internal/pipewire: implement Core::BoundProps
...
Very straightforward type, everything is already supported.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 18:40:19 +09:00
14e33f17e5
internal/pipewire: check nil marshaler
...
NULL values have special case in the format. This check ensures correctness serialising nil pointers.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 18:36:08 +09:00
cfeb7818eb
internal/pipewire: implement Core::Info and generation footer
...
These are not directly related but are first encountered on the same message in the capture.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 15:16:12 +09:00
05391da556
internal/pipewire: implement footer
...
The POD itself is serialised without requiring a special case, however its presence is only indicated by the difference in size recorded in the header and payload.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 15:11:22 +09:00
463f8836e6
internal/pipewire: implement Long type
...
Thankfully no special case here.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 15:05:37 +09:00
2e465c94da
internal/pipewire: implement Id type
...
This is, in fact, just a glorified Int type.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 15:01:58 +09:00
26009fd3f7
internal/pipewire: slice at POD boundary
...
This prevents incorrectly reading trailing data as part of the current POD.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 14:58:56 +09:00
2d7b896a8c
internal/pipewire: bounds check against wire size
...
This covers cases where wire size is not known ahead of time.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 13:42:31 +09:00
a0eb010aab
internal/pipewire: spa_dict trailing garbage within POD
...
This performs the check within the bounds of the POD only. This was not caught since spa_dict was only used as the final struct field until now.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 13:39:02 +09:00
b1b27ac1df
internal/pipewire: zero size before validation
...
Leftover values from previous invocations cause incorrect behaviour here.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 12:21:37 +09:00
fc3d78fe01
internal/pipewire: implement Core::Sync
...
Once again, already entirely supported, the offset is not yet fully verified but makes intuitive sense. Will verify this on future occurrences of the message.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 08:52:06 +09:00
591637264a
internal/pipewire: implement Core::GetRegistry
...
This struct is entirely supported, so this change is very straightforward.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 08:34:19 +09:00
e77652bf89
internal/pipewire: move test data to files
...
These get very big later on, and would be painful to represent as the compound literal.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 08:09:10 +09:00
88d3e46413
internal/pipewire: implement Client::UpdateProperties
...
This is the second message on the captured sample.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 04:16:11 +09:00
e51e81bb22
internal/pipewire: implement spa_dict type
...
This is a terrible type that defies the type system. It is implemented on the concrete type to avoid special cases.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 04:08:52 +09:00
8f4a3bcf9f
internal/pipewire: use custom marshaler when available
...
This reduces special cases. This change also exposes unmarshalled message size on the wire.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 04:05:22 +09:00
827dc9e1ba
internal/pipewire: implement string type
...
This is still NUL terminated strings, and an extra NUL character on an 8-byte string does cause an extra 7 bytes of padding.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 04:00:59 +09:00
d92de1c709
internal/pipewire: check for trailing garbage
...
This is useful during development.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 01:59:29 +09:00
5bcafcf734
internal/pipewire: implement Core::Hello
...
This implements enough types to correctly marshal and unmarshal Core::Hello.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-25 01:20:30 +09:00
9f7b0c2f46
internal/pipewire: add type constants
...
This change also centralises encoding testing.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-24 22:00:09 +09:00
3e87187c4c
internal/pipewire: implement message header
...
Test cases are from interactions between pw-container and PipeWire. Results are validated against corresponding body.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-23 16:20:35 +09:00
aab92ce3c1
internal/wayland: clean up pathname socket
...
This is cleaner than cleaning up in internal/system as it covers the failure paths.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-19 06:37:04 +09:00
a495e09a8f
internal/wayland: do not double close fd
...
These are already closed during securityContextBindPipe on a non-nil error.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-17 22:03:29 +09:00
3afca2bd5b
internal/wayland: expose WAYLAND_VERSION
...
This might be useful troubleshooting information.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-17 01:46:01 +09:00
b73a789dfe
.clang-format: increase indent width
...
This significantly increases readability. This patch is pretty big so it is being done after mostly everything has settled.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-16 20:57:29 +09:00
38b5ff0cec
internal/wayland: check pathname size
...
This avoids passing a truncated pathname to the kernel.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-16 03:34:05 +09:00
3c204b9b40
internal/wayland: increase error detail
...
This includes targeted paths in the returned errors.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-16 02:09:50 +09:00
00771efeb4
internal/wayland: remove fd typecasts
...
These are no longer necessary since RawConn is no longer used.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-16 01:45:37 +09:00
61972d61f6
internal/wayland: reimplement connect/bind code
...
The old implementation is relocated to system/wayland/deprecated.go.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-16 01:23:16 +09:00
fe40af7b7e
internal/wayland: relocate connection struct
...
This interface is getting replaced, so relocating it to the deprecated wrapper package before working on its replacement.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-15 23:25:46 +09:00
12751932d1
internal/wayland: improve error handling
...
Note: wl_registry_add_listener is undocumented everywhere. Its implementation calls wl_proxy_add_listener which returns 0 on success or -1 on failure.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-15 21:26:31 +09:00
41b49137a8
.clang-format: do not limit line length
...
This hard limit destroys readability in some places.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-15 17:06:43 +09:00
c761e1de4d
nix: build with clang
...
Clang is better than gcc in various ways. This also pulls in clang-format which is very helpful.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-15 16:36:36 +09:00
a91920310d
internal: relocate packages
...
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-15 13:58:34 +09:00
47244daefb
treewide: migrate ldd callers
...
This discontinues use of the deprecated ldd.Exec function for #25 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 21:59:59 +09:00
a9d72a5eb1
internal/outcome: rename run from main
...
The "main.go" name is quite confusing as this is often only present in main packages.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 01:06:14 +09:00
6d14bb814f
container/fhs: add constant for /dev/shm/
...
This is mounted for the default read-only /dev/ when programs want to use shm_open(3). Defining it here is less error-prone and saves the extra append at runtime.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-14 01:03:26 +09:00
be0e387ab0
internal/info: relocate from internal
...
This is cleaner and makes more sense. The longer LDFLAGS was never a valid concern since it is always inserted by a script.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-13 07:29:46 +09:00
abeb67964f
treewide: document linkname uses
...
These provide justification for each use of linkname. Poorly thought out uses of linkname are removed.
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-13 07:14:16 +09:00
bf5d10743f
treewide: import internal/system
...
For #24 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-13 01:22:47 +09:00
4e7aab07d5
internal/system: relocate from system
...
These packages are highly specific to hakurei and are difficult to use safely from other pieces of code.
Their exported symbols are made available until v0.4.0 where they will be removed for #24 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-13 01:17:47 +09:00
15a66a2b31
treewide: import internal/helper
...
For #24 .
Signed-off-by: Ophestra <cat@gensokyo.uk >
2025-11-12 23:19:34 +09:00