ftruncate.c revision 1.2
11.2Scgd/* 21.2Scgd * Copyright (c) 1992, 1993 31.2Scgd * The Regents of the University of California. All rights reserved. 41.2Scgd * 51.2Scgd * Redistribution and use in source and binary forms, with or without 61.2Scgd * modification, are permitted provided that the following conditions 71.2Scgd * are met: 81.2Scgd * 1. Redistributions of source code must retain the above copyright 91.2Scgd * notice, this list of conditions and the following disclaimer. 101.2Scgd * 2. Redistributions in binary form must reproduce the above copyright 111.2Scgd * notice, this list of conditions and the following disclaimer in the 121.2Scgd * documentation and/or other materials provided with the distribution. 131.2Scgd * 3. All advertising materials mentioning features or use of this software 141.2Scgd * must display the following acknowledgement: 151.2Scgd * This product includes software developed by the University of 161.2Scgd * California, Berkeley and its contributors. 171.2Scgd * 4. Neither the name of the University nor the names of its contributors 181.2Scgd * may be used to endorse or promote products derived from this software 191.2Scgd * without specific prior written permission. 201.2Scgd * 211.2Scgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221.2Scgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231.2Scgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241.2Scgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251.2Scgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261.2Scgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271.2Scgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281.2Scgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291.2Scgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301.2Scgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311.2Scgd * SUCH DAMAGE. 321.2Scgd */ 331.2Scgd 341.2Scgd#if defined(LIBC_SCCS) && !defined(lint) 351.2Scgd/* from: static char sccsid[] = "@(#)ftruncate.c 8.1 (Berkeley) 6/17/93"; */ 361.2Scgdstatic char *rcsid = "$Id: ftruncate.c,v 1.2 1994/05/06 01:02:52 cgd Exp $"; 371.2Scgd#endif /* LIBC_SCCS and not lint */ 381.1Scgd 391.1Scgd#include <sys/types.h> 401.1Scgd#include <sys/syscall.h> 411.1Scgd 421.2Scgd/* 431.2Scgd * This function provides 64-bit offset padding that 441.2Scgd * is not supplied by GCC 1.X but is supplied by GCC 2.X. 451.2Scgd */ 461.1Scgdint 471.2Scgdftruncate(fd, length) 481.2Scgd int fd; 491.2Scgd off_t length; 501.1Scgd{ 511.1Scgd 521.2Scgd return(__syscall((quad_t)SYS_ftruncate, fd, 0, length)); 531.1Scgd} 54