Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(doc):添加网络子系统模块 #1020

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
kernel/ktest/index
kernel/cpu_arch/index
kernel/libs/index
kernel/net/index


.. toctree::
Expand Down
8 changes: 8 additions & 0 deletions docs/kernel/net/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
网络子系统
====================================
DragonOS 网络子系统

.. toctree::
:maxdepth: 1

unix
22 changes: 22 additions & 0 deletions docs/kernel/net/unix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# UNIX

## unix socket

unix - 用于进程间通信的socket


## 描述

AF_UNIX socket family 用于在同一台机器中的不同进程之间的通信(IPC)。unix socket地址现支持绑定文件地址,未支持绑定abstract namespace抽象命名空间。

目前unix 域中合法的socket type有:SOCK_STREAM, 提供stream-oriented socket,可靠有序传输消息;SOCK_SEQPACKET,提供connection-oriented,消息边界和按发送顺序交付消息保证的socket。

### unix stream socket 进程通信描述

unix stream socket 提供进程间流式传输消息的功能。假设对端进程作为服务端,本端进程作为客户端。进程间使用stream socket通信过程如下:

分别在对端进程和本端进程创建socket,服务端需要bind地址,客户端不必须bind地址。通信过程类似tcp三次握手流程:服务端调用listen系统调用进入监听状态,监听服务端bind的地址;客户端调用connect系统调用连接服务端地址;服务端调用accept系统调用接受来自客户端的连接,返回建立连接的新的socket。成功建立连接后可以调用write\send\sendto\sendmsg进行写操作,调用read\recv\recvfrom\recvmsg进行读操作。目前尚未支持非阻塞式读写,默认为阻塞式读写。读写完毕后调用close系统调用关闭socket连接。

### unix seqpacket socket 进程通信描述


Loading