Skip to content

Write Unix socket addresses in refcount getsockname - #584

Open
perfloop-agent wants to merge 2 commits into
Cpp2Rust:masterfrom
perfloop-oss:perfloop-pr-open-f6sjmr9796
Open

perfloop-agent wants to merge 2 commits into
Cpp2Rust:masterfrom
perfloop-oss:perfloop-pr-open-f6sjmr9796

Conversation

@perfloop-agent

Copy link
Copy Markdown
Contributor

Summary

Refcount getsockname now writes the family and address bytes for Unix sockets instead of returning success with an unchanged output buffer. The Unix branch of the shared encoder copies no more than the caller's capacity or the actual address length, leaves the suffix untouched, and reports the full length. getpeername and recvfrom inherit the same Unix writeback.

tests/unit/socket_unix_name.c checks unnamed and pathname-bound sockets, shortened buffers, returned lengths and protected suffixes. It uses sockaddr_storage buffers and the platform's returned length rather than assuming an unnamed length or a sockaddr_un size. The new refcount fixture fails against the unchanged runtime at the missing-family assertion.

Addresses that nix cannot represent as UnixAddr retain the existing fallback. IP output length and capacity handling, and Unix input decoding, are unchanged. Native-byte comparison is Linux-scoped.

Testing

The lit runner reports 1,058 passed, 14 expected failures, and 0 failures in tests/unit for each Linux Release and Debug build; the Release runs report 76 passed in tests/ub and 20 passed in tests/multi-file, with no failures or skips.

On the base revision with only the new test files added, tests/unit reports 1,057 passed, 14 expected failures, and 1 failure: socket_unix_name.c/refcount, at the missing-family assertion.

check-libcc2rs passes 70 unit tests, with 0 failures or ignored tests and 0 doctests. check-libcc2rs-macros passes 1 compile-fail test and 22 control-flow tests, with 0 failures or ignored tests and 0 doctests.

ninja format completed without changing any files.

macOS validation remains target-CI-owned.

Case and evidence


Made by Perfloop. Human sponsor: Tomás Senart. To ask for a change, comment or review in plain words. How Perfloop handles pull requests.

Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Tomás Senart <ts@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Tomás Senart <ts@perfloop.ai>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant