source: rtems/cpukit/libcsupport/src/utime.c @ 183af89

4.115
Last change on this file since 183af89 was 2563410, checked in by Sebastian Huber <sebastian.huber@…>, on 03/13/12 at 08:22:11

Filesystem: Rename defines

o Removed RTEMS_LIBIO_PERMS_SEARCH.
o Renamed RTEMS_LIBIO_PERMS_READ in RTEMS_FS_PERMS_READ.
o Renamed RTEMS_LIBIO_PERMS_WRITE in RTEMS_FS_PERMS_WRITE.
o Renamed RTEMS_LIBIO_PERMS_EXEC in RTEMS_FS_PERMS_EXEC.
o Renamed RTEMS_LIBIO_FOLLOW_HARD_LINK in RTEMS_FS_FOLLOW_HARD_LINK.
o Renamed RTEMS_LIBIO_FOLLOW_SYM_LINK in RTEMS_FS_FOLLOW_SYM_LINK.
o Renamed RTEMS_LIBIO_MAKE in RTEMS_FS_MAKE.
o Renamed RTEMS_LIBIO_EXCLUSIVE in RTEMS_FS_EXCLUSIVE.
o Renamed RTEMS_LIBIO_ACCEPT_RESIDUAL_DELIMITERS in

RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS.

o Renamed RTEMS_LIBIO_REJECT_TERMINAL_DOT in
RTEMS_FS_REJECT_TERMINAL_DOT.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  utime() - POSIX 1003.1b 5.5.6 - Set File Access and Modification Times
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/* FIXME: This include is a workaround for a broken <utime.h> in Newlib */
19#include <sys/types.h>
20
21#include <utime.h>
22
23#include <rtems/libio_.h>
24
25int utime( const char *path, const struct utimbuf *times )
26{
27  int rv = 0;
28  rtems_filesystem_eval_path_context_t ctx;
29  int eval_flags = RTEMS_FS_FOLLOW_LINK;
30  const rtems_filesystem_location_info_t *currentloc =
31    rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
32  struct utimbuf now_times;
33
34  if ( times == NULL ) {
35    time_t now = time( NULL );
36
37    now_times.actime = now;
38    now_times.modtime = now;
39
40    times = &now_times;
41  }
42
43  rv = (*currentloc->ops->utime_h)(
44    currentloc,
45    times->actime,
46    times->modtime
47  );
48
49  rtems_filesystem_eval_path_cleanup( &ctx );
50
51  return rv;
52}
Note: See TracBrowser for help on using the repository browser.