sock.cc
来自「南京航空航天大学开发的一个类Unix和Linux的操作系统,好不好看看就知道了,」· CC 代码 · 共 38 行
CC
38 行
#include "root.h"#include "sock.h"#include "tcp.h"#include "udp.h"#include "raw.h"#include <lib/errno.h>int inetsocket(int domain, int type, int protocol){ sock_t * s = NULL; int e; switch (type) { case SOCKSTREAM: s = new tcpsock_t(); break; case SOCKDGRAM: s = new udpsock_t(); break; case SOCKRAW: if (!suser()) return EACCES; s = new rawsock_t(protocol); break; default: return EPROTONOSUPPORT; } e = curr->fdvec->put(s); if (e < 0) delete s; return e;}int inetsocketpair(int domain, int type, int protocol, int* pair){ return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?