[kaffe] CVS kaffe (robilad): cleanup up jsyscall tables and implementations
Kaffe CVS
cvs-commits at kaffe.org
Wed Jan 2 12:37:26 PST 2008
PatchSet 7657
Date: 2008/01/02 20:33:50
Author: robilad
Branch: HEAD
Tag: (none)
Log:
cleanup up jsyscall tables and implementations
2008-01-02 Dalibor Topic <robilad at kaffe.org>
* kaffe/kaffeh/support.c (Kaffe_SystemCallInterface): Removed unused members.
(kwrite) Removed.
* kaffe/kaffevm/systems/unix-pthreads/syscalls.c,
kaffe/kaffevm/systems/unix-jthreads/jthread.h,
kaffe/kaffevm/systems/unix-jthreads/jthread.c,
kaffe/kaffevm/systems/beos-native/syscalls.c,
kaffe/kaffevm/systems/drops-l4threads/syscalls.c,
kaffe/kaffevm/systems/oskit-pthreads/syscalls.c:
Removed unused functions, macros and global variables.
(Kaffe_SystemCallInterface): Updated to new syscall interface.
* include/jsyscall.h (SystemCallInterface): Removed unused members,
and their wrapper macros.
Members:
ChangeLog:1.5159->1.5160
include/jsyscall.h:1.30->1.31
kaffe/kaffeh/support.c:1.55->1.56
kaffe/kaffevm/systems/beos-native/syscalls.c:1.14->1.15
kaffe/kaffevm/systems/drops-l4threads/syscalls.c:1.5->1.6
kaffe/kaffevm/systems/oskit-pthreads/syscalls.c:1.14->1.15
kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.144->1.145
kaffe/kaffevm/systems/unix-jthreads/jthread.h:1.72->1.73
kaffe/kaffevm/systems/unix-jthreads/syscalls.c:1.23->1.24
kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.41->1.42
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.5159 kaffe/ChangeLog:1.5160
--- kaffe/ChangeLog:1.5159 Wed Jan 2 18:19:25 2008
+++ kaffe/ChangeLog Wed Jan 2 20:33:50 2008
@@ -1,5 +1,22 @@
2008-01-02 Dalibor Topic <robilad at kaffe.org>
+ * kaffe/kaffeh/support.c (Kaffe_SystemCallInterface): Removed unused members.
+ (kwrite) Removed.
+
+ * kaffe/kaffevm/systems/unix-pthreads/syscalls.c,
+ kaffe/kaffevm/systems/unix-jthreads/jthread.h,
+ kaffe/kaffevm/systems/unix-jthreads/jthread.c,
+ kaffe/kaffevm/systems/beos-native/syscalls.c,
+ kaffe/kaffevm/systems/drops-l4threads/syscalls.c,
+ kaffe/kaffevm/systems/oskit-pthreads/syscalls.c:
+ Removed unused functions, macros and global variables.
+ (Kaffe_SystemCallInterface): Updated to new syscall interface.
+
+ * include/jsyscall.h (SystemCallInterface): Removed unused members,
+ and their wrapper macros.
+
+2008-01-02 Dalibor Topic <robilad at kaffe.org>
+
* TODO: Updated jsyscall interface cleanup task with information
on which syscalls are still used.
Index: kaffe/include/jsyscall.h
diff -u kaffe/include/jsyscall.h:1.30 kaffe/include/jsyscall.h:1.31
--- kaffe/include/jsyscall.h:1.30 Sun Sep 23 21:16:58 2007
+++ kaffe/include/jsyscall.h Wed Jan 2 20:34:01 2008
@@ -5,6 +5,9 @@
* Copyright (c) 1996, 1997
* Transvirtual Technologies, Inc. All rights reserved.
*
+ * Copyright (c) 2008
+ * Kaffe.org contributors. See ChangeLog for details.
+ *
* See the file "license.terms" for information on usage and redistribution
* of this file.
*/
@@ -56,52 +59,10 @@
int (*_open)(const char *, int, int, int *);
int (*_read)(int, void *, size_t, ssize_t *);
- int (*_write)(int, const void*, size_t, ssize_t *);
int (*_lseek)(int, off_t, int, off_t *);
int (*_close)(int);
int (*_fstat)(int, struct stat *);
int (*_stat)(const char *, struct stat *);
- int (*_ftruncate)(int, off_t);
- int (*_fsync)(int);
-
- int (*_mkdir)(const char *, int);
- int (*_rmdir)(const char *);
- int (*_rename)(const char *, const char *);
- int (*_remove)(const char *);
-
- int (*_socket)(int, int, int, int *);
- int (*_connect)(int, struct sockaddr *, socklen_t, int);
- int (*_bind)(int, struct sockaddr *, socklen_t);
- int (*_listen)(int, int);
- int (*_accept)(int, struct sockaddr *, socklen_t*, int, int *);
- int (*_sockread)(int, void*, size_t, int, ssize_t *);
- int (*_recvfrom)(int, void *, size_t, int, struct sockaddr *, socklen_t *,
- int, ssize_t *);
- int (*_sockwrite)(int, const void *, size_t, ssize_t *);
- int (*_sendto)(int, const void *, size_t, int, const struct sockaddr *,
- socklen_t, ssize_t *);
- int (*_setsockopt)(int, int, int, const void *, int);
- int (*_getsockopt)(int, int, int, void *, socklen_t *);
- int (*_getsockname)(int, struct sockaddr *, socklen_t *);
- int (*_getpeername)(int, struct sockaddr *, socklen_t *);
- int (*_sockclose)(int);
- int (*_sockShutdown)(int);
- int (*_gethostbyname)(const char *, struct hostent **);
- int (*_gethostbyaddr)(const char *, size_t, int, struct hostent **);
-
- int (*_select)(int, fd_set *, fd_set *, fd_set *, struct timeval *,
- int*);
- int (*_forkexec)(char **, char **, int[4], int*, const char *);
- int (*_waitpid)(int, int *, int, int *);
- int (*_kill)(int, int);
-
- int (*_mmap)(void **, size_t *, int, int fd, off_t *);
- int (*_munmap)(void *, size_t);
- int (*_msync)(void *, size_t);
-
- int (*_pipecreate)(int *, int *);
- int (*_piperead)(int, void *, size_t, int, ssize_t *);
- int (*_pipewrite)(int, const void*, size_t, int, ssize_t *);
} SystemCallInterface;
extern SystemCallInterface Kaffe_SystemCallInterface;
@@ -139,20 +100,6 @@
(*Kaffe_SystemCallInterface._read)(filedescriptor, buffer, length, bytesRead)
/**
- * Write bytes to a file from a buffer in a
- * platform-independant, thread-safe way.
- *
- * @param filedescriptor filedescriptor to write to
- * @param buffer buffer to write the bytes from
- * @param length number of bytes to be written
- * @param bytesWritten number of bytes actually written
- *
- * @return 0 on success, or errno on failure.
- */
-#define KWRITE(filedescriptor, buffer, length, bytesWritten) \
- (*Kaffe_SystemCallInterface._write)(filedescriptor, buffer, length, bytesWritten)
-
-/**
* Reposition read/write offset in a file in a
* platform-independant, thread-safe way.
*
@@ -187,84 +134,6 @@
#define KFSTAT(filedescriptor, stats) \
(*Kaffe_SystemCallInterface._fstat)(filedescriptor, stats)
#define KSTAT(A,B) (*Kaffe_SystemCallInterface._stat)(A,B)
-
-/**
- * FTruncate a file in a platform-independant, thread-safe way.
- *
- * @param filedescriptor filedescriptor to truncate
- * @param offset pffest at which the filedescriptor should be truncated
- *
- * @return 0 on success, or errno on failure.
- */
-#define KFTRUNCATE(filedescriptor,offset) \
- (*Kaffe_SystemCallInterface._ftruncate)(filedescriptor, offset)
-
-/**
- * Synchrnoze a file in a platform-independant, thread-safe way.
- *
- * @param filedescriptor filedescriptor to synchronize
- *
- * @return 0 on success, or errno on failure.
- */
-#define KFSYNC(filedescriptor) \
- (*Kaffe_SystemCallInterface._fsync)(filedescriptor)
-
-#define KMKDIR(A,B) (*Kaffe_SystemCallInterface._mkdir)(A,B)
-#define KRMDIR(A) (*Kaffe_SystemCallInterface._rmdir)(A)
-#define KRENAME(A,B) (*Kaffe_SystemCallInterface._rename)(A,B)
-#define KREMOVE(A) (*Kaffe_SystemCallInterface._remove)(A)
-
-#define KSOCKET(A,B,C,D) \
- (*Kaffe_SystemCallInterface._socket)(A,B,C,D)
-#define KCONNECT(A,B,C,D) \
- (*Kaffe_SystemCallInterface._connect)(A,B,C,D)
-#define KBIND(A,B,C) (*Kaffe_SystemCallInterface._bind)(A,B,C)
-#define KLISTEN(A,B) (*Kaffe_SystemCallInterface._listen)(A,B)
-#define KACCEPT(A,B,C,D,E) \
- (*Kaffe_SystemCallInterface._accept)(A,B,C,D,E)
-#define KSOCKREAD(A,B,C,D,E) \
- (*Kaffe_SystemCallInterface._sockread)(A,B,C,D,E)
-#define KRECVFROM(A,B,C,D,E,F,G,H) \
- (*Kaffe_SystemCallInterface._recvfrom)(A,B,C,D,E,F,G,H)
-#define KSOCKWRITE(A,B,C,D) \
- (*Kaffe_SystemCallInterface._sockwrite)(A,B,C,D)
-#define KSENDTO(A,B,C,D,E,F,G) \
- (*Kaffe_SystemCallInterface._sendto)(A,B,C,D,E,F,G)
-#define KSETSOCKOPT(A,B,C,D,E) \
- (*Kaffe_SystemCallInterface._setsockopt)(A,B,C,D,E)
-#define KGETSOCKOPT(A,B,C,D,E) \
- (*Kaffe_SystemCallInterface._getsockopt)(A,B,C,D,E)
-#define KGETSOCKNAME(A,B,C) \
- (*Kaffe_SystemCallInterface._getsockname)(A,B,C)
-#define KGETPEERNAME(A,B,C) \
- (*Kaffe_SystemCallInterface._getpeername)(A,B,C)
-#define KGETHOSTBYNAME(A,B) \
- (*Kaffe_SystemCallInterface._gethostbyname)(A,B)
-#define KGETHOSTBYADDR(A,B,C,D) \
- (*Kaffe_SystemCallInterface._gethostbyaddr)(A,B,C,D)
-#define KSOCKCLOSE(A) (*Kaffe_SystemCallInterface._sockclose)(A)
-
-#define KSELECT(A,B,C,D,E,F) \
- (*Kaffe_SystemCallInterface._select)(A,B,C,D,E,F)
-
-#define KWAITPID(A,B,C,D) \
- (*Kaffe_SystemCallInterface._waitpid)(A,B,C,D)
-#define KFORKEXEC(A,B,C,D,E) \
- (*Kaffe_SystemCallInterface._forkexec)(A,B,C,D,E)
-#define KKILL(A,B) (*Kaffe_SystemCallInterface._kill)(A,B)
-#define KMMAP(A,B,C,D,E) (*Kaffe_SystemCallInterface._mmap)(A,B,C,D,E)
-#define KMUNMAP(A,B) (*Kaffe_SystemCallInterface._munmap)(A,B)
-#define KMSYNC(A,B) (*Kaffe_SystemCallInterface._msync)(A,B)
-
-#define KPIPECREATE(A,B) (*Kaffe_SystemCallInterface._pipecreate)(A,B)
-#define KPIPEREAD(A,B,C,D,E) (*Kaffe_SystemCallInterface._piperead)(A,B,C,D,E)
-#define KPIPEWRITE(A,B,C,D,E) (*Kaffe_SystemCallInterface._pipewrite)(A,B,C,D,E)
-
-#define KSOCKSHUTDOWN(A) (*Kaffe_SystemCallInterface._sockShutdown)(A)
-
-#define KAFFE_MMAP_READ 0
-#define KAFFE_MMAP_WRITE 1
-#define KAFFE_MMAP_PRIVATE 2
#define NOTIMEOUT (-1)
Index: kaffe/kaffe/kaffeh/support.c
diff -u kaffe/kaffe/kaffeh/support.c:1.55 kaffe/kaffe/kaffeh/support.c:1.56
--- kaffe/kaffe/kaffeh/support.c:1.55 Tue Nov 7 00:59:09 2006
+++ kaffe/kaffe/kaffeh/support.c Wed Jan 2 20:34:01 2008
@@ -71,13 +71,6 @@
return (*out == -1) ? errno : 0;
}
-static int
-kwrite(int fd, const void *buf, size_t len, ssize_t *out)
-{
- *out = write(fd, buf, len);
- return (*out == -1) ? errno : 0;
-}
-
static int
klseek(int fd, off_t off, int whence, off_t *out)
{
@@ -115,45 +108,10 @@
{
binary_open,
kread,
- kwrite,
klseek,
close,
kfstat,
kstat,
-
- NULL, /* truncate */
- NULL, /* fsync */
- NULL, /* mkdir */
- NULL, /* rmdir */
- NULL, /* rename */
- NULL, /* remove */
- NULL, /* socket */
- NULL, /* connect */
- NULL, /* bind */
- NULL, /* listen */
- NULL, /* accept */
- NULL, /* sockread */
- NULL, /* recvfrom */
- NULL, /* sockwrite */
- NULL, /* sendto */
- NULL, /* setsockopt */
- NULL, /* getsockopt */
- NULL, /* getsockname */
- NULL, /* getpeername */
- NULL, /* sockclose */
- NULL, /* sockshutdown */
- NULL, /* gethostbyname */
- NULL, /* gethostbyaddr */
- NULL, /* select */
- NULL, /* forkexec */
- NULL, /* waitpid */
- NULL, /* kill */
- NULL, /* mmap */
- NULL, /* munmap */
- NULL, /* msync */
- NULL, /* pipecreate */
- NULL, /* piperead */
- NULL /* pipewrite */
};
Index: kaffe/kaffe/kaffevm/systems/beos-native/syscalls.c
diff -u kaffe/kaffe/kaffevm/systems/beos-native/syscalls.c:1.14 kaffe/kaffe/kaffevm/systems/beos-native/syscalls.c:1.15
--- kaffe/kaffe/kaffevm/systems/beos-native/syscalls.c:1.14 Tue Nov 7 00:59:10 2006
+++ kaffe/kaffe/kaffevm/systems/beos-native/syscalls.c Wed Jan 2 20:34:02 2008
@@ -57,13 +57,6 @@
}
static int
-beos_native_write(int fd, const void* b, size_t l, ssize_t *out)
-{
- *out = write(fd, b, l);
- return (*out < 0) ? errno : 0;
-}
-
-static int
beos_native_lseek(int f, off_t o, int w, off_t *out)
{
*out = lseek(f, o, w);
@@ -88,466 +81,11 @@
return (stat(p, st) < 0) ? errno : 0;
}
-static int
-beos_native_ftruncate(int fd, off_t new_size)
-{
- return (ftruncate(fd, new_size) < 0) ? errno : 0;
-}
-
-static int
-beos_native_mkdir(const char *p, int m)
-{
- return (mkdir(p, m) < 0) ? errno : 0;
-}
-
-static int
-beos_native_rmdir(const char *p)
-{
- return (rmdir(p) < 0) ? errno : 0;
-}
-
-static int
-beos_native_rename(const char *p, const char *q)
-{
- return (rename(p, q) < 0) ? errno : 0;
-}
-
-static int
-beos_native_remove(const char *p)
-{
- return (remove(p) < 0) ? errno : 0;
-}
-
-static int
-beos_native_socket(int a, int b, int c, int *outsock)
-{
- *outsock = socket(a, b, c);
- return (*outsock < 0) ? errno : 0;
-}
-
-static int
-beos_native_connect(int sock, struct sockaddr* addr, size_t len, int timeout)
-{
- /* XXX implement timeout */
- int r = connect(sock, addr, len);
- /* annul EISCONN error --- is this really necessary or is this
- * a java.net bug?
- */
- if (r < 0 && errno == EISCONN) {
- r = 0;
- }
- return (r);
-}
-
-static int
-beos_native_bind(int sock, struct sockaddr* addr, size_t len)
-{
- return (bind(sock, addr, len) < 0) ? errno : 0;
-}
-
-static int
-beos_native_listen(int sock, int n)
-{
- /* BUGFIX: BeOS doesn't default to 5 conns ala Unix if n == 0 */
- if (0 == n) n = 5;
-
- return (listen(sock, n) < 0) ? errno : 0;
-}
-
-static int
-beos_native_accept(int sock, struct sockaddr* a, size_t *l, int timeout,
- int* outsock)
-{
- int cli_size;
-
- if (timeout > 0) {
- struct timeval tv;
- struct fd_set fds;
- int rc;
-
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000L;
-
- FD_ZERO(&fds);
- FD_SET(sock, &fds);
-
- rc = select(sock+1, &fds, NULL, NULL, &tv);
- if (rc < 0) {
- return errno;
- }
- else if (0 == rc) {
- errno = EINTR;
- return errno;
- }
- }
-
- cli_size = *l;
- *outsock = accept(sock, a, &cli_size);
- *l = cli_size;
- return (*outsock < 0) ? errno : 0;
-}
-
-static int
-beos_native_sock_read(int sock, void* b, size_t l, int timeout, ssize_t *out)
-{
- if (timeout > 0) {
- struct timeval tv;
- struct fd_set fds;
- int rc;
-
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000L;
-
- FD_ZERO(&fds);
- FD_SET(sock, &fds);
-
- rc = select(sock+1, &fds, NULL, NULL, &tv);
- if (rc < 0) {
- return errno;
- }
- else if (0 == rc) {
- errno = EINTR;
- return errno;
- }
- }
-
- *out = recv(sock, b, l, 0);
- return (*out < 0) ? errno : 0;
-}
-
-static int
-beos_native_recvfrom(int sock, void* b, size_t c, int d, struct sockaddr* e,
- int* f, int timeout, ssize_t *out)
-{
- if (d & MSG_PEEK) {
- errno = B_UNSUPPORTED;
- *out = errno;
- }
- else {
- if (timeout > 0) {
- struct timeval tv;
- struct fd_set fds;
- int rc;
-
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000L;
-
- FD_ZERO(&fds);
- FD_SET(sock, &fds);
-
- rc = select(sock+1, &fds, NULL, NULL, &tv);
- if (rc < 0) {
- return errno;
- }
- else if (0 == rc) {
- errno = EINTR;
- return errno;
- }
- }
-
- *out = recvfrom(sock, b, c, d, e, f);
- }
- return (*out < 0) ? errno : 0;
-}
-
-static int
-beos_native_sock_write(int f, const void* b, size_t l, ssize_t *out)
-{
- *out = send(f, b, l, 0);
- return (*out < 0) ? errno : 0;
-}
-
-static int
-beos_native_sendto(int a, const void* b, size_t c, int d,
- const struct sockaddr* e, int f, ssize_t *out)
-{
- *out = e ? sendto(a, b, c, d, e, f) : send(a, b, c, d);
- return (*out < 0) ? errno : 0;
-}
-
-static int
-beos_native_setsockopt(int a, int b, int c, const void* d, int e)
-{
- return (setsockopt(a, b, c, d, e) < 0) ? errno : 0;
-}
-
-static int
-beos_native_getsockopt(int a, int b, int c, void* d, int* e)
-{
- /* return (getsockopt(a, b, c, d, e) < 0) ? errno : 0; */
- errno = B_UNSUPPORTED;
- return errno;
-}
-
-static int
-beos_native_getsockname(int a, struct sockaddr* b, int* c)
-{
- return (getsockname(a, b, c) < 0) ? errno : 0;
-}
-
-static int
-beos_native_getpeername(int a, struct sockaddr* b, int* c)
-{
- return (getpeername(a, b, c) < 0) ? errno : 0;
-}
-
-static int
-beos_native_sockclose(int f)
-{
- return (closesocket(f) < 0) ? errno : 0;
-}
-
-static int
-beos_native_gethostbyname(const char*n, struct hostent**out)
-{
- int rc = 0;
-
- /* XXX gethostbyname is not thread-safe! */
- *out = gethostbyname(n);
- if (*out == 0) {
- rc = h_errno;
- if (rc == 0) {
- *out = (void*)-1;
- rc = errno;
- }
- }
- return (rc);
-}
-
-static int
-beos_native_gethostbyaddr(const char*n, int a, int b, struct hostent**out)
-{
- int rc = 0;
-
- /* XXX gethostbyaddr is not thread-safe! */
- *out = gethostbyaddr(n, a, b);
- if (*out == 0) {
- rc = h_errno;
- if (rc == 0) {
- *out = (void*)-1;
- rc = errno;
- }
- }
- return (rc);
-}
-
-static int
-beos_native_select(int a, fd_set* b, fd_set* c, fd_set* d, struct timeval* e,
- int* out)
-{
- *out = select(a, b, c, d, e);
- return (*out < 0) ? errno : 0;
-}
-
-/* helper function for forkexec, close fd[0..n-1] */
-static void
-close_fds(int fd[], int n)
-{
- int i = 0;
- while (i < n) {
- close(fd[i++]);
- }
-}
-
-static int
-beos_native_forkexec(char *argv[], char *env[],
- int ioes[4], int *outpid, const char *dir)
-{
-/* Adapted from unix-jthreads/jthread.c */
-/* these defines are indices in ioes */
-#define IN_IN 0
-#define IN_OUT 1
-#define OUT_IN 2
-#define OUT_OUT 3
-#define ERR_IN 4
-#define ERR_OUT 5
-#define SYNC_IN 6
-#define SYNC_OUT 7
-
- int fds[8];
- int nfd; /* number of fds in `fds' that are valid */
- sigset_t nsig;
- char b[1];
- int pid, i, err;
-
- /*
- * we need execve() and fork() for this to work. Don't bother if
- * we don't have them.
- */
-#if !defined(HAVE_EXECVE) && !defined(HAVE_EXECVP)
- unimp("neither execve() nor execvp() not provided");
-#endif
-#if !defined(HAVE_FORK)
- unimp("fork() not provided");
-#endif
-
-DBG(JTHREAD,
- {
- char **d = argv;
- dprintf("argv = [`%s ", *d++);
- while (*d)
- dprintf(", `%s'", *d++);
- dprintf("]\n");
- }
- )
- /* Create the pipes to communicate with the child */
- /* Make sure fds get closed if we can't create all pipes */
- for (nfd = 0; nfd < 8; nfd += 2) {
- int e;
- err = pipe(fds + nfd);
- e = errno;
- if (err == -1) {
- close_fds(fds, nfd);
- return (e);
- }
- }
-
- /*
- * We must avoid that the child dies because of SIGVTALRM or
- * other signals. We disable interrupts before forking and then
- * reenable signals in the child after we cleaned up.
- */
- sigfillset(&nsig);
- sigprocmask(SIG_BLOCK, &nsig, 0);
-
- pid = fork();
-
- switch (pid) {
- case 0:
- /* Child */
- /* set all signals back to their default state */
- for (i = 0; i < NSIG; i++) {
- signal(i, SIG_DFL);
- }
-
- /* now reenable interrupts */
- sigprocmask(SIG_UNBLOCK, &nsig, 0);
-
- /* set stdin, stdout, and stderr up from the pipes */
- dup2(fds[IN_IN], 0);
- dup2(fds[OUT_OUT], 1);
- dup2(fds[ERR_OUT], 2);
-
- /* What is sync about anyhow? Well my current guess is that
- * the parent writes a single byte to it when it's ready to
- * proceed. So here I wait until I get it before doing
- * anything.
- */
- /* note that this is a blocking read */
- read(fds[SYNC_IN], b, sizeof(b));
-
- /* now close all pipe fds */
- close_fds(fds, 8);
-
- /* change working directory */
-#if defined(HAVE_CHDIR)
- (void)chdir(dir);
-#endif
-
- /*
- * If no environment was given and we have execvp, we use it.
- * If an environment was given, we use execve.
- * This is roughly was the linux jdk seems to do.
- */
-
- /* execute program */
-#if defined(HAVE_EXECVP)
- if (env == NULL)
- execvp(argv[0], argv);
- else
-#endif
- execve(argv[0], argv, env);
- break;
-
- case -1:
- /* Error */
- err = errno;
- /* Close all pipe fds */
- close_fds(fds, 8);
- sigprocmask(SIG_UNBLOCK, &nsig, 0);
- return (err);
-
- default:
- /* Parent */
- /* close the fds we won't need */
- close(fds[IN_IN]);
- close(fds[OUT_OUT]);
- close(fds[ERR_OUT]);
- close(fds[SYNC_IN]);
-
- /* copy and fix up the fds we do need */
- ioes[0] = fds[IN_OUT];
- ioes[1] = fds[OUT_IN];
- ioes[2] = fds[ERR_IN];
- ioes[3] = fds[SYNC_OUT];
-
- sigprocmask(SIG_UNBLOCK, &nsig, 0);
- *outpid = pid;
- return (0);
- }
-
- exit(-1);
- /* NEVER REACHED */
-}
-
-static int
-beos_native_waitpid(int a, int* b, int c, int* out)
-{
- *out = waitpid(a, b, 0);
- return (*out < 0) ? errno : 0;
-}
-
-static int
-beos_native_kill(int a, int b)
-{
- return (send_signal(a, b) < 0) ? errno : 0;
-}
-
-static int
-beos_native_mmap(void **memory, size_t *size, int mode, int fd, off_t *offset)
-{
- return B_UNSUPPORTED;
-}
-
-static int
-beos_native_munmap(void *memory, size_t size)
-{
- return B_UNSUPPORTED;
-}
-
SystemCallInterface Kaffe_SystemCallInterface = {
beos_native_open,
beos_native_read,
- beos_native_write,
beos_native_lseek,
beos_native_close,
beos_native_fstat,
beos_native_stat,
- beos_native_ftruncate,
- beos_native_mkdir,
- beos_native_rmdir,
- beos_native_rename,
- beos_native_remove,
- beos_native_socket,
- beos_native_connect,
- beos_native_bind,
- beos_native_listen,
- beos_native_accept,
- beos_native_sock_read,
- beos_native_recvfrom,
- beos_native_sock_write,
- beos_native_sendto,
- beos_native_setsockopt,
- beos_native_getsockopt,
- beos_native_getsockname,
- beos_native_getpeername,
- beos_native_sockclose,
- beos_native_gethostbyname,
- beos_native_gethostbyaddr,
- beos_native_select,
- beos_native_forkexec,
- beos_native_waitpid,
- beos_native_kill,
- beos_native_mmap,
- beos_native_munmap
};
Index: kaffe/kaffe/kaffevm/systems/drops-l4threads/syscalls.c
diff -u kaffe/kaffe/kaffevm/systems/drops-l4threads/syscalls.c:1.5 kaffe/kaffe/kaffevm/systems/drops-l4threads/syscalls.c:1.6
--- kaffe/kaffe/kaffevm/systems/drops-l4threads/syscalls.c:1.5 Tue Nov 7 00:59:10 2006
+++ kaffe/kaffe/kaffevm/systems/drops-l4threads/syscalls.c Wed Jan 2 20:34:02 2008
@@ -48,27 +48,6 @@
return nReturn;
}
-static int drops_write(int fd, const void* buffer,
- size_t len, ssize_t *out) {
- int nReturn = 0;
-
- if (fd==1 || fd==2)
- { //STDOUT, STDERR
- nReturn = write(fd,buffer,len);
- if (nReturn == -1)
- nReturn = errno;
- else
- {
- nReturn = 0;
- *out = len;
- }
- }
- else
- printf("unknown fd=%d len=%d\n",fd,len);
-
- return nReturn;
-}
-
static int drops_lseek(int fd, off_t o, int type,
off_t *out) {
int nReturn = 0;
@@ -108,320 +87,11 @@
return nReturn;
}
-static int drops_ftruncate(int fd UNUSED,
- off_t new_size UNUSED) {
- unimp("ftruncate() not implemented");
- return -1;
-}
-
-static int drops_fsync(int a UNUSED) {
- unimp("fsync() not implemented");
- return -1;
-}
-
-static int drops_mkdir(const char *p UNUSED,
- int m UNUSED) {
- unimp("mkdir() not implemented");
- return -1;
-}
-
-static int drops_rmdir(const char *p UNUSED) {
- unimp("rmdir() not implemented");
- return -1;
-}
-
-static int drops_rename(const char *p UNUSED,
- const char *q UNUSED) {
- unimp("rename() not implemented");
- return -1;
-}
-
-static int drops_remove(const char *p UNUSED) {
- unimp("remove() not implemented");
- return -1;
-}
-
-static int drops_socket(int fd, int type,
- int proto, int *outfd) {
- int r = socket(fd, type, proto);
-
- if (r < 0)
- r = errno;
- else {
- *outfd = r;
- r = 0;
- }
-
- return (r);
-}
-
-static int drops_connect(int fd, struct sockaddr* serv_addr,
- socklen_t addrlen, int timeout UNUSED) {
- int nReturn = connect(fd, serv_addr, (socklen_t)addrlen);
-
- if (nReturn < 0)
- nReturn = errno;
-
- return nReturn;
-}
-
-static int drops_bind(int fd, struct sockaddr* addr,
- socklen_t addrlen) {
- int nReturn = bind(fd, addr, (socklen_t)addrlen);
-
- if (nReturn < 0)
- nReturn = errno;
-
- return nReturn;
-}
-
-static int drops_listen(int fd, int backlog) {
- int nReturn = listen(fd, backlog);
-
- if (nReturn < 0)
- nReturn = errno;
-
- return nReturn;
-}
-
-static int drops_accept(int socketfd, struct sockaddr* addr,
- socklen_t *addrlen, int timeout UNUSED, int* outfd) {
- int nReturn = accept(socketfd, addr, addrlen);
-
- if (nReturn < 0)
- nReturn = errno;
- else {
- *outfd = nReturn;
- nReturn = 0;
- }
-
- return nReturn;
-}
-
-static int drops_sockread(int socketfd, void* buf, size_t len,
- int timeout UNUSED, ssize_t *out) {
- int nReturn = recv(socketfd, buf, len, 0);
-
- if (nReturn < 0)
- nReturn = errno;
- else {
- *out = nReturn;
- nReturn = 0;
- }
-
- return nReturn;
-}
-
-static int drops_recvfrom(int a UNUSED, void* b UNUSED,
- size_t c UNUSED, int d UNUSED,
- struct sockaddr* e UNUSED,
- socklen_t* f UNUSED, int timeout UNUSED,
- ssize_t *out UNUSED) {
- unimp("recvfrom() not implemented");
- return -1;
-}
-
-static int drops_sockwrite(int socketfd, const void* msg,
- size_t len, ssize_t *out) {
- int nReturn = send(socketfd, msg, len, 0);
-
- if (nReturn < 0)
- nReturn = errno;
- else {
- *out = nReturn;
- nReturn = 0;
- }
-
- return nReturn;
-}
-
-static int drops_sendto(int a UNUSED,
- const void* b UNUSED,
- size_t c UNUSED,
- int d UNUSED,
- const struct sockaddr* e UNUSED,
- int f UNUSED, ssize_t *out UNUSED) {
- unimp("sendto() not implemented");
- return -1;
-}
-
-static int drops_setsockopt(int fd, int level,
- int optname,
- const void* optval,
- int optlen) {
- int nReturn = setsockopt(fd, level, optname, optval, (socklen_t)optlen);
-
- if (nReturn < 0)
- nReturn = errno;
-
- return nReturn;
-}
-
-static int drops_getsockopt(int a UNUSED,
- int b UNUSED,
- int c UNUSED,
- void* d UNUSED,
- socklen_t* e UNUSED) {
- unimp("getsockopt() not implemented");
- return -1;
-}
-
-static int drops_getsockname(int socketfd, struct sockaddr* name,
- socklen_t * namelen) {
- int nReturn = getsockname(socketfd, name , namelen);
-
- if (nReturn < 0)
- nReturn = errno;
-
- return nReturn;
-}
-
-static int drops_getpeername(int a UNUSED, struct sockaddr* b UNUSED,
- socklen_t* c UNUSED) {
- printf("getpeername todo\n");
- return 0;
-}
-
-static int drops_sockclose(int fd) {
- int nReturn = close(fd);
-
- if (nReturn < 0)
*** Patch too long, truncated ***
More information about the kaffe
mailing list