truncate.c revision 165903
132317Syokota/* 232317Syokota * Copyright (c) 1992, 1993 332317Syokota * The Regents of the University of California. All rights reserved. 432317Syokota * 532317Syokota * Redistribution and use in source and binary forms, with or without 632317Syokota * modification, are permitted provided that the following conditions 732317Syokota * are met: 832317Syokota * 1. Redistributions of source code must retain the above copyright 932317Syokota * notice, this list of conditions and the following disclaimer. 1032317Syokota * 2. Redistributions in binary form must reproduce the above copyright 1132317Syokota * notice, this list of conditions and the following disclaimer in the 1232317Syokota * documentation and/or other materials provided with the distribution. 1332317Syokota * 4. Neither the name of the University nor the names of its contributors 1432317Syokota * may be used to endorse or promote products derived from this software 1532317Syokota * without specific prior written permission. 1632317Syokota * 1732317Syokota * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1832317Syokota * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1932317Syokota * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2032317Syokota * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2132317Syokota * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2232317Syokota * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2332317Syokota * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2432317Syokota * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2532317Syokota * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2632317Syokota * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2732317Syokota * SUCH DAMAGE. 2832317Syokota */ 2932317Syokota 3032317Syokota#if defined(LIBC_SCCS) && !defined(lint) 3132317Syokotastatic char sccsid[] = "@(#)truncate.c 8.1 (Berkeley) 6/17/93"; 3232317Syokota#endif /* LIBC_SCCS and not lint */ 3332317Syokota#include <sys/cdefs.h> 3432317Syokota__FBSDID("$FreeBSD: head/lib/libc/sys/truncate.c 165903 2007-01-09 00:28:16Z imp $"); 3532317Syokota 3632317Syokota#include <sys/types.h> 3732317Syokota#include <sys/syscall.h> 3832317Syokota 3932317Syokota#include <unistd.h> 4032317Syokota 4132317Syokota/* 4232317Syokota * This function provides 64-bit offset padding that 4332317Syokota * is not supplied by GCC 1.X but is supplied by GCC 2.X. 4432317Syokota */ 4532317Syokotaint 4632317Syokotatruncate(path, length) 4732317Syokota const char *path; 4832317Syokota off_t length; 4932317Syokota{ 5032317Syokota 5132317Syokota return(__syscall((quad_t)SYS_truncate, path, 0, length)); 5232317Syokota} 5332317Syokota