摘要: TCP 服务端 接收到ack tcp_v4_rcv() -> tcp_v4_do_rcv() -> tcp_v4_hnd_req() + tcp_child_process()tcp_v4_hnd_req() -> tcp_check_req() -> tcp_v4_syn_recv_sock()t 阅读全文
posted @ 2019-07-07 20:39 codestacklinuxer 阅读(944) 评论(0) 推荐(0) 编辑
摘要: tcp_v4_send_synack()用于发送SYNACK段,在tcp_v4_conn_request()中被调用。 首先调用tcp_make_synack()构造SYNACK段,主要是构造TCP报头和初始化skb中的一些字段 /* * 该结构主要描述双方的地址、所支持的TCP选项等 tcp_re 阅读全文
posted @ 2019-07-07 19:56 codestacklinuxer 阅读(774) 评论(0) 推荐(0) 编辑
摘要: rcv 分析: /* The socket must have it's spinlock held when we get * here, unless it is a TCP_LISTEN socket. * * We have a potential double-lock case here 阅读全文
posted @ 2019-07-05 00:47 codestacklinuxer 阅读(1379) 评论(0) 推荐(0) 编辑
摘要: proto socket 关联结构: { .type = SOCK_STREAM, .protocol = IPPROTO_TCP, .prot = &tcp_prot, .ops = &inet_stream_ops, .flags = INET_PROTOSW_PERMANENT | INET_ 阅读全文
posted @ 2019-07-05 00:05 codestacklinuxer 阅读(1010) 评论(0) 推荐(0) 编辑
摘要: /*ipv4_specific是TCP传输层到网络层数据发送以及TCP建立过程的真正OPS, 在tcp_prot->init中被赋值给inet_connection_sock->icsk_af_ops 这里面有每种协议传输层的接收函数,后面的inetsw_array那几行是套接口层的相关函数 在函数 阅读全文
posted @ 2019-07-04 17:22 codestacklinuxer 阅读(903) 评论(0) 推荐(0) 编辑
摘要: 简介 sys_connect->inet_stream_connect->inet_stream_connect->tcp_v4_connect->tcp_connect对于tcp,inet_stream_connect()调用tcp_v4_connect发送三次握手的第一次syn请求, 并根据so 阅读全文
posted @ 2019-07-01 23:17 codestacklinuxer 阅读(960) 评论(0) 推荐(0) 编辑
摘要: static int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb, int hdrlen, bool *fragstolen) { int eaten; /* 取队尾 */ struct sk_buff *tail 阅读全文
posted @ 2019-07-01 23:14 codestacklinuxer 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 来之google 收索结果 f ull 和 empty 。信号量mutex作为互斥信号量,它用于控制互斥访问缓冲池,互斥信号量初值为 1;信号量 full 用于记录当前缓冲池中“满”缓冲区数,初值为0。信号量 empty 用于记录当前缓冲池中“空”缓冲区数,初值为n。新的数据添加到缓存中后,full 阅读全文
posted @ 2019-07-01 23:14 codestacklinuxer 阅读(1107) 评论(0) 推荐(0) 编辑
摘要: 直接看代码 //后面整理相关信息 /* * This function implements the receiving procedure of RFC 793 for * all states except ESTABLISHED and TIME_WAIT. * It's called fro 阅读全文
posted @ 2019-07-01 23:13 codestacklinuxer 阅读(826) 评论(2) 推荐(0) 编辑
摘要: fork、vfork、clone之间的差异 fork/vfork/clone这三者均为系统调用,进程或线程通过这三种系统调用的某一种来创建子进程/线程, 这三种调用的底层实现均为linux内核源码kernel/fork.c中的do_fork()函数来实现,它们间的唯一的差别就是传入的参数值有差异。 阅读全文
posted @ 2019-07-01 23:12 codestacklinuxer 阅读(165) 评论(0) 推荐(0) 编辑