mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-10-04 01:00:09 +00:00
Adding fsync function to libc glue functions
This commit is contained in:
@@ -17,7 +17,7 @@ CPPFLAGS = -I$(top_srcdir)/src/base \
|
|||||||
CFLAGS = @PSPSDK_CFLAGS@
|
CFLAGS = @PSPSDK_CFLAGS@
|
||||||
CCASFLAGS = $(CFLAGS)
|
CCASFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
CWD_OBJS = __cwd.o getcwd.o __path_absolute.o __init_cwd.o
|
CWD_OBJS = __cwd.o __get_drive.o getcwd.o __path_absolute.o __init_cwd.o
|
||||||
|
|
||||||
ERRNO_OBJS = __set_errno.o
|
ERRNO_OBJS = __set_errno.o
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ GLUE_OBJS = __fill_stat.o __psp_heap_blockid.o __psp_free_heap.o _fork.o _wait.o
|
|||||||
_stat.o lstat.o access.o _fcntl.o _lseek.o chdir.o mkdir.o rmdir.o getdents.o _seekdir.o _link.o _unlink.o \
|
_stat.o lstat.o access.o _fcntl.o _lseek.o chdir.o mkdir.o rmdir.o getdents.o _seekdir.o _link.o _unlink.o \
|
||||||
_rename.o _getpid.o _kill.o _sbrk.o _gettimeofday.o _times.o ftime.o _internal_malloc_lock.o _internal_malloc_unlock.o \
|
_rename.o _getpid.o _kill.o _sbrk.o _gettimeofday.o _times.o ftime.o _internal_malloc_lock.o _internal_malloc_unlock.o \
|
||||||
_isatty.o symlink.o truncate.o chmod.o fchmod.o fchmodat.o pathconf.o readlink.o utime.o fchown.o getentropy.o getpwuid.o \
|
_isatty.o symlink.o truncate.o chmod.o fchmod.o fchmodat.o pathconf.o readlink.o utime.o fchown.o getentropy.o getpwuid.o \
|
||||||
getpwnam.o getuid.o geteuid.o
|
fsync.o getpwnam.o getuid.o geteuid.o
|
||||||
|
|
||||||
|
|
||||||
INIT_OBJS = __libcglue_init.o __libcglue_deinit.o _exit.o abort.o exit.o
|
INIT_OBJS = __libcglue_init.o __libcglue_deinit.o _exit.o abort.o exit.o
|
||||||
|
@@ -25,6 +25,24 @@ char __cwd[MAXNAMLEN + 1] = { 0 };
|
|||||||
extern char __cwd[MAXNAMLEN + 1];
|
extern char __cwd[MAXNAMLEN + 1];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef F___get_drive
|
||||||
|
/* Return the number of bytes taken up by the "drive:" prefix,
|
||||||
|
or -1 if it's not found */
|
||||||
|
int __get_drive(const char *d)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i=0; d[i]; i++) {
|
||||||
|
if(! ((d[i] >= 'a' && d[i] <= 'z') ||
|
||||||
|
(d[i] >= '0' && d[i] <= '9') ))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(d[i] == ':') return i+1;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
int __get_drive(const char *d);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef F_getcwd
|
#ifdef F_getcwd
|
||||||
char *getcwd(char *buf, size_t size)
|
char *getcwd(char *buf, size_t size)
|
||||||
{
|
{
|
||||||
@@ -120,20 +138,6 @@ static int __path_normalize(char *out, int len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the number of bytes taken up by the "drive:" prefix,
|
|
||||||
or -1 if it's not found */
|
|
||||||
static int __get_drive(const char *d)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for(i=0; d[i]; i++) {
|
|
||||||
if(! ((d[i] >= 'a' && d[i] <= 'z') ||
|
|
||||||
(d[i] >= '0' && d[i] <= '9') ))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(d[i] == ':') return i+1;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert relative path to absolute path. */
|
/* Convert relative path to absolute path. */
|
||||||
int __path_absolute(const char *in, char *out, int len)
|
int __path_absolute(const char *in, char *out, int len)
|
||||||
{
|
{
|
||||||
|
@@ -50,6 +50,7 @@ extern unsigned int sce_newlib_heap_threshold_kb_size __attribute__((weak));
|
|||||||
|
|
||||||
/* Functions from cwd.c */
|
/* Functions from cwd.c */
|
||||||
extern char __cwd[MAXNAMLEN + 1];
|
extern char __cwd[MAXNAMLEN + 1];
|
||||||
|
int __get_drive(const char *d);
|
||||||
int __path_absolute(const char *in, char *out, int len);
|
int __path_absolute(const char *in, char *out, int len);
|
||||||
|
|
||||||
/* Functions from mutexman.c */
|
/* Functions from mutexman.c */
|
||||||
@@ -929,6 +930,24 @@ int getentropy(void *buffer, size_t length) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef F_fsync
|
||||||
|
int fsync(int fd) {
|
||||||
|
char devname[10]= { 0 };
|
||||||
|
int dr;
|
||||||
|
|
||||||
|
dr = __get_drive(__descriptormap[fd]->filename);
|
||||||
|
if (dr <= 0 || dr >= 10) {
|
||||||
|
errno = ENODEV;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
strncpy(devname, __descriptormap[fd]->filename, dr);
|
||||||
|
devname[dr] = '\0';
|
||||||
|
|
||||||
|
return __set_errno(sceIoSync(devname, 0));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef F_getuid
|
#ifdef F_getuid
|
||||||
uid_t getuid(void) {
|
uid_t getuid(void) {
|
||||||
return 1000;
|
return 1000;
|
||||||
|
Reference in New Issue
Block a user