爱死你了 发表于 2019-2-18 10:51:49

ubuntu 18.10 驱动级socket(ksocket)

  linux由于开源就比win好多了 很简单和3环一样
直接看内核源码 (深入了解用户层到内核层   查看linux 源码 tcpip实现 第20章)
分别在:sk->proto与ops
//net.h

struct socket {
socket_state      state;
unsigned long       flags;
const struct proto_ops*ops;
struct fasync_struct    *fasync_list;
struct file   *file;
struct sock   *sk;
wait_queue_head_t   wait;
short         type;
};

  //sock.h


struct sock {
.....
struct {
struct sk_buff *head;
struct sk_buff *tail;
} sk_backlog;
struct sk_buff_head sk_error_queue;
struct proto      *sk_prot_creator;
......
}
http://i2.运维网.com/images/blog/201812/13/92c3f654cc6375767fca78264b9b327a.png
http://i2.运维网.com/images/blog/201812/13/56016900e3bd24c9df2c0bca9763a23b.png
源码:
https://github.com/haidragon/linuxksocket
效果:
http://i2.运维网.com/images/blog/201812/11/35d80a1c5cc90150641bb0849b663a1e.png
  https://blog.csdn.net/u010039418/article/details/80628490



页: [1]
查看完整版本: ubuntu 18.10 驱动级socket(ksocket)