Skip to content

Commit

Permalink
Use opendir from newlib
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtrujy committed Nov 26, 2023
1 parent 3193c85 commit 06b0b98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion newlib/configure.host
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ case "${host}" in
mips*-ps2-*)
sys_dir=ps2
posix_dir=posix
newlib_cflags="${newlib_cflags} -G0 -DHAVE_NANOSLEEP -DHAVE_OPENDIR"
newlib_cflags="${newlib_cflags} -G0 -DHAVE_NANOSLEEP -DHAVE_RENAME"
;;
mmix-knuth-mmixware)
sys_dir=mmixware
Expand Down
24 changes: 21 additions & 3 deletions newlib/libc/sys/ps2/sys/dirent.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
#define _SYS_DIRENT_H

typedef struct __dirdesc {
int dd_fd;
char *dd_buf;
int dd_fd; /* directory file */
int dd_loc; /* position in buffer */
int dd_seek;
char *dd_buf; /* buffer */
int dd_len; /* buffer length */
int dd_size; /* amount of data in buffer */
} DIR;

# define __dirfd(dp) ((dp)->dd_fd)
Expand All @@ -16,8 +20,22 @@ typedef struct __dirdesc {
#define d_ino d_fileno /* compatibility */

struct dirent {
struct stat d_stat;
ino_t d_fileno; /* file number of entry */
off_t d_off; /* Not an offset; see below */
unsigned short int d_reclen; /* Length of this record */
unsigned char d_type; /* Type of file; not supported
by all filesystem types */
char d_name[MAXNAMLEN + 1];
};

#define DT_UNKNOWN 0
#define DT_FIFO 1
#define DT_CHR 2
#define DT_DIR 4
#define DT_BLK 6
#define DT_REG 8
#define DT_LNK 10
#define DT_SOCK 12
#define DT_WHT 14

#endif

0 comments on commit 06b0b98

Please sign in to comment.