是否可以在Linux上更改命名管道的大小? [英] Is it possible to change the size of a named pipe on Linux?

查看:754
本文介绍了是否可以在Linux上更改命名管道的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道对于当前版本的Linux内核,命名管道的大小为64K.可以完全增加这个大小吗?

I know that for the current version of the Linux kernel, the size of named pipes is 64K. Is it possible to increase this size at all?

我知道我可以切换到套接字,但是首先我想看看是否可以通过仅增加命名管道的大小来解决间歇性的缓冲区溢出问题.

I know I can switch to sockets, but first I'd like to see if I can solve an intermittent buffer-overflow problem by just increasing the named-pipe size.

推荐答案

使用最新的内核(> = 2.6.35),可以使用以下命令更改管道的大小

With recent kernels (>= 2.6.35), you can change the size of a pipe with

fcntl(fd, F_SETPIPE_SZ, size)

,其中sizelong.最大大小在/proc/sys/fs/pipe-max-size中.

where size is a long. The maximum size is in /proc/sys/fs/pipe-max-size.

这篇关于是否可以在Linux上更改命名管道的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆