“The two structures are essentially connected” - not sure what you meant.
I think you could find the answer if you look at the source files for these structures:
socket -> linux-src/include/linux/net.h sock -> linux-src/include/net/sock.h
power socket
* NET An implementation of the SOCKET network access protocol. * This is the master header file for the Linux NET layer, * or, in plain English: the networking handling part of the * kernel.
sock
* INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level.
These structures are different and have a different representation of socket abstraction.
Here answer about different sockets.
Unix vs BSD vs TCP vs Internet sockets?
Where to define an additional field depends on your intention. Describe your task.
Please see the sources.
Linux-src / include / linux / net.h
..... ..... ..... struct socket { socket_state state; kmemcheck_bitfield_begin(type); short type; kmemcheck_bitfield_end(type); unsigned long flags; struct socket_wq __rcu *wq; struct file *file; struct sock *sk; const struct proto_ops *ops; };
Linux-SRC / enable / network / sock.h
.... .... .... struct sock { struct sock_common __sk_common;
0x8BADF00D
source share