Skip to contentSkip to conversation

pipe/fcntl/F_GETFL/F_SETFL obvious kernel bug

BUG 2.5.X Jean Tourrilhes 2 participants 3 messages Apr 24, 2003

lore
Share & tools
lore
#0 lore raw
	Hi,

	I reported this obvious kernel 2.5.X bug 6 months ago, and as
of 2.5.67 it is still not fixed. Do you know who I should send this
bug report to ?
	Thanks...

	Jean

---------------------------------------------

	Compile test program below.
	On 2.5.67 :
GET FLAGS : 0 - 40044F18
SET FLAGS : -1 - 22
	On 2.4.21-pre7 :

GET FLAGS : 0 - 40043F18
SET FLAGS : 0 - 0
---------------------------------------------
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>

int main()
{
int trigger_pipe[2];
int err;
int flags;

  pipe(trigger_pipe);

err = fcntl(trigger_pipe[0], F_GETFL, &flags); fprintf(stderr, "GET FLAGS : %d - %X\n", err, flags); if(err >= 0)

    {
      flags |= O_NONBLOCK;
      //flags |= O_NDELAY;
      //flags &= ~O_NDELAY;
      err = fcntl(trigger_pipe[0], F_SETFL, flags);
      fprintf(stderr, "SET FLAGS : %d - %d\n", err, errno);
    }

return(0);
}

#1 lore raw
Quoted 6 lines · Jean Tourrilhes
	Hi,

	I reported this obvious kernel 2.5.X bug 6 months ago, and as

of 2.5.67 it is still not fixed. Do you know who I should send this bug report to ?

fcntl(fd, F_GETFL, intp) does not put the return value into *intp. The flags are in fcntl()'s return value. Same with 2.4.

#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>

int main()

{
	int trigger_pipe[2];
	int err;
	int flags;
	int newflags;

	pipe(trigger_pipe);

	/* Get flags */
	flags = fcntl(trigger_pipe[0], F_GETFL, NULL);
	fprintf(stderr, "Set flags: 0x%x\n", flags);

	/* Set flags */
	flags |= O_NONBLOCK;
	err = fcntl(trigger_pipe[0], F_SETFL, flags);
	fprintf(stderr, "Set flags: %d\n", err);

	/* Check flags */
	flags = fcntl(trigger_pipe[0], F_GETFL, NULL);
	fprintf(stderr, "Get flags: 0x%0x\n", flags);
}
#2 lore raw
Quoted 10 lines · Andrew Morton
Quoted 6 lines · Jean Tourrilhes
	Hi,

	I reported this obvious kernel 2.5.X bug 6 months ago, and as

of 2.5.67 it is still not fixed. Do you know who I should send this bug report to ?

fcntl(fd, F_GETFL, intp) does not put the return value into *intp. The flags are in fcntl()'s return value. Same with 2.4.

*blush*. Thanks for the quick and precise answer, and sorry
about the noise.

Jean