]> Kevux Git Server - fll/commit
Update: Socket size_read/size_write checks, result == -1, and explicit passing .generic.
authorKevin Day <thekevinday@gmail.com>
Mon, 11 Dec 2023 06:26:27 +0000 (00:26 -0600)
committerKevin Day <thekevinday@gmail.com>
Mon, 11 Dec 2023 06:26:27 +0000 (00:26 -0600)
commitea5f6d56fd8fe3ad71b1b4d264ed0c8bb5e96fd2
treefaf43f3f53a057fe5bf2aaa4b2f110ad4bf54a3d
parentc1e06dd20cd25d6cf1dd7e94d5b72a61184cfc0b
Update: Socket size_read/size_write checks, result == -1, and explicit passing .generic.

Make sure size_read and size_write are not 0.
If either is 0, then return F_data_not.

Make sure the result checks are "== -1" rather than "< 0".

Explicitly pass .generic for the address union.
This probably isn't necessary but being explicit seems safer.
The memory address of the address union, regardless of the union type being used, is cast to 'struct sockaddr' in most cases.
This makes the use of ".generic" very practical.

Add documentation comment about F_pipe being returned.

Problems with the address unions ".sin_family" must be set or unclear F_pipe errors are returned.
I may in a future commit perform this assignment during setup because the "form" parameter makes this practical and reasonable to do.
15 files changed:
level_0/f_socket/c/socket.c
level_0/f_socket/c/socket.h
level_0/f_socket/tests/unit/c/test-socket-read.c
level_0/f_socket/tests/unit/c/test-socket-read.h
level_0/f_socket/tests/unit/c/test-socket-read_message.c
level_0/f_socket/tests/unit/c/test-socket-read_message.h
level_0/f_socket/tests/unit/c/test-socket-read_stream.c
level_0/f_socket/tests/unit/c/test-socket-read_stream.h
level_0/f_socket/tests/unit/c/test-socket-write.c
level_0/f_socket/tests/unit/c/test-socket-write.h
level_0/f_socket/tests/unit/c/test-socket-write_message.c
level_0/f_socket/tests/unit/c/test-socket-write_message.h
level_0/f_socket/tests/unit/c/test-socket-write_stream.c
level_0/f_socket/tests/unit/c/test-socket-write_stream.h
level_0/f_socket/tests/unit/c/test-socket.c