From 9ecc83a3f7a3d4c2ee93bf3da38dbd90826fe84c Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 11 Sep 2008 00:30:32 +0000 Subject: [PATCH] 2008-09-10 Ken Werner * spu/dirfuncs.c: Avoid warnings. * spu/kill.c: Likewise. --- libgloss/ChangeLog | 5 +++++ libgloss/spu/dirfuncs.c | 20 ++++++++++++++------ libgloss/spu/kill.c | 3 +++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog index 94b8a3200..7bdb72c97 100644 --- a/libgloss/ChangeLog +++ b/libgloss/ChangeLog @@ -1,3 +1,8 @@ +2008-09-10 Ken Werner + + * spu/dirfuncs.c: Avoid warnings. + * spu/kill.c: Likewise. + 2008-09-04 Ken Werner * spu/Makefile.in: Fix missing linux_syscalls.o. diff --git a/libgloss/spu/dirfuncs.c b/libgloss/spu/dirfuncs.c index 397a4e951..adf1b0e4e 100644 --- a/libgloss/spu/dirfuncs.c +++ b/libgloss/spu/dirfuncs.c @@ -56,22 +56,30 @@ typedef struct { unsigned int pad0[3]; } syscall_opendir_t; +typedef struct { + uint64_t dir; + unsigned int pad0[2]; +} syscall_opendir_ret_t; + DIR * opendir (const char *name) { DIR *dir; - int ppc_dir, i; - syscall_opendir_t sys; + int i; + union { + syscall_opendir_t sys; + syscall_opendir_ret_t ret; + } u; - sys.name = (unsigned int) name; + u.sys.name = (unsigned int) name; for (i = 0; i < SPE_OPENDIR_MAX; i++) { if (!spe_dir[i].ppc_dir) { dir = &spe_dir[i]; - __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_OPENDIR, &sys); + __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_OPENDIR, &u); /* * Pull 64 bits out of the result. */ - dir->ppc_dir = ((uint64_t*)&sys)[0]; + dir->ppc_dir = u.ret.dir; if (!dir->ppc_dir) { dir = NULL; } @@ -163,5 +171,5 @@ telldir (DIR *dir) { uint64_t ppc_dir = dir->ppc_dir; - __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_TELLDIR, &ppc_dir); + return __send_to_ppe (JSRE_POSIX1_SIGNALCODE, JSRE_TELLDIR, &ppc_dir); } diff --git a/libgloss/spu/kill.c b/libgloss/spu/kill.c index 8a5d22c82..1aa2f5e59 100644 --- a/libgloss/spu/kill.c +++ b/libgloss/spu/kill.c @@ -31,6 +31,7 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) */ #include +#include int kill (int pid, int sig) @@ -39,5 +40,7 @@ kill (int pid, int sig) { _exit (sig); } + errno = ESRCH; + return -1; }