[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#285352: FIFO read doesn't block on SPARC

Package: libc6
Version: 2.3.2.ds1-19
Severity: normal

While debugging heartbeat on SPARC, i found a problem with FIFO reads 
returning early in blocking mode. This sample demonstrates the problem 
(reproducable on auric):

Do a "mknod /tmp/fifo -p" before running this: 

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main()
	int             fiforfd, i;
	FILE *          fifo;
	int             flags;
	char            buf[1000];
	char *          getsret;

	fiforfd = open("/tmp/fifo", O_RDONLY|O_NDELAY|O_NONBLOCK);
	i = open("/tmp/fifo", O_WRONLY);

        flags = fcntl(fiforfd, F_GETFL);
        flags &= ~O_NONBLOCK;
        fcntl(fiforfd, F_SETFL, flags);
        fifo = fdopen(fiforfd, "r");

	getsret = fgets(buf, sizeof(buf), fifo);
	printf("%s\n", buf);

On Intel, it will just block (as expected), but on SPARC it immediately 

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: sparc
Kernel: Linux 2.4.27-1-sparc32-smp
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro (charmap=ISO-8859-15)

Versions of packages libc6 depends on:
ii  libdb1-compat                 2.1.3-7    The Berkeley database routines [gl

-- no debconf information

Reply to: