我在试着弄出管子的尺寸:
printf("pipe 0 size: %d bytes\npipe 1 size: %d bytes\n", fcntl(fd[0], F_GETPIPE_SZ), fcntl(fd[1], F_GETPIPE_SZ));已使用的标题(其中一半被另一部分代码使用):
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/wait.h>当我试图编译时,gcc在以下错误中失败:
‘F_GETPIPE_SZ’未声明(在此函数中首次使用)内核版本-5.4.0-88-泛型
libc6-dev版本- 2.31-0ubuntu9.2
gcc版本- 4:9.3.0-1ubuntu2
发布于 2021-09-29 17:44:06
因为这个宏不是POSIX的一部分,所以必须在包含_GNU_SOURCE之前定义<fcntl.h>特性测试宏。
这在the fcntl(2) man page中的“符合”一节中有说明。
https://stackoverflow.com/questions/69381049
复制相似问题