This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Committed, sim/common/syscall.c: cb_syscall cases and CB_SYS_truncate, CB_SYS_ftruncate
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 15 Dec 2004 02:27:51 +0100
- Subject: Committed, sim/common/syscall.c: cb_syscall cases and CB_SYS_truncate, CB_SYS_ftruncate
Apparently these were just missing from syscall.c:cb_syscall
because sh-sim (for which truncate and ftruncate were added to
the callback structure) doesn't use the cb_syscall machinery.
Committed as obvious after building simulators for arm-elf
frv-elf m32r-elf m68hc11-elf mips-elf mn10300-elf and
powerpc-elf (Why all those? Well because building them all was
simple). Tested together with the next (hopefully last general)
patch on the to-be-submitted CRIS sim with specific trivial
test-cases.
include/gdb:
* callback.h (CB_SYS_truncate, CB_SYS_ftruncate): New macros.
sim/common:
* syscall.c (cb_syscall) <case CB_SYS_truncate>
<case CB_SYS_ftruncate>: New cases.
Index: include/gdb/callback.h
===================================================================
RCS file: /cvs/src/src/include/gdb/callback.h,v
retrieving revision 1.5
diff -p -c -r1.5 callback.h
*** include/gdb/callback.h 13 Dec 2004 00:42:49 -0000 1.5
--- include/gdb/callback.h 15 Dec 2004 00:53:58 -0000
*************** extern host_callback default_callback;
*** 193,198 ****
--- 193,200 ----
/* More standard syscalls. */
#define CB_SYS_lstat 19
#define CB_SYS_rename 20
+ #define CB_SYS_truncate 21
+ #define CB_SYS_ftruncate 22
/* Struct use to pass and return information necessary to perform a
system call. */
Index: sim/common/syscall.c
===================================================================
RCS file: /cvs/src/src/sim/common/syscall.c,v
retrieving revision 1.6
diff -p -c -r1.6 syscall.c
*** sim/common/syscall.c 13 Dec 2004 00:46:05 -0000 1.6
--- sim/common/syscall.c 15 Dec 2004 00:56:20 -0000
*************** cb_syscall (cb, sc)
*** 400,405 ****
--- 400,435 ----
}
break;
+ case CB_SYS_truncate :
+ {
+ char *path;
+ long len = sc->arg2;
+
+ errcode = get_path (cb, sc, sc->arg1, &path);
+ if (errcode != 0)
+ {
+ result = -1;
+ errcode = EFAULT;
+ goto FinishSyscall;
+ }
+ result = (*cb->truncate) (cb, path, len);
+ free (path);
+ if (result < 0)
+ goto ErrorFinish;
+ }
+ break;
+
+ case CB_SYS_ftruncate :
+ {
+ int fd = sc->arg1;
+ long len = sc->arg2;
+
+ result = (*cb->ftruncate) (cb, fd, len);
+ if (result < 0)
+ goto ErrorFinish;
+ }
+ break;
+
case CB_SYS_rename :
{
char *path1, *path2;
brgds, H-P