source: rtems/c/src/exec/libcsupport/src/rmdir.c @ 9c3fa30

4.104.114.84.95
Last change on this file since 9c3fa30 was 9c3fa30, checked in by Joel Sherrill <joel.sherrill@…>, on 09/28/00 at 20:19:23

2000-09-28 Joel Sherrill <joel@…>

  • libc/libio.h (rtems_filesystem_file_handlers_r, rtems_filesystem_operations_table): Added _h to all structure fields to indicate they are "handlers".
  • libc/libio_.h, libc/chdir.c, libc/chmod.c, libc/chown.c, libc/close.c, libc/eval.c, libc/fchdir.c, libc/fchmod.c, libc/fcntl.c, libc/fdatasync.c, libc/fstat.c, libc/fsync.c, libc/ftruncate.c, libc/getdents.c, libc/imfs_eval.c, libc/imfs_unlink.c, libc/ioctl.c, libc/ioman.c, libc/link.c, libc/lseek.c, libc/mknod.c, libc/mount.c, libc/open.c, libc/read.c, libc/readlink.c, libc/rmdir.c, libc/stat.c, libc/symlink.c, libc/unlink.c, libc/unmount.c, libc/utime.c, libc/write.c: Modified to reflect above name change.
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  rmdir() - POSIX 1003.1b - 5.2.2 - Remove a Directory
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.OARcorp.com/rtems/license.html.
10 *
11 *  $Id$
12 */
13
14#include <sys/types.h>
15#include <fcntl.h>
16#include <unistd.h>
17#include <errno.h>
18#include <stdlib.h>
19
20#include "libio_.h"
21
22int rmdir(
23  const char *pathname
24)
25{
26  rtems_filesystem_location_info_t  loc;
27  int                               result;
28
29  /*
30   *  Get the node where we wish to go.
31   */
32
33  result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE );
34  if ( result != 0 )
35     return -1;
36
37  /*
38   * Verify you can remove this node as a directory.
39   */
40
41  if ( !loc.ops->node_type_h ){
42    rtems_filesystem_freenode( &loc );
43    set_errno_and_return_minus_one( ENOTSUP );
44  }
45
46  if (  (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
47    rtems_filesystem_freenode( &loc );
48    set_errno_and_return_minus_one( ENOTDIR );
49  }
50
51  /*
52   * Use the filesystems rmnod to remove the node.
53   */
54
55  if ( !loc.handlers->rmnod_h ){
56    rtems_filesystem_freenode( &loc );
57    set_errno_and_return_minus_one( ENOTSUP );
58  }
59
60  result =  (*loc.handlers->rmnod_h)( &loc ); 
61
62  rtems_filesystem_freenode( &loc );
63 
64  return result;
65}
Note: See TracBrowser for help on using the repository browser.