Skip to content

Commit a768d74

Browse files
crystalctSalvo Cristaldi
andauthored
Added utime and sysFsUtime (#84)
Addedd sysLv2FsUtime and utime Co-authored-by: Salvo Cristaldi <scristaldi@cca.unict.it>
1 parent e5c33d8 commit a768d74

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

ppu/crt/crt1.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ extern int __librt_rmdir_r(struct _reent *r,const char *dirname);
3838
extern int __librt_link_r(struct _reent *r,const char *old,const char *new);
3939
extern int __librt_unlink_r(struct _reent *r,const char *path);
4040
extern int __librt_access_r(struct _reent *r,const char *path,int amode);
41+
extern int __librt_utime_r(struct _reent *r,const char *path,const struct utimbuf *times);
4142

4243
extern int __librt_usleep_r(struct _reent *r,useconds_t usec);
4344
extern unsigned int __librt_sleep_r(struct _reent *r,unsigned int seconds);
@@ -88,6 +89,7 @@ static void __syscalls_init(void)
8889
__syscalls.link_r = __librt_link_r;
8990
__syscalls.unlink_r = __librt_unlink_r;
9091
__syscalls.access_r = __librt_access_r;
92+
__syscalls.utime_r = __librt_utime_r;
9193

9294
__syscalls.sleep_r = __librt_sleep_r;
9395
__syscalls.usleep_r = __librt_usleep_r;

ppu/include/lv2/sysfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ s32 sysFsMkdir(const char* path, s32 mode);
7171
s32 sysFsRmdir(const char *path);
7272
s32 sysFsUnlink(const char *path);
7373
s32 sysFsAccess(const char *path,s32 amode);
74+
s32 sysFsUtime(const char *path, sysFSUtimbuf *times);
7475

7576
s32 sysFsOpendir(const char *path, s32 *fd);
7677
s32 sysFsClosedir(s32 fd);

ppu/librt/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ OBJS := \
4646
sbrk.o exit.o close.o lseek.o read.o open.o sleep.o write.o fstat.o \
4747
socket.o lock.o dirent.o mkdir.o times.o umask.o lv2errno.o heap.o \
4848
chmod.o rename.o rmdir.o isatty.o gettod.o settod.o unlink.o access.o \
49-
link.o truncate.o fsync.o
49+
link.o truncate.o fsync.o utime.o
5050

5151
all: ppu
5252

ppu/librt/utime.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include <stdio.h>
2+
#include <fcntl.h>
3+
#include <_ansi.h>
4+
#include <_syslist.h>
5+
#include <sys/reent.h>
6+
#include <sys/errno.h>
7+
#include <sys/types.h>
8+
#include <sys/lv2errno.h>
9+
10+
#include <sys/file.h>
11+
#include <utime.h>
12+
13+
int
14+
_DEFUN(__librt_utime_r,(r,path,times),
15+
struct _reent *r _AND
16+
const char *path _AND
17+
const struct utimbuf *times)
18+
{
19+
sysFSUtimbuf t;
20+
if (times)
21+
{
22+
t.actime = times->actime;
23+
t.modtime = times->modtime;
24+
}
25+
else
26+
{
27+
time_t now = time(NULL);
28+
t.actime = now;
29+
t.modtime = now;
30+
}
31+
32+
return lv2errno_r(r,sysLv2FsUtime(path,&t));
33+
}

ppu/sprx/libsysfs/exports.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ EXPORT(sysFsOpendir, 0x3F61245C);
1616
EXPORT(sysFsClosedir, 0xFF42DCC3);
1717
EXPORT(sysFsReaddir, 0x5C74903D);
1818
EXPORT(sysFsAccess, 0x06E681ED);
19+
EXPORT(sysFsUtime, 0xBEF554A4);
1920
EXPORT(sysFsAioInit, 0xDB869F20);
2021
EXPORT(sysFsAioReadEx, 0xC1C507E7);
2122
EXPORT(sysFsAioWriteEx, 0x4CEF342E);

0 commit comments

Comments
 (0)