/* * This function reads n bytes from the file * specified by descriptor fd and copies them to * the memory area addressed by buf. */ #include ssize_t read(int fd, void *buf, size_t n) { /* * - Check that fd is a valid descriptor */ /* * - Check that buf points to a valid memory area */ /* * - Check that n is a non-negative number */ /* * - Attempt to read the requested number of bytes */ /* * - Return number of bytes actually read, 0 in case * of end of file, -1 in case of error. */ }