【发布时间】:2014-06-06 07:18:28
【问题描述】:
我在 linux 堆栈中探索了上述函数,了解他们在函数类型转换中做了什么,但我怀疑他们的类型转换是更多字节到更少字节。它应该如何工作以及如何在类型转换后存储值。请问它是如何工作的,这意味着 struct sock 与其他结构相比是大结构。但仍然是它的类型转换。你能请任何人帮助我解决上述问题吗
【问题讨论】:
标签: linux networking linux-kernel
我在 linux 堆栈中探索了上述函数,了解他们在函数类型转换中做了什么,但我怀疑他们的类型转换是更多字节到更少字节。它应该如何工作以及如何在类型转换后存储值。请问它是如何工作的,这意味着 struct sock 与其他结构相比是大结构。但仍然是它的类型转换。你能请任何人帮助我解决上述问题吗
【问题讨论】:
标签: linux networking linux-kernel
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;
...
【讨论】: