source: rtems/cpukit/libcsupport/src/unlink.c @ 8638d32b

Last change on this file since 8638d32b was 8638d32b, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2003 at 6:46:59 PM

2003-09-04 Joel Sherrill <joel@…>

  • include/chain.h, include/clockdrv.h, include/console.h, include/iosupp.h, include/rtc.h, include/spurious.h, include/timerdrv.h, include/vmeintr.h, include/motorola/mc68230.h, include/rtems/libcsupport.h, include/rtems/libio.h, include/rtems/libio_.h, include/rtems/termiostypes.h, include/sys/termios.h, include/zilog/z8036.h, include/zilog/z8530.h, include/zilog/z8536.h, src/brk.c, src/gettod.c, src/sbrk.c, src/times.c, src/access.c, src/base_fs.c, src/cfgetispeed.c, src/cfgetospeed.c, src/cfsetispeed.c, src/cfsetospeed.c, src/chdir.c, src/chmod.c, src/chown.c, src/chroot.c, src/close.c, src/ctermid.c, src/dup.c, src/dup2.c, src/eval.c, src/fchdir.c, src/fchmod.c, src/fcntl.c, src/fdatasync.c, src/fpathconf.c, src/fs_null_handlers.c, src/fstat.c, src/fsync.c, src/ftruncate.c, src/getdents.c, src/getpwent.c, src/hosterr.c, src/ioctl.c, src/isatty.c, src/libio.c, src/libio_sockets.c, src/link.c, src/lseek.c, src/lstat.c, src/malloc.c, src/mallocfreespace.c, src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mount.c, src/newlibc.c, src/no_libc.c, src/no_posix.c, src/open.c, src/pathconf.c, src/pipe.c, src/privateenv.c, src/read.c, src/readlink.c, src/rewinddir.c, src/rmdir.c, src/seekdir.c, src/stat.c, src/symlink.c, src/tcdrain.c, src/tcflow.c, src/tcflush.c, src/tcgetattr.c, src/tcgetprgrp.c, src/tcsendbreak.c, src/tcsetattr.c, src/tcsetpgrp.c, src/telldir.c, src/termios.c, src/termiosinitialize.c, src/truncate.c, src/umask.c, src/unixlibc.c, src/unlink.c, src/unmount.c, src/utime.c, src/write.c: URL for license changed.
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  unlink() - POSIX 1003.1b - 5.5.1 - Remove an existing link
3 *
4 *  COPYRIGHT (c) 1989-1999.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <errno.h>
19
20#include <rtems/libio_.h>
21#include <rtems/seterr.h>
22
23int unlink( 
24  const char *path
25)
26{
27  rtems_filesystem_location_info_t  loc;
28  int                               result;
29
30  /*
31   * Get the node to be unlinked.
32   */
33
34  result = rtems_filesystem_evaluate_path( path, 0, &loc, FALSE );
35  if ( result != 0 )
36     return -1;
37 
38  if ( !loc.ops->node_type_h ) {
39    rtems_filesystem_freenode( &loc );
40    rtems_set_errno_and_return_minus_one( ENOTSUP );
41  }
42
43  if (  (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) {
44    rtems_filesystem_freenode( &loc );
45    rtems_set_errno_and_return_minus_one( EISDIR );
46  }
47
48  if ( !loc.ops->unlink_h ) {
49    rtems_filesystem_freenode( &loc );
50    rtems_set_errno_and_return_minus_one( ENOTSUP );
51  }
52
53  result = (*loc.ops->unlink_h)( &loc );
54
55  rtems_filesystem_freenode( &loc );
56 
57  return result;
58}
59
60/*
61 *  _unlink_r
62 *
63 *  This is the Newlib dependent reentrant version of unlink().
64 */
65
66#if defined(RTEMS_NEWLIB)
67
68#include <reent.h>
69
70int _unlink_r(
71  struct _reent *ptr,
72  const char    *path
73)
74{
75  return unlink( path );
76}
77#endif
78
Note: See TracBrowser for help on using the repository browser.