Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

size of named pipe

Posted on 2001-07-26
8
Medium Priority
?
662 Views
Last Modified: 2013-12-27
Hi All!

I have a problem with named pipes. I'm only able to send 1024 bytes with putpmsg. If I try to send more I get an error (ERANGE).

How can I change the maximum size of named pipes ?
0
Comment
Question by:superschlonz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 5

Expert Comment

by:paulqna
ID: 6322255
Please look for strbuf in a file called stropts.h

On solaris this can be found in /usr/include/sys/stropts.h
0
 
LVL 3

Author Comment

by:superschlonz
ID: 6322808
I'm using this structure (also tried to set maxlen=len instead of zero).

And I'm sure I was able to send up to about 3000 bytes some days ago. But after a lot of changes in my source code I always get an ERANGE error when sending 2828 bytes.

I wrote a little testprogram to find out how many bytes are accepted and it shows 1024 (for control part which we use).
And it also shows that I can send 5120 bytes for the data part.

For sending the data we use the ctl part and I'm sure that I didn't touch that. OK, now I'll try sending the data in the data part, perhaps it works.
0
 
LVL 3

Author Comment

by:superschlonz
ID: 6322835
I saw, this would be very much work.

Is it possible to increase the maximum size of the ctl part ?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 5

Expert Comment

by:paulqna
ID: 6323915
Maybe you can find your answer here :
http://docsun.cso.uiuc.edu/cgi-bin/nph-dweb/ab2/coll.45.13/STREAMS/@Ab2TocView/24220

This example illustrates a simple loop, with the application reading data from the communications device, then writing the input back to the same device,
echoing all input back over the communications line. The program reads up to 1024 bytes at a time, and then writes the number of bytes just read.

read returns the available data, which can contain fewer than 1024 bytes. If no data is currently available at the stream head, read(2) blocks until data
arrives.
Simple Stream

#include <sys/fcntl.h>
#include <stdio.h>
main()
{
  char buf[1024];
  int fd, count;
   if ((fd = open("/dev/ttya", O_RDWR)) < 0) {
   perror("open failed");
   exit(1);
  }
  while ((count = read(fd, buf, sizeof(buf))) > 0) {
   if (write(fd, buf, count) != count) {
    perror("write failed");
    break;
   }
  }
  exit(0);
}
0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6326946
Pipe devices just aren't designed for this sort of thing.

You need  your writing program to buffer its output so it won't fill the pipe and you need your reading program to keep reading until it gets the whole thing.

Using stdio should solve the buffering problem easily enough.

If the reader knows the size of the structure it needs to read, then things are easy enough on the reading side too (just keep reading until you get the whole thing, as suggested by paulgna).  Otherwise you might need to prepend the structure with its size so the reader knows how much data it should expect to slurp up.
0
 
LVL 3

Author Comment

by:superschlonz
ID: 6331584
Perhaps they aren't designed for that but they support it (at least since 2.6 and ReliantUNIX/SINIX since 5.42).

I cannot replace the mechanism because I need these bands for sending priorized messages (and because the software is very old and very complex).

This complexity was also the reason why I believed why my changes had nothing to do with the messages sent over the pipe. Now that I found it, I was able to reduce the maximum size to about 900 bytes again as was before my changes and it works.

But I'm still interested in increasing the size because I'm sure I'll run into this problem again and will perhaps not be able to do such a small workaround like this time.

I have also seen some kernel parameters for setting the size for ctl and data part of these system calls, but they aren't set int my /etc/system and default to 64kB.
0
 
LVL 14

Accepted Solution

by:
chris_calabrese earned 150 total points
ID: 6334420
You probably have to recompile the kernel to change this.  Don't remember what vbl deals with this anymore (used to know back when the default was 512 bytes and we used to change this all the time).
0
 
LVL 3

Author Comment

by:superschlonz
ID: 6486245
I hoped I wouldn't need to do that...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question