I've been studying Stevens' "Unix Network Programming", and I decided to write a program to investigate the fcntl system call. The program below is supposed to print the status flags for the file in question. It in fact prints 0. Is this likely to be correct? Stevens is not specific as to what the third argument for fcntl should be.
#define thisprog "/home/vexil/fcntltest"
int value, fd;
if ((fd = open(thisprog, 0)) < 0)
printf("Error with open\n");
if ((value = fcntl(fd, F_GETFL, 0)) < 0)
printf("Error with fcntl\n");
printf("Status flags are: %d\n", value);