Implemented utime().

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1952 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2002-11-15 22:44:08 +00:00
parent 2935bff656
commit 0dd93a6eb7
2 changed files with 34 additions and 0 deletions

View File

@ -8,6 +8,7 @@ KernelMergeObject posix_main.o :
<$(SOURCE_GRIST)>poll.c
<$(SOURCE_GRIST)>pwd.c
<$(SOURCE_GRIST)>rlimit.c
<$(SOURCE_GRIST)>utime.c
:
-fPIC -DPIC
;
@ -15,6 +16,7 @@ KernelMergeObject posix_main.o :
MergeObjectFromObjects kernel_posix_main.o :
<$(SOURCE_GRIST)>errno.o
<$(SOURCE_GRIST)>poll.o
<$(SOURCE_GRIST)>utime.o
;
SubInclude OBOS_TOP src kernel libroot posix malloc ;

View File

@ -0,0 +1,32 @@
/*
** Copyright 2002, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
#include <utime.h>
#include <errno.h>
#include <syscalls.h>
#define RETURN_AND_SET_ERRNO(err) \
if (err < 0) { \
errno = err; \
return -1; \
} \
return err;
int
utime(const char *path, const struct utimbuf *buffer)
{
struct stat stat;
status_t status;
stat.st_atime = buffer->actime;
stat.st_mtime = buffer->modtime;
status = sys_write_path_stat(path, false, &stat, FS_WRITE_STAT_MTIME | FS_WRITE_STAT_ATIME);
RETURN_AND_SET_ERRNO(status);
}