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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [libcsupport/] [src/] [chmod.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
2
 *  chmod() - POSIX 1003.1b 5.6.4 - Change File Modes
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
 *  chmod.c,v 1.9 2002/01/04 18:29:36 joel Exp
12
 */
13
 
14
#if HAVE_CONFIG_H
15
#include "config.h"
16
#endif
17
 
18
#include <rtems.h>
19
#include <rtems/libio.h>
20
#include <sys/stat.h>
21
#include <fcntl.h>
22
#include <errno.h>
23
#include <unistd.h>
24
 
25
#include <rtems/libio_.h>
26
#include <rtems/seterr.h>
27
 
28
int chmod(
29
  const char *path,
30
  mode_t      mode
31
)
32
{
33
  int                              status;
34
  rtems_filesystem_location_info_t loc;
35
  int                              result;
36
 
37
  status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE );
38
  if ( status != 0 )
39
    return -1;
40
 
41
  if ( !loc.handlers ){
42
    rtems_filesystem_freenode( &loc );
43
    rtems_set_errno_and_return_minus_one( EBADF );
44
  }
45
 
46
  if ( !loc.handlers->fchmod_h ){
47
    rtems_filesystem_freenode( &loc );
48
    rtems_set_errno_and_return_minus_one( ENOTSUP );
49
  }
50
 
51
  result = (*loc.handlers->fchmod_h)( &loc, mode );
52
 
53
  rtems_filesystem_freenode( &loc );
54
 
55
  return result;
56
}

powered by: WebSVN 2.1.0

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