我在linux堆栈中探索了上面的函数,他们在函数类型转换中理解了什么,但我怀疑它们的类型转换是更多的字节到更少的字节。它应该如何工作以及如何在类型转换后存储值。请问它是如何工作的,这意味着struct sock是一个比其他人更大的结构。但仍然是它的类型铸造。你能不能请任何人帮我解决问题
答案 0 :(得分:0)
struct tcp_sock {
/* inet_connection_sock has to be the first member of tcp_sock */
struct inet_connection_sock inet_conn;
...
struct inet_connection_sock {
/* inet_sock has to be the first member! */
struct inet_sock icsk_inet;
...
struct inet_sock {
/* sk and pinet6 has to be the first two members of inet_sock */
struct sock sk;
...