>
> Hi,
>
> I dont no if this is a bug or a feature (using kernel 1.2.13):
>
> If the first write to a pipe is bigger than PIPE_BUF it would not block
> if nobody read on the other end. The next call to write blocks.
>
> If this is a feature, what is it good for?
I have tested it again but with pipes I can't reproduce it anymore (a
race condition?) But if I use a socket pair of unix domain sockets the
problem still occurs. I would write >4095 bytes but only 4095 bytes are
written without blocking. The next call blocks. Here is a simple program:
*******************
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
int main()
{
int a[2];
int n;
char b[16384];
/*pipe(a);*/
if (socketpair(AF_UNIX, SOCK_STREAM, 0, a) < 0) {
perror("");
exit(1);
}
n = write(a[1], b, 16384);
printf("%d\n", n);
/*write(a[1], b, 1);*/
}
******************
Ronald.
+-------------------------------------------------------------------+
| Ronald Wahl rwa@informatik.tu-chemnitz.de |
| >> PGP key available by finger << http://www.tu-chemnitz.de/~row |
+-------------------------------------------------------------------+
| PGP fingerprint: 9D 4A 66 7C A9 9F 6A 5F 90 45 D5 0C DF E5 CB 71 |
+-------------------------------------------------------------------+