Skip to content

Commit

Permalink
Move alternate stat function for musl in compat.c
Browse files Browse the repository at this point in the history
  • Loading branch information
wberube committed Aug 19, 2024
1 parent 6556f56 commit 482ddd4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
17 changes: 17 additions & 0 deletions src/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@

#ifndef __UCLIBC__
void __stdin(void) {}

#ifndef __GLIBC__
#include <sys/stat.h>

struct _stat_ {
char padding[16];
int st_mode;
};

int sTaT(const char *path, struct _stat_ *buf)
{
struct stat st;
int ret = stat(path, &st);
buf->st_mode = st.st_mode;
return ret;
}
#endif
#endif

void __assert(void) {}
Expand Down
17 changes: 1 addition & 16 deletions src/hal/hisi/v1_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,19 +848,4 @@ int v1_system_init(char *snrConfig)
return EXIT_SUCCESS;
}

#include <sys/stat.h>

struct v1_stat {
char padding[16];
int st_mode;
};

int sTaT(const char *path, struct v1_stat *buf)
{
struct stat st;
int ret = stat(path, &st);
buf->st_mode = st.st_mode;
return ret;
}

#endif
#endif

0 comments on commit 482ddd4

Please sign in to comment.