snprintf(errmsg, sizeof errmsg, "lseek %s, %s", from_name, strerror(errno));
snprintf(errmsg, sizeof errmsg, "%s: lseek %s, %s", funcname, from_name, strerror(errno));
copy(Tcl_Interp *interp, int from_fd, const char *from_name, int to_fd, const char *to_name,     off_t size){	int nr, nw;	int serrno;	char *p, buf[MAXBSIZE];	int done_copy;	/* Rewind file descriptors. */	if (lseek(from_fd, (off_t)0, SEEK_SET) == (off_t)-1) {		char errmsg[255];		snprintf(errmsg, sizeof errmsg, "lseek %s, %s", from_name, strerror(errno));		Tcl_SetResult(interp, errmsg, TCL_VOLATILE);		return TCL_ERROR;	}	if (lseek(to_fd, (off_t)0, SEEK_SET) == (off_t)-1) {		char errmsg[255];		snprintf(errmsg, sizeof errmsg, "lseek %s, %s", to_name, strerror(errno));		Tcl_SetResult(interp, errmsg, TCL_VOLATILE);		return TCL_ERROR;	}	/*	 * Mmap and write if less than 8M (the limit is so we don't totally	 * trash memory on big files.  This is really a minor hack, but it	 * wins some CPU back.	 */	done_copy = 0;	if (size <= 8 * 1048576 && trymmap(from_fd) &&	    (p = mmap(NULL, (size_t)size, PROT_READ, MAP_SHARED,		    from_fd, (off_t)0)) != (char *)MAP_FAILED) {		if ((nw = write(to_fd, p, size)) != size) {			char errmsg[255];			serrno = errno;			(void)unlink(to_name);			errno = nw > 0 ? EIO : serrno;			snprintf(errmsg, sizeof errmsg, "write error on %s, %s",				 to_name, strerror(errno));			Tcl_SetResult(interp, errmsg, TCL_VOLATILE);			return TCL_ERROR;		}		done_copy = 1;	}	if (!done_copy) {		while ((nr = read(from_fd, buf, sizeof(buf))) > 0)			if ((nw = write(to_fd, buf, nr)) != nr) {				char errmsg[255];				serrno = errno;				(void)unlink(to_name);				errno = nw > 0 ? EIO : serrno;				snprintf(errmsg, sizeof errmsg, "write error on %s, %s",					 to_name, strerror(errno));				Tcl_SetResult(interp, errmsg, TCL_VOLATILE);				return TCL_ERROR;			}		if (nr != 0) {			char errmsg[255];			serrno = errno;			(void)unlink(to_name);			errno = serrno;			snprintf(errmsg, sizeof errmsg, "error on %s, %s",				 from_name, strerror(errno));			Tcl_SetResult(interp, errmsg, TCL_VOLATILE);			return TCL_ERROR;		}	}	return TCL_OK;}