【问题标题】:Can you any body help me about tcp_sk and udp_sk this type of functions?你能帮我了解一下 tcp_sk 和 udp_sk 这种类型的功能吗?
【发布时间】:2014-06-06 07:18:28
【问题描述】:

我在 linux 堆栈中探索了上述函数,了解他们在函数类型转换中做了什么,但我怀疑他们的类型转换是更多字节到更少字节。它应该如何工作以及如何在类型转换后存储值。请问它是如何工作的,这意味着 struct sock 与其他结构相比是大结构。但仍然是它的类型转换。你能请任何人帮助我解决上述问题吗

【问题讨论】:

    标签: linux networking linux-kernel


    【解决方案1】:
    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;
    

    ...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-15
      • 2021-01-28
      • 1970-01-01
      • 2020-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-03
      相关资源
      最近更新 更多