source: rtems/c/src/lib/libc/imfs_fchmod.c @ 2782e69

4.104.114.84.95
Last change on this file since 2782e69 was 07a3253d, checked in by Joel Sherrill <joel.sherrill@…>, on 11/23/98 at 19:07:58

Added base version of file system infrastructure. This includes a major
overhaul of the RTEMS system call interface. This base file system is
the "In-Memory File System" aka IMFS.

The design and implementation was done by the following people:

+ Joel Sherrill (joel@…)
+ Jennifer Averett (jennifer@…)
+ Steve "Mr Mount" Salitasc (salitasc@…)
+ Kerwin Wade (wade@…)

PROBLEMS
========

+ It is VERY likely that merging this will break the UNIX port. This

can/will be fixed.

+ There is likely some reentrancy/mutual exclusion needed.

+ Eventually, there should be a "mini-IMFS" description table to

eliminate links, symlinks, etc to save memory. All you need to
have "classic RTEMS" functionality is technically directories
and device IO. All the rest could be left out to save memory.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  IMFS file change mode routine.
3 *
4 *  COPYRIGHT (c) 1989-1998.
5 *  On-Line Applications Research Corporation (OAR).
6 *  Copyright assigned to U.S. Government, 1994.
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <errno.h>
16
17#include "libio_.h"
18#include "imfs.h"
19
20int IMFS_fchmod(
21  rtems_filesystem_location_info_t *loc,
22  mode_t                            mode
23)
24{
25  IMFS_jnode_t  *jnode;
26#if defined(RTEMS_POSIX_API)
27  uid_t          st_uid;
28#endif
29   
30  jnode = loc->node_access;
31
32  /*
33   *  Verify I am the owner of the node or the super user.
34   */
35#if defined(RTEMS_POSIX_API)
36  st_uid = geteuid();
37
38  if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
39    set_errno_and_return_minus_one( EPERM );
40#endif
41
42  /*
43   * Change only the RWX permissions on the jnode to mode.
44   */
45  if ( mode & (~ (S_IRWXU | S_IRWXG | S_IRWXO ) ) )
46    set_errno_and_return_minus_one( EPERM );
47
48  jnode->st_mode &= ~(S_IRWXU | S_IRWXG | S_IRWXO);
49  jnode->st_mode |= mode;
50
51  IMFS_update_ctime( jnode );
52
53  return 0;
54}
55
Note: See TracBrowser for help on using the repository browser.