rem: acquire_sem(loglock); fd = open(logfile, O_WRONLY | O_APPEND);
context: void log_printf(const char *text,...){	int fd;	char buf[1024];	va_list ap;	acquire_sem(loglock);	fd = open(logfile, O_WRONLY | O_APPEND);	va_start(ap,text);	vsprintf(buf,text,ap);	va_end(ap);	write(fd,buf,strlen(buf));	/* fsync(fd); */	close(fd);	release_sem(loglock);}