Commit 6a9f9e45 authored by Paul Sajna's avatar Paul Sajna

WIP on redox: 9203ead8 Merge pull request #67 from sajattack/patch-1

parents 9203ead8 8e3ab46b
#ifndef HAVE_OPENDIR
//#ifndef HAVE_OPENDIR
/*
* Copyright (c) 1983 Regents of the University of California.
......@@ -176,4 +176,4 @@ _DEFUN(alphasort, (d1, d2),
return(strcmp((*d1)->d_name, (*d2)->d_name));
}
#endif /* ! HAVE_OPENDIR */
//#endif /* ! HAVE_OPENDIR */
......@@ -225,7 +225,6 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
......
This diff is collapsed.
This diff is collapsed.
[root]
name = "newlib_redox"
version = "0.1.0"
dependencies = [
"byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins)",
"libc 0.2.30 (git+https://github.com/redox-os/liblibc)",
"redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "byteorder"
version = "1.1.0"
......@@ -17,12 +6,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "compiler_builtins"
version = "0.1.0"
source = "git+https://github.com/rust-lang-nursery/compiler-builtins#4d9df62fb76969eb2c38897ac57ff70f29d52c59"
source = "git+https://github.com/rust-lang-nursery/compiler-builtins#1be2858df7810b0cea8e794144d465dad1e6b9d7"
[[package]]
name = "libc"
version = "0.2.30"
source = "git+https://github.com/redox-os/liblibc#75b5c293322bf2dace86e14a4296095fc4f47752"
source = "git+https://github.com/redox-os/liblibc#d18565cf6fbfedaa12b7d0046f50e73d7aa5343e"
[[package]]
name = "newlib_redox"
version = "0.1.0"
dependencies = [
"byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins)",
"libc 0.2.30 (git+https://github.com/redox-os/liblibc)",
"redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "redox_syscall"
......
......@@ -179,7 +179,6 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
......
extern crate libc;
extern crate core;
use ::{c_int, c_char};
use syscall::{self, O_CLOEXEC, O_RDONLY, O_DIRECTORY};
use core::ptr::null;
use core::default::Default;
use alloc::boxed::Box;
use ::file::PATH_MAX;
use ::types::{ino_t, off_t};
use libc::*;
#[repr(C)]
pub struct dirent {
pub d_name: [c_char; PATH_MAX],
pub d_ino: ino_t,
pub d_off: off_t,
pub d_reclen: c_ushort,
pub d_type: c_uchar,
pub d_name: [c_char; PATH_MAX]
}
impl core::default::Default for dirent {
fn default() -> dirent {
dirent {
d_ino: 0,
d_off: 0,
d_reclen: 0,
d_type: 0,
d_name: [0; PATH_MAX],
}
}
}
pub struct DIR {
......@@ -22,7 +42,7 @@ libc_fn!(unsafe opendir(path: *mut c_char) -> Result<*mut DIR> {
let fd = ::RawFile::open(path, O_RDONLY | O_CLOEXEC | O_DIRECTORY)?;
let dir = Box::new(DIR {
fd,
ent: dirent { d_name: [0; PATH_MAX] },
ent: dirent::default(),
buf: [0; PATH_MAX],
count: 0,
pos: 0
......
......@@ -13,6 +13,25 @@ pub type sa_family_t = u16;
pub type socklen_t = libc::size_t;
pub type in_port_t = [u8; 2];
// Statvfs types
pub type dev_t = libc::c_ulong;
pub type ino_t = libc::c_ulong;
pub type mode_t = libc::c_uint;
pub type nlink_t = libc::c_ulong;
pub type uid_t = libc::c_uint;
pub type gid_t = libc::c_uint;
pub type off_t = libc::c_long;
pub type blksize_t = libc::c_long;
pub type blkcnt_t = libc::c_long;
pub type fsblkcnt_t = libc::c_ulong;
pub type fsfilcnt_t = libc::c_ulong;
pub type __fsword_t = libc::c_long;
#[repr(C)]
pub struct fsid_t {
__val: [libc::c_int; 2]
}
#[repr(C)]
pub struct in_addr {
pub s_addr: in_addr_t
......
#ifndef _SYS_DIRENT_H
#define _SYS_DIRENT_H
#include <sys/types.h>
#include <limits.h>
struct dirent {
char d_name[4096];
ino_t d_ino; /* inode number */
off_t d_off; /* offset to the next dirent */
unsigned short d_reclen; /* length of this record */
unsigned char d_type; /* type of file; not supported */
char d_name[PATH_MAX]; /* filename */
};
typedef struct __dirstream DIR;
#define _DIRENT_HAVE_D_RECLEN 1
#define _DIRENT_HAVE_D_TYPE 1
#define _DIRENT_HAVE_D_OFF 1
#define __dirfd(dir) (dir)->dd_fd
/* --- redundant --- */
#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
__BEGIN_DECLS
int closedir(DIR *);
DIR *opendir(const char *);
struct dirent *readdir(DIR *);
void rewinddir(DIR *);
int closedir(DIR *);
int scandir(const char *dirp, struct dirent ***namelist,
int (*filter)(const struct dirent *),
int (*compar)(const struct dirent **, const struct dirent **));
int alphasort(const struct dirent **d1, const struct dirent **d2);
__END_DECLS
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment