This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

sim/common+gdb/include: Support rename syscall in cb_syscall machinery


The support in sim/common/callback.c was there, but not the
cb_syscall support.  Will commit as obvious, once the lstat
patch is in (only for my simplicity and to avoid a [temporary]
gap in CB_SYS_* numbers; if requested I can commit now).
Covered by the to-be-submitted CRIS C simulator testsuite.

sim/common:
	* syscall.c (cb_syscall) <case CB_SYS_rename>: New case.

include/gdb:
	* callback.h (CB_SYS_rename): New macro.

--- callback.h.prev	Tue Dec  7 03:10:00 2004
+++ callback.h	Tue Dec  7 03:10:13 2004
@@ -192,6 +192,7 @@ extern host_callback default_callback;
 
 /* More standard syscalls.  */
 #define CB_SYS_lstat    19
+#define CB_SYS_rename	20
 
 /* Struct use to pass and return information necessary to perform a
    system call.  */
Index: syscall.c
===================================================================
RCS file: /cvs/src/src/sim/common/syscall.c,v
retrieving revision 1.3
diff -c -p -r1.3 syscall.c
*** syscall.c	10 May 2004 16:18:03 -0000	1.3
--- syscall.c	7 Dec 2004 02:13:07 -0000
*************** cb_syscall (cb, sc)
*** 373,378 ****
--- 400,432 ----
        }
        break;
  
+     case CB_SYS_rename :
+       {
+ 	char *path1, *path2;
+ 
+ 	errcode = get_path (cb, sc, sc->arg1, &path1);
+ 	if (errcode != 0)
+ 	  {
+ 	    result = -1;
+ 	    errcode = EFAULT;
+ 	    goto FinishSyscall;
+ 	  }
+ 	errcode = get_path (cb, sc, sc->arg2, &path2);
+ 	if (errcode != 0)
+ 	  {
+ 	    result = -1;
+ 	    errcode = EFAULT;
+ 	    free (path1);
+ 	    goto FinishSyscall;
+ 	  }
+ 	result = (*cb->rename) (cb, path1, path2);
+ 	free (path1);
+ 	free (path2);
+ 	if (result < 0)
+ 	  goto ErrorFinish;
+       }
+       break;
+ 
      case CB_SYS_stat :
        {
  	char *path,*buf;

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]