source: trunk/src/emx/src/lib/io/ftruncat.c@ 2254

Last change on this file since 2254 was 2254, checked in by bird, 20 years ago

o LIBC_ASSERT*() are for internal libc errors, LIBCLOG_ERROR*() are

for user related error. Big code adjustements.

o Fixed a few smaller issues.
o Started fixing exec() backend.

  • Property cvs2svn:cvs-rev set to 1.8
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.5 KB
Line 
1/* $Id: $ */
2/** @file
3 *
4 * ftruncate().
5 *
6 * Copyright (c) 2004 knut st. osmundsen <[email protected]>
7 *
8 *
9 * This file is part of InnoTek LIBC.
10 *
11 * InnoTek LIBC is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published
13 * by the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * InnoTek LIBC is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with InnoTek LIBC; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27/*******************************************************************************
28* Header Files *
29*******************************************************************************/
30#include "libc-alias.h"
31#include <errno.h>
32#include <unistd.h>
33#include <InnoTekLIBC/backend.h>
34#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_IO
35#include <InnoTekLIBC/logstrict.h>
36
37int _STD(ftruncate)(int fh, off_t length)
38{
39 LIBCLOG_ENTER("fh=%d length=%lld\n", fh, length);
40 int rc = __libc_Back_ioFileSizeSet(fh, length, 1);
41 if (!rc)
42 LIBCLOG_RETURN_INT(0);
43 errno = -rc;
44 LIBCLOG_ERROR_RETURN_INT(-1);
45}
46
Note: See TracBrowser for help on using the repository browser.