source: rtems/c/src/lib/libc/imfs_chown.c @ fcee56c0

4.104.114.84.95
Last change on this file since fcee56c0 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_chown
3 *
4 *  This routine is the implementation of the chown() system
5 *  call for the IMFS.
6 *
7 *  COPYRIGHT (c) 1989-1998.
8 *  On-Line Applications Research Corporation (OAR).
9 *  Copyright assigned to U.S. Government, 1994.
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.OARcorp.com/rtems/license.html.
14 *
15 *  $Id$
16 */
17
18#include <errno.h>
19#include "libio_.h"
20#include "imfs.h"
21
22int IMFS_chown(
23  rtems_filesystem_location_info_t  *pathloc,       /* IN */
24  uid_t                              owner,         /* IN */
25  gid_t                              group          /* IN */
26)
27{
28  IMFS_jnode_t  *jnode;
29#if defined(RTEMS_POSIX_API)
30  uid_t          st_uid;
31#endif
32
33  jnode = (IMFS_jnode_t *) pathloc->node_access;
34
35  /*
36   *  Verify I am the owner of the node or the super user.
37   */
38
39#if defined(RTEMS_POSIX_API)
40  st_uid = geteuid();
41
42  if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
43    set_errno_and_return_minus_one( EPERM );
44#endif
45
46  jnode->st_uid = owner;
47  jnode->st_gid = group;
48
49  IMFS_update_ctime( jnode );
50
51  return 0;
52}
Note: See TracBrowser for help on using the repository browser.