OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [sys/] [mmixware/] [close.c] - Blame information for rev 258

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/* close for MMIXware.
2
 
3
   Copyright (C) 2001 Hans-Peter Nilsson
4
 
5
   Permission to use, copy, modify, and distribute this software is
6
   freely granted, provided that the above copyright notice, this notice
7
   and the following disclaimer are preserved with no changes.
8
 
9
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
10
   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
11
   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
12
   PURPOSE.  */
13
 
14
#include <_ansi.h>
15
#include <sys/types.h>
16
#include <sys/stat.h>
17
#include "sys/syscall.h"
18
#include <errno.h>
19
 
20
int
21
_close (int file)
22
{
23
  if ((unsigned int) file >= N_MMIX_FILEHANDLES
24
      || _MMIX_allocated_filehandle[file] == 0)
25
    {
26
      errno = EBADF;
27
      return -1;
28
    }
29
 
30
  _MMIX_allocated_filehandle[file] = 0;
31
 
32
  if (TRAP1f (SYS_Fclose, file) != 0)
33
    {
34
      errno = EIO;
35
      return -1;
36
    }
37
  return 0;
38
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.