2006-06-13 Sandra Loosemore <sandra@codesourcery.com>
* /libc/sys/arm/syscalls.c (_unlink, isatty, _system, _rename):
        Make them do something useful in the ARM_RDI_MONITOR case.
			
			
This commit is contained in:
		| @@ -1,3 +1,8 @@ | |||||||
|  | 2006-06-13  Sandra Loosemore <sandra@codesourcery.com> | ||||||
|  |  | ||||||
|  | 	* /libc/sys/arm/syscalls.c (_unlink, isatty, _system, _rename): | ||||||
|  | 	Make them do something useful in the ARM_RDI_MONITOR case. | ||||||
|  |  | ||||||
| 2006-06-07  Fred Fish  <fnf@specifix.com> | 2006-06-07  Fred Fish  <fnf@specifix.com> | ||||||
|  |  | ||||||
| 	* libc/search/hash_bigkey.c (MIN,MAX): Remove | 	* libc/search/hash_bigkey.c (MIN,MAX): Remove | ||||||
|   | |||||||
| @@ -14,6 +14,7 @@ | |||||||
| #include <reent.h> | #include <reent.h> | ||||||
| #include <signal.h> | #include <signal.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
|  | #include <sys/wait.h> | ||||||
| #include "swi.h" | #include "swi.h" | ||||||
|  |  | ||||||
| /* Forward prototypes.  */ | /* Forward prototypes.  */ | ||||||
| @@ -23,7 +24,7 @@ int     isatty		_PARAMS ((int)); | |||||||
| clock_t _times		_PARAMS ((struct tms *)); | clock_t _times		_PARAMS ((struct tms *)); | ||||||
| int     _gettimeofday	_PARAMS ((struct timeval *, struct timezone *)); | int     _gettimeofday	_PARAMS ((struct timeval *, struct timezone *)); | ||||||
| void    _raise 		_PARAMS ((void)); | void    _raise 		_PARAMS ((void)); | ||||||
| int     _unlink		_PARAMS ((void)); | int     _unlink		_PARAMS ((const char *)); | ||||||
| int     _link 		_PARAMS ((void)); | int     _link 		_PARAMS ((void)); | ||||||
| int     _stat 		_PARAMS ((const char *, struct stat *)); | int     _stat 		_PARAMS ((const char *, struct stat *)); | ||||||
| int     _fstat 		_PARAMS ((int, struct stat *)); | int     _fstat 		_PARAMS ((int, struct stat *)); | ||||||
| @@ -539,9 +540,16 @@ _link (void) | |||||||
| } | } | ||||||
|  |  | ||||||
| int | int | ||||||
| _unlink (void) | _unlink (const char *path) | ||||||
| { | { | ||||||
|  | #ifdef ARM_RDI_MONITOR | ||||||
|  |   int block[2]; | ||||||
|  |   block[0] = path; | ||||||
|  |   block[1] = strlen(path); | ||||||
|  |   return wrap (do_AngelSWI (AngelSWI_Reason_Remove, block)) ? -1 : 0; | ||||||
|  | #else   | ||||||
|   return -1; |   return -1; | ||||||
|  | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| void | void | ||||||
| @@ -606,22 +614,60 @@ _times (struct tms * tp) | |||||||
| int | int | ||||||
| isatty (int fd) | isatty (int fd) | ||||||
| { | { | ||||||
|   return 1; | #ifdef ARM_RDI_MONITOR | ||||||
|   fd = fd; |   int fh = remap_handle (fd); | ||||||
|  |   return wrap (do_AngelSWI (AngelSWI_Reason_IsTTY, &fh)); | ||||||
|  | #else | ||||||
|  |   return (fd <= 2) ? 1 : 0;  /* one of stdin, stdout, stderr */ | ||||||
|  | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| int | int | ||||||
| _system (const char *s) | _system (const char *s) | ||||||
| { | { | ||||||
|  | #ifdef ARM_RDI_MONITOR | ||||||
|  |   int block[2]; | ||||||
|  |   int e; | ||||||
|  |  | ||||||
|  |   /* Hmmm.  The ARM debug interface specification doesn't say whether | ||||||
|  |      SYS_SYSTEM does the right thing with a null argument, or assign any | ||||||
|  |      meaning to its return value.  Try to do something reasonable....  */ | ||||||
|  |   if (!s) | ||||||
|  |     return 1;  /* maybe there is a shell available? we can hope. :-P */ | ||||||
|  |   block[0] = s; | ||||||
|  |   block[1] = strlen (s); | ||||||
|  |   e = wrap (do_AngelSWI (AngelSWI_Reason_System, block)); | ||||||
|  |   if ((e >= 0) && (e < 256)) | ||||||
|  |     { | ||||||
|  |       /* We have to convert e, an exit status to the encoded status of | ||||||
|  |          the command.  To avoid hard coding the exit status, we simply | ||||||
|  | 	 loop until we find the right position.  */ | ||||||
|  |       int exit_code; | ||||||
|  |  | ||||||
|  |       for (exit_code = e; e && WEXITSTATUS (e) != exit_code; e <<= 1) | ||||||
|  | 	continue; | ||||||
|  |     } | ||||||
|  |   return e; | ||||||
|  | #else | ||||||
|   if (s == NULL) |   if (s == NULL) | ||||||
|     return 0; |     return 0; | ||||||
|   errno = ENOSYS; |   errno = ENOSYS; | ||||||
|   return -1; |   return -1; | ||||||
|  | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| int | int | ||||||
| _rename (const char * oldpath, const char * newpath) | _rename (const char * oldpath, const char * newpath) | ||||||
| { | { | ||||||
|  | #ifdef ARM_RDI_MONITOR | ||||||
|  |   int block[4]; | ||||||
|  |   block[0] = oldpath; | ||||||
|  |   block[1] = strlen(oldpath); | ||||||
|  |   block[2] = newpath; | ||||||
|  |   block[3] = strlen(newpath); | ||||||
|  |   return wrap (do_AngelSWI (AngelSWI_Reason_Rename, block)) ? -1 : 0; | ||||||
|  | #else   | ||||||
|   errno = ENOSYS; |   errno = ENOSYS; | ||||||
|   return -1; |   return -1; | ||||||
|  | #endif | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user