I am currently reading xv6 kernel source ported to 32bit x86. My question is regarding blocking io syscall, i.e., bread. I am expecting some trap handler in xv6 that sets its own process state to SLEEPING and calls yield(). However, I don't see any code fragment in xv6 kernel source. Please advise me if I missed the code fragment in the existing xv6 kernel source, or whether this is what students suppose to implement as a course project or not.
wait()does when no children have exited: it callssleep(), which does just what you suggested:p->state = SLEEPING; sched();.