Advertisement

Xv6 消息管道

阅读量:
Meaning Unknown's Head Image

Xv6 管道

参考: xv6-riscv-book 1.3 Pipes

文章目录

  • Xv6 管道
    • pipe
    • 管道 V.S. 临时文件

pipe

Xv6系统中使用管程调用函数 pipe() 来创建管道;可以类比为 Go 语言中使用的通道机制 chan;在 Shell 编程中常用符号 | 来表示数据流的连接;例如,在 Shell 中执行命令 echo 'hello world' 后跟 wc 命令时可以通过以下代码来实现

复制代码
    // upipe.c
    //
    // Runs the program wc with standard input connected to the read end of a pipe.
    
    #include "kernel/types.h"
    #include "kernel/stat.h"

全部评论 (0)

还没有任何评论哟~