diff options
author | Hans-Peter Nilsson <hp@axis.com> | 2005-01-28 03:40:54 +0000 |
---|---|---|
committer | Hans-Peter Nilsson <hp@axis.com> | 2005-01-28 03:40:54 +0000 |
commit | 97f669eda91b587c590bb5d0bb185d63c126d7fe (patch) | |
tree | 82269fe3b8572c13708934292ac80694f8fb2147 /sim/common/syscall.c | |
parent | 6a7e5cfe8c15184a6e65769dd05127fe70c9e6d7 (diff) | |
download | gdb-97f669eda91b587c590bb5d0bb185d63c126d7fe.zip gdb-97f669eda91b587c590bb5d0bb185d63c126d7fe.tar.gz gdb-97f669eda91b587c590bb5d0bb185d63c126d7fe.tar.bz2 |
* syscall.c (cb_syscall) <case CB_SYS_pipe>: New case.
* callback.c [HAVE_LIMITS_H]: Include limits.h.
Include libiberty.h.
(os_close, os_read, os_write, os_fstat, os_ftruncate): Support fd
being either end of a pipe.
(os_pipe, os_pipe_empty, os_pipe_nonempty): New functions.
(os_shutdown): Clear pipe state.
(default_callback): Initialize new members.
Diffstat (limited to 'sim/common/syscall.c')
-rw-r--r-- | sim/common/syscall.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sim/common/syscall.c b/sim/common/syscall.c index fcfb417..45f063e 100644 --- a/sim/common/syscall.c +++ b/sim/common/syscall.c @@ -572,6 +572,33 @@ cb_syscall (cb, sc) } break; + case CB_SYS_pipe : + { + int p[2]; + char *target_p = xcalloc (1, cb->target_sizeof_int * 2); + + result = (*cb->pipe) (cb, p); + if (result != 0) + goto ErrorFinish; + + cb_store_target_endian (cb, target_p, cb->target_sizeof_int, p[0]); + cb_store_target_endian (cb, target_p + cb->target_sizeof_int, + cb->target_sizeof_int, p[1]); + if ((*sc->write_mem) (cb, sc, sc->arg1, target_p, + cb->target_sizeof_int * 2) + != cb->target_sizeof_int * 2) + { + /* Close the pipe fd:s. */ + (*cb->close) (cb, p[0]); + (*cb->close) (cb, p[1]); + errcode = EFAULT; + result = -1; + } + + free (target_p); + } + break; + case CB_SYS_time : { /* FIXME: May wish to change CB_SYS_time to something else. |