作者:小傲骄FMJ | 来源:互联网 | 2023-05-19 09:57
WhywouldF_GETPIPE_SZreturn-1?Itsoundslikeanerror,butIcantfindanymentionofwhaterro
Why would F_GETPIPE_SZ return -1? It sounds like an error, but I can't find any mention of what error it is, or, more importantly, what I'm supposed to do to not get the error.
为什么F_GETPIPE_SZ返回-1?这听起来像是一个错误,但我找不到任何关于它是什么错误的,或者更重要的是,我应该做些什么来避免错误。
I'm running Raspbian on a Raspberry Pi, for what it's worth. I haven't tried the code on my desktop Debian yet. As far as I can tell, I'm following the textbook F_GETPIPE_SZ example. Am I missing something?
我在树莓派上运行的是Raspbian,它值多少钱。我还没试过桌面Debian的代码。据我所知,我是按照课本F_GETPIPE_SZ的例子。我遗漏了什么东西?
#define _GNU_SOURCE
#include
#include
#include
#include
int main(int argc, char **argv)
{
int fd, pipesize;
fd = mkfifo("/tmp/audio-fifo",0666);
// fcntl(fd, F_SETPIPE_SZ, 4096);
pipesize = fcntl(fd, F_GETPIPE_SZ);
printf("Pipe size: %d\n", pipesize);
return 0;
}
1 个解决方案