writefile.c revision da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER START
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The contents of this file are subject to the terms of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Common Development and Distribution License (the "License").
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You may not use this file except in compliance with the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * See the License for the specific language governing permissions
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and limitations under the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When distributing Covered Code, include this CDDL HEADER in each
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If applicable, add the following below this CDDL HEADER, with the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * fields enclosed by brackets "[]" replaced with your own identifying
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information: Portions Copyright [yyyy] [name of copyright owner]
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER END
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* All Rights Reserved */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * University Copyright- Copyright (c) 1982, 1986, 1988
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The Regents of the University of California
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * All Rights Reserved
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * University Acknowledgment- Portions of this document are derived from
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * software developed by the University of California, Berkeley, and its
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * contributors.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Use is subject to license terms.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#pragma ident "%Z%%M% %I% %E% SMI"
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwwritefile(int fi, int fo, char *infile, char *outfile, char *asfile,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw " for path buffer: "));
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw " for path buffer: "));
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Determine size of initial mapping. This will determine the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * size of the address space chunk we work with. This initial
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * mapping size will be used to perform munmap() in the future.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Mmap time!
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (mapsize != 0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw for (;;) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * if we write less than the mmaped size it's due to a
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * media error on the input file or out of space on
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the output file. So, try again, and look for errno.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw while (remains > 0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * although the write manual page doesn't specify this
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * as a possible errno, it is set when the nfs read
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * via the mmap'ed file is accessed, so report the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * problem as a source access problem, not a target file
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw for (;;) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (n == 0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw } else if (n < 0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);