The problem you have introduced is that so_state is copied from sockets
to a sysctl record, where it also shows up as so_state.
At least fstat(8) looks at this field, and uses the old SS_CANTSENDMORE
bit you have deleted. The userland-visible name change is an API break.
Furthermore you moved it, but your new so_snd.sb_state value is not
exported in sysctl, and if we add this to sysctl it will be quite a big
ABI break. I suspect that is too expensive.
So what you need to here is leave the SS_* bits with their existing names.
You cannot change their names. It is exported API. You cannot change their
bit values either, it is exported ABI in sysctl.
What you can do is optionally use some bits in the socket, some bits in
so_snd, and some bits in so_rcv (I assume that is the future). And then
in kern_sysctl.c around line 1187 you can merge the bits, since they are
still unique:
kf->so_state = so->so_state | so->so_snd.sb_state | so->so_rcv.sb_state
This will mean fstat can see all the bits in the one sysctl sub-variable.
It means you must go very quickly rename, or you should consider backing
your commit out and trying again fresh.