projects
/
nestedvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
897fa3c
)
more syscalls for gcc
author
brian
<brian@brianweb.net>
Wed, 5 May 2004 03:29:48 +0000
(20:29 -0700)
committer
brian
<brian@brianweb.net>
Wed, 5 May 2004 03:29:48 +0000
(20:29 -0700)
darcs-hash:
20040505032948
-24bed-
16cbd0b53adc68fe5eace1048d22a53c11016204
.gz
src/org/ibex/nestedvm/UnixRuntime.java
patch
|
blob
|
history
src/org/ibex/nestedvm/UsermodeConstants.java
patch
|
blob
|
history
src/org/ibex/nestedvm/support.s
patch
|
blob
|
history
src/org/ibex/nestedvm/support_aux.c
patch
|
blob
|
history
src/org/ibex/nestedvm/syscalls.h
patch
|
blob
|
history
diff --git
a/src/org/ibex/nestedvm/UnixRuntime.java
b/src/org/ibex/nestedvm/UnixRuntime.java
index
32a3c75
..
a6847ee
100644
(file)
--- a/
src/org/ibex/nestedvm/UnixRuntime.java
+++ b/
src/org/ibex/nestedvm/UnixRuntime.java
@@
-101,6
+101,7
@@
public abstract class UnixRuntime extends Runtime implements Cloneable {
case SYS_fork: return sys_fork();
case SYS_pipe: return sys_pipe(a);
case SYS_dup2: return sys_dup2(a,b);
case SYS_fork: return sys_fork();
case SYS_pipe: return sys_pipe(a);
case SYS_dup2: return sys_dup2(a,b);
+ case SYS_dup: return sys_dup(a);
case SYS_waitpid: return sys_waitpid(a,b,c);
case SYS_stat: return sys_stat(a,b);
case SYS_lstat: return sys_lstat(a,b);
case SYS_waitpid: return sys_waitpid(a,b,c);
case SYS_stat: return sys_stat(a,b);
case SYS_lstat: return sys_lstat(a,b);
@@
-434,6
+435,15
@@
public abstract class UnixRuntime extends Runtime implements Cloneable {
return 0;
}
return 0;
}
+ private int sys_dup(int oldd) {
+ if(oldd < 0 || oldd >= OPEN_MAX) return -EBADFD;
+ if(fds[oldd] == null) return -EBADFD;
+ FD fd = fds[oldd].dup();
+ int newd = addFD(fd);
+ if(newd < 0) { fd.close(); return -ENFILE; }
+ return newd;
+ }
+
private int sys_stat(int cstring, int addr) throws FaultException, ErrnoException {
FStat s = gs.stat(this,normalizePath(cstring(cstring)));
if(s == null) return -ENOENT;
private int sys_stat(int cstring, int addr) throws FaultException, ErrnoException {
FStat s = gs.stat(this,normalizePath(cstring(cstring)));
if(s == null) return -ENOENT;
diff --git
a/src/org/ibex/nestedvm/UsermodeConstants.java
b/src/org/ibex/nestedvm/UsermodeConstants.java
index
36ea781
..
5f3d358
100644
(file)
--- a/
src/org/ibex/nestedvm/UsermodeConstants.java
+++ b/
src/org/ibex/nestedvm/UsermodeConstants.java
@@
-41,6
+41,7
@@
public interface UsermodeConstants {
public static final int SYS_getdents = 36;
public static final int SYS_memcpy = 37;
public static final int SYS_memset = 38;
public static final int SYS_getdents = 36;
public static final int SYS_memcpy = 37;
public static final int SYS_memset = 38;
+ public static final int SYS_dup = 39;
public static final int EPERM = 1; /* Not super-user */
public static final int ENOENT = 2; /* No such file or directory */
public static final int ESRCH = 3; /* No such process */
public static final int EPERM = 1; /* Not super-user */
public static final int ENOENT = 2; /* No such file or directory */
public static final int ESRCH = 3; /* No such process */
diff --git
a/src/org/ibex/nestedvm/support.s
b/src/org/ibex/nestedvm/support.s
index
e603b6e
..
2af9010
100644
(file)
--- a/
src/org/ibex/nestedvm/support.s
+++ b/
src/org/ibex/nestedvm/support.s
@@
-127,3
+127,4
@@
SYSCALL_R(link)
SYSCALL_R(getdents)
SYSCALL(memcpy)
SYSCALL(memset)
SYSCALL_R(getdents)
SYSCALL(memcpy)
SYSCALL(memset)
+SYSCALL_R(dup)
diff --git
a/src/org/ibex/nestedvm/support_aux.c
b/src/org/ibex/nestedvm/support_aux.c
index
097c9b0
..
c8e8d2b
100644
(file)
--- a/
src/org/ibex/nestedvm/support_aux.c
+++ b/
src/org/ibex/nestedvm/support_aux.c
@@
-74,6
+74,7
@@
REENT_WRAPPER2(chmod,const char *,mode_t)
REENT_WRAPPER2(fchmod,int,mode_t)
REENT_WRAPPER2(lstat,const char *,struct stat *)
REENT_WRAPPER4(getdents,int, char *, size_t,long *)
REENT_WRAPPER2(fchmod,int,mode_t)
REENT_WRAPPER2(lstat,const char *,struct stat *)
REENT_WRAPPER4(getdents,int, char *, size_t,long *)
+REENT_WRAPPER1(dup,int)
extern int __execve_r(struct _reent *ptr, const char *path, char *const argv[], char *const envp[]);
int _execve(const char *path, char *const argv[], char *const envp[]) {
extern int __execve_r(struct _reent *ptr, const char *path, char *const argv[], char *const envp[]);
int _execve(const char *path, char *const argv[], char *const envp[]) {
@@
-97,6
+98,10
@@
char *_getcwd_r(struct _reent *ptr, char *buf, size_t size) {
}
}
}
}
+pid_t _wait_r(struct _reent *ptr, int *status) {
+ return _waitpid_r(ptr,-1,status,0);
+}
+
DIR *opendir(const char *path) {
struct stat sb;
int fd;
DIR *opendir(const char *path) {
struct stat sb;
int fd;
diff --git
a/src/org/ibex/nestedvm/syscalls.h
b/src/org/ibex/nestedvm/syscalls.h
index
be74766
..
b4a2c9c
100644
(file)
--- a/
src/org/ibex/nestedvm/syscalls.h
+++ b/
src/org/ibex/nestedvm/syscalls.h
@@
-36,3
+36,4
@@
#define SYS_getdents 36
#define SYS_memcpy 37
#define SYS_memset 38
#define SYS_getdents 36
#define SYS_memcpy 37
#define SYS_memset 38
+#define SYS_dup 39