Implemented utime().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1952 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2935bff656
commit
0dd93a6eb7
@ -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 ;
|
||||
|
32
src/kernel/libroot/posix/utime.c
Normal file
32
src/kernel/libroot/posix/utime.c
Normal 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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user