if (fstat(fd_kern, &stat_buf)) { printf("error %d stating new fd %d\n", errno, fd);
if (machdep_sys_fstat(fd_kern, &stat_buf)) { PANIC();
int open(const char *path, int flags, ...){	int fd, mode, fd_kern;	struct stat stat_buf;	va_list ap;	/* If pthread scheduling == FIFO set a virtual timer */	if (flags & O_CREAT) {		va_start(ap, flags);		mode = va_arg(ap, int);		va_end(ap);	} else {		mode = 0;	}	if (!((fd = fd_allocate()) < OK)) {		fd_table[fd]->flags = flags;		flags |= __FD_NONBLOCK;		if (!((fd_kern = machdep_sys_open(path, flags, mode)) < OK)) {			/* fstat the file to determine what type it is */			if (fstat(fd_kern, &stat_buf)) {printf("error %d stating new fd %d\n", errno, fd);			}			if (S_ISREG(stat_buf.st_mode)) {				fd_table[fd]->ops = &(__fd_kern_ops);				fd_table[fd]->type = FD_HALF_DUPLEX;			} else {				fd_table[fd]->ops = &(__fd_kern_ops);				fd_table[fd]->type = FD_FULL_DUPLEX;			}			fd_table[fd]->fd = fd_kern; 			return(fd);		}		pthread_run->error = - fd_kern;		fd_table[fd]->count = 0;	}	return(NOTOK);}