Source: umview Version: 0.8.2-1.1 Severity: normal Tags: patch User: debian-powe...@lists.debian.org
Dear Maintainer, Following the same approach as it might be seen along the src pkg, I tried to enable the ppc64 architecture for this package. Initially it failed to build, even adding ppc64el to debian/control file. That was due to some macros definitions which would not apply to powerpc 64-bit The patch attached contains the aforementioned modifications. There might be a more generic way to do this though. Regards. -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: ppc64el (ppc64le) Kernel: Linux 3.13-1-powerpc64le (SMP w/16 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init)
diff -u umview-0.8.2/debian/changelog umview-0.8.2/debian/changelog --- umview-0.8.2/debian/changelog +++ umview-0.8.2/debian/changelog @@ -1,3 +1,11 @@ +umview (0.8.2-1.1ppc64el2) UNRELEASED; urgency=medium + + * debian/patches: Patch ppc64el-syscall.patch added in order to take powerpc + 64-bit into account when modifying/defining some macros. + * debian/control: added ppc64el architecture to Architectures fields. + + -- Fernando Seiti Furusato <ferse...@br.ibm.com> Wed, 11 Mar 2015 19:43:33 +0000 + umview (0.8.2-1.1) unstable; urgency=low * Non-maintainer upload. diff -u umview-0.8.2/debian/control umview-0.8.2/debian/control --- umview-0.8.2/debian/control +++ umview-0.8.2/debian/control @@ -11,7 +11,7 @@ Standards-Version: 3.9.3 Package: umview -Architecture: i386 amd64 powerpc powerpcspe ppc64 +Architecture: i386 amd64 powerpc powerpcspe ppc64 ppc64el Depends: libumlib0 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} Recommends: kernel-patch-viewos, libpurelibc1 Suggests: umview-mod-umdevtap, umview-mod-umlwip @@ -37,7 +37,7 @@ packages because they depend on additional libraries. Package: libumlib0 -Architecture: i386 amd64 powerpc powerpcspe ppc64 +Architecture: i386 amd64 powerpc powerpcspe ppc64 ppc64el Section: libs Depends: ${shlibs:Depends}, ${misc:Depends} Description: View-OS in user space - Support library for modules @@ -61,7 +61,7 @@ module. Package: libumlib-dev -Architecture: i386 amd64 powerpc powerpcspe ppc64 +Architecture: i386 amd64 powerpc powerpcspe ppc64 ppc64el Conflicts: libumlib0-dev Replaces: libumlib0-dev Section: libdevel @@ -89,7 +89,7 @@ tree). Package: umview-mod-umlwip -Architecture: i386 amd64 powerpc powerpcspe ppc64 +Architecture: i386 amd64 powerpc powerpcspe ppc64 ppc64el Depends: libumlib0 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} Description: View-OS in user space - LWIPv6 gateway module View-OS is a novel approach to the process/kernel interface. The semantics of @@ -114,7 +114,7 @@ to the external world through a TUN/TAP device or a VDE switch. Package: umview-mod-umdevtap -Architecture: i386 amd64 powerpc powerpcspe ppc64 +Architecture: i386 amd64 powerpc powerpcspe ppc64 ppc64el Depends: libumlib0 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} Description: View-OS in user space - Virtual TUN/TAP module View-OS is a novel approach to the process/kernel interface. The semantics of @@ -139,7 +139,7 @@ outer side, UMView opens a connection to a VDE switch. Package: umview-mod-viewfs -Architecture: i386 amd64 powerpc powerpcspe ppc64 +Architecture: i386 amd64 powerpc powerpcspe ppc64 ppc64el Depends: libumlib0 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} Description: View-OS in user space - Filesystem mangling modules View-OS is a novel approach to the process/kernel interface. The semantics of only in patch2: unchanged: --- umview-0.8.2.orig/.pc/.quilt_patches +++ umview-0.8.2/.pc/.quilt_patches @@ -0,0 +1 @@ +debian/patches only in patch2: unchanged: --- umview-0.8.2.orig/.pc/.quilt_series +++ umview-0.8.2/.pc/.quilt_series @@ -0,0 +1 @@ +series only in patch2: unchanged: --- umview-0.8.2.orig/.pc/.version +++ umview-0.8.2/.pc/.version @@ -0,0 +1 @@ +2 only in patch2: unchanged: --- umview-0.8.2.orig/.pc/applied-patches +++ umview-0.8.2/.pc/applied-patches @@ -0,0 +1 @@ +ppc64el-syscall.patch only in patch2: unchanged: --- umview-0.8.2.orig/.pc/ppc64el-syscall.patch/include/module.h +++ umview-0.8.2/.pc/ppc64el-syscall.patch/include/module.h @@ -0,0 +1,371 @@ +/* This is part of um-ViewOS + * The user-mode implementation of OSVIEW -- A Process with a View + * + * + * + * Copyright 2005 Renzo Davoli University of Bologna - Italy + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * $Id: module.h 968 2011-08-03 10:16:26Z rd235 $ + * + */ +#ifndef _UM_VIEW_MODULE_H +#define _UM_VIEW_MODULE_H +#include <sys/syscall.h> +#include <unistd.h> +#include <stdarg.h> +#include <stdio.h> +//#include <sys/socket.h> +/* VIRTUAL SYSCALLS */ +#define VIRSYS_UMSERVICE 1 +#define VIRSYS_MSOCKET 2 +#define __NR_msocket VIRSYS_MSOCKET + +struct ht_elem; +extern int _umview_version; + +typedef long (*sysfun)(); +typedef long long epoch_t; +struct treepoch; +struct timestamp { + epoch_t epoch; + struct treepoch *treepoch; +}; + +extern epoch_t tst_matchingepoch(struct timestamp *service_tst); +extern struct timestamp tst_timestamp(); +extern epoch_t get_epoch(); + +extern epoch_t um_setepoch(epoch_t epoch); + +typedef epoch_t (*epochfun)(); + +typedef unsigned long c_set; + +extern int msocket (char *path, int domain, int type, int protocol); + +#define MC_USER 1 +#define MC_CORECTLCLASS(x) ((x) << 1) +#define MC_CORECTLOPT(x) ((x) << 6) +#define MC_USERCTL(ctl) (MC_USER | (ctl << 1)) + +/* To be tested. Bits are fun! */ +#define MC_ISUSER(x) ((x) & MC_USER) +#define MC_USERCTL_CTL(x) (((x) >> 1)) + +#define MC_PROC MC_CORECTLCLASS(0) +#define MC_MODULE MC_CORECTLCLASS(1) +#define MC_MOUNT MC_CORECTLCLASS(2) + +#define MC_ADD MC_CORECTLOPT(0) +#define MC_REM MC_CORECTLOPT(1) + +#define MCH_SET(c, set) *(set) |= (1 << c) +#define MCH_CLR(c, set) *(set) &= ~(1 << c) +#define MCH_ISSET(c, set) (*(set) & (1 << c)) +#define MCH_ZERO(set) *(set) = 0; + +#define CHECKMODULE 0 +#define CHECKPATH 1 +#define CHECKSOCKET 2 +#define CHECKCHRDEVICE 3 +#define CHECKBLKDEVICE 4 +#define CHECKSC 5 +#define CHECKBINFMT 6 +#define CHECKFSALIAS 7 + +// for IOCTL mgmt +#define CHECKIOCTLPARMS 0x40000000 +#define IOCTLLENMASK 0x07ffffff +#define IOCTL_R 0x10000000 +#define IOCTL_W 0x20000000 +struct ioctl_len_req { + int fd; + int req; +}; + +#define BINFMT_MODULE_ALLOC 1 +#define BINFMT_KEEP_ARG0 2 +struct binfmt_req { + char *path; + char *interp; + char *extraarg; + char *buf; + int flags; +}; + + +struct service { + /* short name of the module */ + char *name; + /* description */ + char *description; + + /* handle to service data. It is used by um_service.c to store + * dynamic lib handle (see dlopen (3))*/ + void *dlhandle; + /* destructor for ht_elem's defined by this module */ + void (*destructor)(int type, struct ht_elem *hte); + + /* Generic notification/callback function. The first parameter identifies + * the type of command. The lower 5 bits identify the class, the remaining + * ones identify the command. + * + * Valid classes: + * + * MC_PROC (process birth/dead) + * MC_MODULE (module insertion/removal) + * MC_MOUNT (mount/umount) + * + * Valid commands: + * + * MC_ADD + * MC_REM + * + * Parameters 2 to n depend on the command type. + * + * MC_MODULE | MC_ADD: + * + * + * MC_MODULE | MC_REM: + * + * + * MC_PROC | MC_ADD: int umpid, int pumpid, int numprocs + * numprocs is the current max number of processes: service implementation can use it + * to realloc their internal structures. UMPID is an internal id, *not* + * the pid! id is in the range 0,...,numprocs-1 it is never reassigned during + * the life of a process, can be used as an index for internal data + * pumpid is the similar id for the parent process, -1 if it does not exist + * + * MC_PROC | MC_REM: int umpid + * is the garbage collection function for the data that addproc may have created + * + * MC_MOUNT | MC_ADD: + * + * MC_MOUNT | MC_REM: + * + */ + long (*ctl)(int, char *, va_list); + + /* Mask of ctl classes for which the module want synthetized + * notifications. For example, at module loading time, it may want one + * ctl(MC_PROC | MC_ADD) for each currently running process. + * (hs stands for history set) + */ + c_set ctlhs; + + /* + * (int fd, void *req) + * returns: the length of the field bit_or IOCTL_R/IOCTL_W if the parameter is input/output + */ + sysfun ioctlparms; + + /* proactive management of select/poll system call. The module provides this function + * to activate a callback when an event occurs. + * it has the followin args: + * (void (* cb)(), void *arg, int fd, int events) + * cb: the callback function (if NULL, it means that a previous registration for callback + * must be deleted). + * arg: argument passed to the callback function + * fd: fd (i.e. sfd, the fd as seen by the service module) + * events: as defined in poll(2) + */ + sysfun event_subscribe; + + /* the syscall table, the arguments are the same of the "real world" syscalls,*/ + sysfun *syscall; + + /* the socket call table, the arguments are the same of the "real world" syscalls,*/ + sysfun *socket; + + /* the virtual call table, the arguments are the same of the "real world" syscalls,*/ + sysfun *virsc; +}; + +/* + * #define ESCNO_SOCKET is defined 0x4000 or 0x0 + * depending on the presence of the single socketcall system call + * or one syscall for each socket call*/ +#define ESCNO_VIRSC 0x8000 +#define ESCNO_MASK 0x3fff +#define ESCNO_MAP 0xC000 + +extern int _lwip_version; +extern int scmap_scmapsize; +extern int scmap_sockmapsize; +extern int scmap_virscmapsize; + +extern int um_mod_getpid(void); +//extern void *um_mod_get_private_data(void); +extern void um_mod_set_private_data(void *private_data); +extern void um_mod_set_hte(struct ht_elem *hte); +extern struct ht_elem *um_mod_get_hte(void); +extern int um_mod_umoven(long addr, int len, void *_laddr); +extern int um_mod_umovestr(long addr, int len, void *_laddr); +extern int um_mod_ustoren(long addr, int len, void *_laddr); +extern int um_mod_ustorestr(long addr, int len, void *_laddr); +extern int um_mod_getsyscallno(void); +extern int um_mod_getumpid(void); +extern long* um_mod_getargs(void); +extern struct stat64 *um_mod_getpathstat(void); +extern char *um_mod_getpath(void); +extern int um_mod_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); +extern int um_mod_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); +extern int um_mod_setresuid(uid_t ruid, uid_t euid, uid_t suid); +extern int um_mod_setresgid(gid_t rgid, gid_t egid, gid_t sgid); +extern int um_mod_getfs_uid_gid(uid_t *fsuid, gid_t *fsgid); +extern int um_mod_setfs_uid_gid(uid_t fsuid, gid_t fsgid); +extern int um_mod_getsyscalltype(int escno); +extern int um_mod_event_subscribe(void (* cb)(), void *arg, int fd, int how); +extern int um_mod_nrsyscalls(void); + +extern int uscno(int scno); +extern void service_userctl(unsigned long type, struct service *sender, + char *recipient, ...); + +extern void *openmodule(const char *modname, int flag); + +#define KERN_EMERG "<0>" /* system is unusable */ +#define KERN_ALERT "<1>" /* action must be taken immediately */ +#define KERN_CRIT "<2>" /* critical conditions */ +#define KERN_ERR "<3>" /* error conditions */ +#define KERN_WARNING "<4>" /* warning conditions */ +#define KERN_NOTICE "<5>" /* normal but significant condition */ +#define KERN_INFO "<6>" /* informational */ +#define KERN_DEBUG "<7>" /* debug-level messages */ + +extern int printk(const char *fmt, ...); +extern int vprintk(const char *fmt, va_list ap); + +#define __NR_doesnotexist -1 + +#if defined(__x86_64__) +#define __NR_socketcall __NR_doesnotexist +#define __NR__newselect __NR_doesnotexist +#define __NR_umount __NR_doesnotexist +#define __NR_stat64 __NR_stat +#define __NR_lstat64 __NR_lstat +#define __NR_fstat64 __NR_fstat +#define __NR_statfs64 __NR_statfs +#define __NR_fstatfs64 __NR_fstatfs +//#define __NR_chown32 __NR_chown +//#define __NR_lchown32 __NR_lchown +//#define __NR_fchown32 __NR_fchown +#define __NR_fcntl64 __NR_fcntl +#define __NR__llseek __NR_doesnotexist +#define __NR_send __NR_doesnotexist +#define __NR_recv __NR_doesnotexist +#endif + +#if (__NR_socketcall != __NR_doesnotexist) +#define __NR_socket SYS_SOCKET +#define __NR_bind SYS_BIND +#define __NR_connect SYS_CONNECT +#define __NR_listen SYS_LISTEN +#define __NR_accept SYS_ACCEPT +#define __NR_getsockname SYS_GETSOCKNAME +#define __NR_getpeername SYS_GETPEERNAME +#define __NR_socketpair SYS_SOCKETPAIR +#define __NR_send SYS_SEND +#define __NR_recv SYS_RECV +#define __NR_sendto SYS_SENDTO +#define __NR_recvfrom SYS_RECVFROM +#define __NR_shutdown SYS_SHUTDOWN +#define __NR_setsockopt SYS_SETSOCKOPT +#define __NR_getsockopt SYS_GETSOCKOPT +#define __NR_sendmsg SYS_SENDMSG +#define __NR_recvmsg SYS_RECVMSG +#define ESCNO_SOCKET 0x40000000 +#else +#define ESCNO_SOCKET 0x00000000 +#endif + +#define __NR_msocket VIRSYS_MSOCKET + +#define INTERNAL_MAKE_NAME(a, b) a ## b +#define MAKE_NAME(a, b) INTERNAL_MAKE_NAME(a, b) + +/* GEN stands for "generic" */ +#define GENSERVICESYSCALL(s, scno, sfun, type) ((s).syscall[uscno(MAKE_NAME(__NR_, scno))] = (type) (sfun)) +#define GETSERVICESYSCALL(s, scno) ((s).syscall[uscno(MAKE_NAME(__NR_, scno))]) + +#if (__NR_socketcall == __NR_doesnotexist) +# define GENSERVICESOCKET(s, scno, sfun, type) ((s).syscall[uscno(MAKE_NAME(__NR_, scno))] = (type) (sfun)) +# define GETSERVICESOCKET(s, scno) ((s).syscall[uscno(MAKE_NAME(__NR_, scno))]) +#else +# define GENSERVICESOCKET(s, scno, sfun, type) ((s).socket[MAKE_NAME(__NR_, scno)] = (type) (sfun)) +# define GETSERVICESOCKET(s, scno) ((s).socket[MAKE_NAME(__NR_, scno)]) +#endif + +#define SERVICESYSCALL(s, scno, sfun) GENSERVICESYSCALL(s, scno, sfun, sysfun) +#define SERVICESOCKET(s, scno, sfun) GENSERVICESOCKET(s, scno, sfun, sysfun) + +#define SERVICEVIRSYSCALL(s, scno, sfun) ((s).virsc[MAKE_NAME(__NR_, scno)] = (sysfun) (sfun)) + +#define VIEWOS_SERVICE(s) \ + extern __typeof__ (s) viewos_service __attribute__ ((alias (#s))); + +/* modules can define check functions to test for exceptions */ +typedef int (* confirmfun_t)(int type, void *arg, int arglen, + struct ht_elem *ht); +#define NEGATIVE_MOUNT ((confirmfun_t) 1) +#ifndef MS_KERNMOUNT +#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ +#endif +#define MS_GHOST MS_KERNMOUNT /* ghost mount */ + +/* add a path to the hashtable (this creates an entry for the mounttab) */ +struct ht_elem *ht_tab_pathadd(unsigned char type, const char *source, + const char *path, const char *fstype, + unsigned long mountflags, const char *flags, + struct service *service, unsigned char trailingnumbers, + confirmfun_t confirmfun, void *private_data); + +/* add a generic element to the hashtable */ +struct ht_elem *ht_tab_add(unsigned char type,void *obj,int objlen, + struct service *service, confirmfun_t confirmfun, void *private_data); + +void ht_tab_invalidate(struct ht_elem *hte); + +int ht_tab_del(struct ht_elem *mp); + +void ht_tab_getmtab(FILE *f); + +/*void forall_ht_tab_service_do(unsigned char type, + struct service *service, + void (*fun)(struct ht_elem *ht, void *arg), + void *arg); + +void forall_ht_tab_tst_do(unsigned char type, + void (*fun)(struct ht_elem *ht, void *arg), + void *arg); + +void forall_ht_tab_del_invalid(unsigned char type);*/ + +void *ht_get_private_data(struct ht_elem *hte); + +struct ht_elem *ht_search(int type, void *arg, int objlen, struct service *service); + +void ht_renew(struct ht_elem *hte); + +static inline void *um_mod_get_private_data(void){ + return ht_get_private_data(um_mod_get_hte()); +} + +/* filetab management */ +int addfiletab(int size); +void delfiletab(int i); +void *getfiletab(int i); +#endif only in patch2: unchanged: --- umview-0.8.2.orig/.pc/ppc64el-syscall.patch/um_lib/libummod.c +++ umview-0.8.2/.pc/ppc64el-syscall.patch/um_lib/libummod.c @@ -0,0 +1,66 @@ +/* This is part of um-ViewOS + * The user-mode implementation of OSVIEW -- A Process with a View + * + * + * + * Copyright 2005 Renzo Davoli University of Bologna - Italy + * Modified 2005 Andrea Seraghiti + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * $Id: libummod.c 650 2009-04-23 11:22:50Z rd235 $ + * + */ +#include <unistd.h> +#include <linux/types.h> +#include <sys/types.h> +#include <linux_dirent.h> +#include <linux/unistd.h> +#include <errno.h> +#include <config.h> + +int getdents(unsigned int fd, struct dirent *dirp, unsigned int count) +{ + return syscall(__NR_getdents, fd, dirp, count); +} + +int getdents64(unsigned int fd, struct dirent64 *dirp, unsigned int count) +{ + return syscall(__NR_getdents64, fd, dirp, count); +} + +#if ! defined(__x86_64__) +int fcntl32(int fd, int cmd, long arg) +{ + return syscall(__NR_fcntl, fd, cmd, arg); +} +#endif + +int fcntl64(int fd, int cmd, long arg) +{ +#if defined(__x86_64__) + return syscall(__NR_fcntl, fd, cmd, arg); +#else + return syscall(__NR_fcntl64, fd, cmd, arg); +#endif +} + +#if !defined(__x86_64__) // it doesn't appear in syscall table of amd64 +int _llseek(unsigned int fd, unsigned long offset_high, unsigned long + offset_low, loff_t *result, unsigned int whence) +{ + return syscall(__NR__llseek, fd, offset_high, offset_low, result, whence); +} +#endif + only in patch2: unchanged: --- umview-0.8.2.orig/.pc/ppc64el-syscall.patch/xmview/defs_ppc_km.h +++ umview-0.8.2/.pc/ppc64el-syscall.patch/xmview/defs_ppc_km.h @@ -0,0 +1,38 @@ +/* This is part of um-ViewOS + * The user-mode implementation of OSVIEW -- A Process with a View + * + * defs.h: interfaces to system call arguments (architecture dependant) + * needed for capture_um + * + * Copyright 2005 Renzo Davoli University of Bologna - Italy + * Modified 2005 Mattia Belletti, Ludovico Gardenghi, Andrea Gasparini + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * $Id: defs_ppc_km.h 377 2007-08-28 20:36:16Z garden $ + * + */ +#ifndef _DEFS_PPC +#define _DEFS_PPC + +#define _KERNEL_NSIG 64 +#define _KERNEL_SIGSET_SIZE _KERNEL_NSIG/8 + +#define __NR_setpgrp __NR_doesnotexist + +#define BIGENDIAN +#define LONG_LONG(_l,_h) \ + ((long long)((unsigned long long)(unsigned)(_h) | ((unsigned long long)(_l)<<32))) + +#endif // _DEFS_PPC only in patch2: unchanged: --- umview-0.8.2.orig/.pc/ppc64el-syscall.patch/xmview/defs_ppc_um.h +++ umview-0.8.2/.pc/ppc64el-syscall.patch/xmview/defs_ppc_um.h @@ -0,0 +1,106 @@ +/* This is part of um-ViewOS + * The user-mode implementation of OSVIEW -- A Process with a View + * + * defs.h: interfaces to system call arguments (architecture dependant) + * needed for capture_um + * + * Copyright 2005 Renzo Davoli University of Bologna - Italy + * Modified 2005 Mattia Belletti, Ludovico Gardenghi, Andrea Gasparini + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * $Id: defs_ppc_um.h 974 2011-08-08 08:52:20Z rd235 $ + * + */ +#ifndef _DEFS_PPC +#define _DEFS_PPC +#define _KERNEL_NSIG 64 +#define _KERNEL_SIGSET_SIZE _KERNEL_NSIG/8 + +#include <errno.h> + +#ifndef PT_ORIG_R3 +#define PT_ORIG_R3 34 +#endif + +static inline long getregs(struct pcb *pc) +{ + if (has_ptrace_multi) { + struct ptrace_multi req[] = {{PTRACE_PEEKUSER, 0, pc->saved_regs, 10}, + {PTRACE_PEEKUSER, 4*PT_NIP, &(pc->saved_regs[10]), 1}, + {PTRACE_PEEKUSER, 4*PT_ORIG_R3, &(pc->saved_regs[11]), 1}, + {PTRACE_PEEKUSER, 4*PT_CCR, &(pc->saved_regs[12]), 1}}; + errno=0; + return r_ptrace(PTRACE_MULTI,pc->pid,req,4); + } else { + register int count; + for(count=0;count<10;count++){ + r_ptrace(PTRACE_PEEKUSER,pc->pid,(void*)(4*count),&(pc->saved_regs[count])); + if(errno!=0) break; + } + r_ptrace(PTRACE_PEEKUSER,pc->pid,(void*)(4*PT_NIP),&(pc->saved_regs[10])); + r_ptrace(PTRACE_PEEKUSER,pc->pid,(void*)(4*PT_ORIG_R3),&(pc->saved_regs[11])); + r_ptrace(PTRACE_PEEKUSER,pc->pid,(void*)(4*PT_CCR),&(pc->saved_regs[12])); + return (errno!=0)?-1:0; + } +} + +/* XXX PTRACE_MULTI ORIG_R3 returns -1 when saved */ +static inline long setregs(struct pcb *pc, enum __ptrace_request call, + long op, long sig) +{ + if (has_ptrace_multi) { + struct ptrace_multi req[] = {{PTRACE_POKEUSER, 0, pc->saved_regs, 10}, + {PTRACE_POKEUSER, 4*PT_NIP, &(pc->saved_regs[10]), 1}, + {PTRACE_POKEUSER, 4*PT_CCR, &(pc->saved_regs[12]), 1}, + {call, op, (void *) sig, 0}}; + return r_ptrace(PTRACE_MULTI,pc->pid,req,4); + } else { + int rv,count; + for(count=0;count<10;count++){ + rv=r_ptrace(PTRACE_POKEUSER,pc->pid,(void*)(4*count),pc->saved_regs[count]); + if(rv!=0)break; + } + if(rv==0) rv=r_ptrace(PTRACE_POKEUSER,pc->pid,(void*)(4*PT_NIP),pc->saved_regs[10]); + if(rv==0) rv=r_ptrace(PTRACE_POKEUSER,pc->pid,(void*)(4*PT_CCR),pc->saved_regs[12]); + if(rv==0) rv=r_ptrace(call,pc->pid,op,sig); + return rv; + } +} + +#define getscno(PC) ( (PC)->saved_regs[PT_R0] ) +#define putscno(X,PC) ( (PC)->saved_regs[PT_R0]=(X) ) +#define getargn(N,PC) ( (PC)->saved_regs[PT_R3+(N)] ) +#define getargp(PC) (&((PC)->saved_regs[PT_R3])) +#define putargn(N,X,PC) ( (PC)->saved_regs[PT_R3+(N)]=(X) ) +#define getrv(PC) ( (PC)->saved_regs[12] & 0x10000000 ? -1: (PC)->saved_regs[PT_R3] ) +#define putrv(RV,PC) ( (PC)->saved_regs[PT_R3]=(RV) , 0 ) +#define puterrno(ERR,PC) ({ if(ERR!=0){\ + (PC)->saved_regs[12]=(PC)->saved_regs[12] | 0x10000000;\ + (PC)->saved_regs[PT_R3]=(ERR);\ + } 0;\ + }) +#define puterrno0(PC) +#define getsp(PC) ( (PC)->saved_regs[PT_R1] ) +#define getpc(PC) ( (PC)->saved_regs[10] ) +#define putsp(SP,PC) ( (PC)->saved_regs[PT_R1]=(SP) ; +#define putpc(PCX,PC) ( (PC)->saved_regs[10]=(PCX) ) + +#define BIGENDIAN +#define LONG_LONG(_l,_h) \ + ((long long)((unsigned long long)(unsigned)(_h) | ((unsigned long long)(_l)<<32))) + + +#define __NR_setpgrp __NR_doesnotexist +#endif // _DEFS_PPC only in patch2: unchanged: --- umview-0.8.2.orig/.pc/ppc64el-syscall.patch/xmview/um_basicio.c +++ umview-0.8.2/.pc/ppc64el-syscall.patch/xmview/um_basicio.c @@ -0,0 +1,1010 @@ +/* This is part of um-ViewOS + * The user-mode implementation of OSVIEW -- A Process with a View + * + * um_basicio: io wrappers + * + * Copyright 2005 Renzo Davoli University of Bologna - Italy + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * $Id: um_basicio.c 1013 2011-10-28 10:54:57Z rd235 $ + * + */ +#include <assert.h> +#include <string.h> +#include <fcntl.h> +#include <sys/wait.h> +#include <sys/ptrace.h> +#include <sys/stat.h> +#include <sys/select.h> +#include <sys/types.h> +#include <sys/uio.h> +#include <asm/ptrace.h> +#include <asm/unistd.h> +#include <linux/net.h> +#include <errno.h> +#include <limits.h> +#include <alloca.h> +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <linux/types.h> +#include <linux_dirent.h> +#include <config.h> +#include "defs.h" +#include "umproc.h" +#include "services.h" +#include "um_services.h" +#include "sctab.h" +#include "scmap.h" +#include "utils.h" +#include "hashtab.h" + +#include "gdebug.h" + +static char mode2accessmode_tab[]={R_OK,W_OK,R_OK|W_OK,0}; +#define MODE2ACCESSMODE(mode) mode2accessmode_tab[(mode)&O_ACCMODE] + +/* OPEN & CREAT wrapper "in" phase + * always called (also when service == NULL)*/ +int wrap_in_open(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + int mode,flags; + if (sc_number== __NR_open) { + flags=pc->sysargs[1]; + mode=pc->sysargs[2]; +#ifdef __NR_openat + } else if (sc_number == __NR_openat) { + flags=pc->sysargs[2]; + mode=pc->sysargs[3]; +#endif + } else { + flags=O_CREAT|O_WRONLY|O_TRUNC; + mode=pc->sysargs[1]; + } + if (secure) { + int rv=-1; + if (pc->pathstat.st_mode == 0) { + if (flags & O_CREAT) + rv=um_parentwaccess(pc->path,pc); + else + errno=ENOENT; + } else + rv=um_x_access(pc->path,MODE2ACCESSMODE(flags),pc,&pc->pathstat); + if (rv) { + pc->retval=-1; + pc->erno=errno; + return SC_FAKE; + } + } + if (hte != NULL) { + /* call the module's open */ + if ((pc->retval = um_syscall(pc->path,flags,mode & ~(pc->fdfs->mask))) < 0) + pc->erno = errno; + //printk("open exit a %d %d %s\n",pc->retval,pc->erno,pc->path); + if (pc->retval >= 0 && + (pc->retval=lfd_open(hte,pc->retval,pc->path,flags,0)) >= 0) { + /* change the syscall parms, open the fifo instead of the file */ + um_x_rewritepath(pc,lfd_getfilename(pc->retval),0,0); + putscno(__NR_open,pc); + pc->sysargs[1]=O_RDONLY; + return SC_CALLONXIT; + } else + return SC_FAKE; + } else { + if (__builtin_expect(pc->needs_path_rewrite,0)) { + // printk("needs_path_rewrite OPEN %s %d\n",pc->path,pc->sysscno); +#ifdef __NR_openat + um_x_rewritepath(pc,pc->path,(sc_number == __NR_openat)?1:0,0); +#else + um_x_rewritepath(pc,pc->path,0,0); +#endif + pc->retval=lfd_open(hte,-1,pc->path,flags,0); + return SC_CALLONXIT; + } else { + /* do not register non virtualized files */ + //pc->retval=lfd_open(hte,-1,pc->path,flags,0); + //return SC_TRACEONLY; + return STD_BEHAVIOR; + } + } +} + +/* OPEN & CREAT wrapper: "out" phase */ +int wrap_out_open(int sc_number,struct pcb *pc) { + /* user mode open succeeded */ + if (pc->retval >= 0) { + int fd=getrv(pc); + //printk("open: true return value: %d %d %d\n", fd,pc->retval,getscno(pc)); + /* process syscall succeeded, too */ + if (fd >= 0 && + (lfd_getht(pc->retval) == NULL + || addfd(pc,fd) == 0)) { + /* update open file table*/ + lfd_register(pc->fds,fd,pc->retval); + } else + lfd_close(pc->retval); + } else { + putrv(pc->retval,pc); + puterrno(pc->erno,pc); + } + GDEBUG(3, "end of wrap_out: retval %d errno %d", pc->retval, pc->erno); + return SC_MODICALL; +} + +/* CLOSE wrapper: "in" phase ALWAYS called*/ +int wrap_in_close(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + //printk("wrap in close %d\n", pc->sysargs[0]); + if (hte != NULL) { + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + int lfd=fd2lfd(pc->fds,pc->sysargs[0]); + //printk("UM_SERVICE close %d %d %d\n",pc->sysargs[0],lfd,sfd); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + if (lfd>=0 && lfd_getcount(lfd) <= 1) { + /* no more opened lfd on this file: */ + pc->retval = um_syscall(sfd); + pc->erno=errno; + /* nullify sfd to avoid double close */ + if (pc->retval >= 0) + lfd_nullsfd(lfd); + } else + pc->retval = pc ->erno = 0; + } + return SC_CALLONXIT; + } + else if (fd2lfd(pc->fds,pc->sysargs[0]) >= 0) + return SC_TRACEONLY; + else + return STD_BEHAVIOR; +} + +/* CLOSE wrapper: "out" phase */ +int wrap_out_close(int sc_number,struct pcb *pc) +{ + int lfd=fd2lfd(pc->fds,pc->sysargs[0]); + //printk("close %d ->%d\n",pc->sysargs[0],lfd); + /* delete the lfd table element */ + if (lfd>=0) { + struct ht_elem *hte=lfd_getht(lfd); + lfd_deregister_n_close(pc->fds,pc->sysargs[0]); + if (hte != NULL) { + delfd(pc,pc->sysargs[0]); + putrv(pc->retval,pc); + puterrno(pc->erno,pc); + } + } + return SC_MODICALL; +} + +/* wrap_out for all standard i/o calls. + * The process level syscall is faked (or skipped when ptrace_sysvm exists + * and the module return value/errno must be returned */ +int wrap_out_std(int sc_number,struct pcb *pc) +{ + putrv(pc->retval,pc); + if (pc->retval<0) + puterrno(pc->erno,pc); + return SC_MODICALL; +} + +int wrap_in_read(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + unsigned long pbuf=pc->sysargs[1]; + unsigned long count=pc->sysargs[2]; + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + char *lbuf=(char *)lalloca(count); + if ((pc->retval = um_syscall(sfd,lbuf,count)) < 0) + pc->erno=errno; + if (pc->retval > 0) + ustoren(pc,pbuf,pc->retval,lbuf); + lfree(lbuf,count); + } + return SC_FAKE; +} + +int wrap_in_write(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + unsigned long pbuf=pc->sysargs[1]; + unsigned long count=pc->sysargs[2]; + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + char *lbuf=(char *)lalloca(count); + umoven(pc,pbuf,count,lbuf); + if ((pc->retval = um_syscall(sfd,lbuf,count)) < 0) + pc->erno=errno; + lfree(lbuf,count); + } + return SC_FAKE; +} + + +int wrap_in_pread(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + unsigned long pbuf=pc->sysargs[1]; + unsigned long count=pc->sysargs[2]; + unsigned long long offset; + char *lbuf=(char *)lalloca(count); +#ifdef __NR_pread64 + offset=LONG_LONG(pc->sysargs[3+PALIGN],pc->sysargs[4+PALIGN]); +#else + offset=pc->sysargs[3]; +#endif + if ((pc->retval = um_syscall(sfd,lbuf,count,offset)) < 0) + pc->erno=errno; + if (pc->retval > 0) + ustoren(pc,pbuf,pc->retval,lbuf); + lfree(lbuf,count); + } + return SC_FAKE; +} + +int wrap_in_pwrite(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + unsigned long pbuf=pc->sysargs[1]; + unsigned long count=pc->sysargs[2]; + unsigned long long offset; + char *lbuf=(char *)lalloca(count); +#ifdef __NR_pwrite64 + offset=LONG_LONG(pc->sysargs[3+PALIGN],pc->sysargs[4+PALIGN]); +#else + offset=pc->sysargs[3]; +#endif + umoven(pc,pbuf,count,lbuf); + if ((pc->retval = um_syscall(sfd,lbuf,count,offset)) < 0) + pc->erno=errno; + lfree(lbuf,count); + } + return SC_FAKE; +} + +#ifdef __NR_preadv +int wrap_in_preadv(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + unsigned long vecp=pc->sysargs[1]; + unsigned long count=pc->sysargs[2]; + unsigned long i,totalsize,size; + struct iovec *iovec; + char *lbuf,*p; + unsigned long long offset; +#ifdef __NR_pread64 + offset=LONG_LONG(pc->sysargs[3+PALIGN],pc->sysargs[4+PALIGN]); +#else + offset=pc->sysargs[3]; +#endif + if (__builtin_expect((count > IOV_MAX),0)) count=IOV_MAX; + iovec=(struct iovec *)alloca(count * sizeof(struct iovec)); + umoven(pc,vecp,count * sizeof(struct iovec),(char *)iovec); + for (i=0,totalsize=0;i<count;i++) + totalsize += iovec[i].iov_len; + lbuf=p=(char *)lalloca(totalsize); + /* PREADV is mapped onto PREAD */ + if ((size=pc->retval = um_syscall(sfd,lbuf,totalsize,offset)) >= 0) { + for (i=0;i<count && size>0;i++) { + long qty=(size > iovec[i].iov_len)?iovec[i].iov_len:size; + ustoren(pc,(long)iovec[i].iov_base,qty,p); + p += qty; + size -= qty; + } + } + else + pc->erno=errno; + lfree(lbuf,totalsize); + } + return SC_FAKE; +} +#endif + +#ifdef __NR_pwritev +int wrap_in_pwritev(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + unsigned long vecp=pc->sysargs[1]; + unsigned long count=pc->sysargs[2]; + unsigned long i,totalsize; + struct iovec *iovec; + char *lbuf, *p; + unsigned long long offset; +#ifdef __NR_pwrite64 + offset=LONG_LONG(pc->sysargs[3+PALIGN],pc->sysargs[4+PALIGN]); +#else + offset=pc->sysargs[3]; +#endif + if (__builtin_expect((count > IOV_MAX),0)) count=IOV_MAX; + iovec=(struct iovec *)alloca(count * sizeof(struct iovec)); + umoven(pc,vecp,count * sizeof(struct iovec),(char *)iovec); + for (i=0,totalsize=0;i<count;i++) + totalsize += iovec[i].iov_len; + lbuf=p=(char *)lalloca(totalsize); + for (i=0;i<count;i++) { + long qty=iovec[i].iov_len; + umoven(pc,(long)iovec[i].iov_base,qty,p); + p += qty; + } + /* PWRITEV is mapped onto PWRITE */ + if ((pc->retval = um_syscall(sfd,lbuf,totalsize,offset)) < 0) + pc->erno=errno; + lfree(lbuf,totalsize); + } + return SC_FAKE; +} +#endif + +/* DAMNED! the kernel stat are different! so glibc converts the + * kernel structure. We have to make the reverse conversion! */ +#ifdef __powerpc__ +struct kstat { + unsigned kst_dev; + ino_t kst_ino; + mode_t kst_mode; + nlink_t kst_nlink; + uid_t kst_uid; + gid_t kst_gid; + unsigned kst_rdev; + off_t kst_size; + unsigned long kst_blksize; + unsigned long kst_blocks; + unsigned long kst_atime; + unsigned long kst_atime_nsec; + unsigned long kst_mtime; + unsigned long kst_mtime_nsec; + unsigned long kst_ctime; + unsigned long kst_ctime_nsec; + unsigned long k__unused4; + unsigned long k__unused5; +}; +#endif +#ifdef __i386__ +struct kstat { + unsigned short kst_dev; + unsigned short k__pad1; + unsigned long kst_ino; + unsigned short kst_mode; + unsigned short kst_nlink; + unsigned short kst_uid; + unsigned short kst_gid; + unsigned short kst_rdev; + unsigned short k__pad2; + unsigned long kst_size; + unsigned long kst_blksize; + unsigned long kst_blocks; + unsigned long kst_atime; + unsigned long k__unused1; + unsigned long kst_mtime; + unsigned long k__unused2; + unsigned long kst_ctime; + unsigned long k__unused3; + unsigned long k__unused4; + unsigned long k__unused5; +}; +#endif + +#if ! defined(__x86_64__) +#if 0 +struct kstat { + unsigned long kst_dev; + unsigned long kst_ino; + unsigned long kst_nlink; + + unsigned int kst_mode; + unsigned int kst_uid; + unsigned int kst_gid; + unsigned int k__pad0; + + unsigned long kst_rdev; + + long kst_size; + long kst_blksize; + long kst_blocks; /* Number 512-byte blocks allocated. */ + + unsigned long kst_atime; + unsigned long kst_atime_nsec; + unsigned long kst_mtime; + unsigned long kst_mtime_nsec; + unsigned long kst_ctime; + unsigned long kst_ctime_nsec; + + long k__unused[3]; +}; +#else + + +static void stat64_2kstat(struct stat64 *buf,struct kstat *kbuf) +{ + kbuf->kst_dev = (unsigned short) buf->st_dev; + kbuf->kst_ino = (unsigned long) buf->st_ino; + kbuf->kst_mode = (unsigned short) buf->st_mode; + kbuf->kst_nlink = (unsigned short) buf->st_nlink; + kbuf->kst_uid = (unsigned short) buf->st_uid; + kbuf->kst_gid = (unsigned short) buf->st_gid; + kbuf->kst_rdev = (unsigned short) buf->st_rdev; + kbuf->kst_size = (unsigned long) buf->st_size; + kbuf->kst_blksize = (unsigned long) buf->st_blksize; + kbuf->kst_blocks = (unsigned long) buf->st_blocks; + kbuf->kst_atime = (unsigned long) buf->st_atime; + kbuf->kst_mtime = (unsigned long) buf->st_mtime; + kbuf->kst_ctime = (unsigned long) buf->st_ctime; +} +#endif // if not defined _x86_64 + +int wrap_in_stat(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pbuf=pc->sysargs[1]; + struct stat64 buf64; + + pc->retval = um_syscall(pc->path,&buf64,-1); + if (pc->retval >= 0) { + struct kstat kbuf; + stat64_2kstat(&buf64,&kbuf); + ustoren(pc,pbuf,sizeof(struct kstat),(char *)&kbuf); + } else + pc->erno=errno; + return SC_FAKE; +} + +int wrap_in_fstat(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pbuf=pc->sysargs[1]; + char *path =fd_getpath(pc->fds,pc->sysargs[0]); + if (path == NULL) { + pc->retval= -1; + pc->erno= EBADF; + } else { + struct stat64 buf64; + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if ((pc->retval = um_syscall(path,&buf64,sfd)) >= 0) { + struct kstat kbuf; + stat64_2kstat(&buf64,&kbuf); + ustoren(pc,pbuf,sizeof(struct kstat),(char *)&kbuf); + } + else + pc->erno=errno; + } + return SC_FAKE; +} +#endif // if not defined _x86_64 + +int wrap_in_stat64(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pbuf; + struct stat64 buf; +#if defined(__NR_fstatat64) || defined(__NR_newfstatat) + if (sc_number == +#ifdef __NR_fstatat64 + __NR_fstatat64 +#else + __NR_newfstatat +#endif + ) { + pbuf=pc->sysargs[2]; + /* it is lstat anyway. + if (pc->sysargs[3] & AT_SYMLINK_NOFOLLOW) + um_syscall=ht_syscall(hte,uscno(NR64_lstat)); */ + } else +#endif + pbuf=pc->sysargs[1]; + if ((pc->retval = um_syscall(pc->path,&buf,-1)) >= 0) + ustoren(pc,pbuf,sizeof(struct stat64),&buf); + else + pc->erno=errno; + return SC_FAKE; +} + +int wrap_in_fstat64(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pbuf=pc->sysargs[1]; + char *path=fd_getpath(pc->fds,pc->sysargs[0]); + if (path==NULL) { + pc->retval= -1; + pc->erno= EBADF; + } else { + struct stat64 buf; + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if ((pc->retval = um_syscall(path,&buf,sfd)) >= 0) + ustoren(pc,pbuf,sizeof(struct stat64),&buf); + else + pc->erno=errno; + } + return SC_FAKE; +} + +int wrap_in_readlink(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + unsigned long pbuf; + unsigned long bufsiz; + char *lbuf; +#ifdef __NR_readlinkat + if (sc_number == __NR_readlinkat) { + pbuf=pc->sysargs[2]; + bufsiz=pc->sysargs[3]; + } else +#endif + { + pbuf=pc->sysargs[1]; + bufsiz=pc->sysargs[2]; + } + lbuf=(char *)lalloca(PATH_MAX+1); + if ((pc->retval = (long) um_syscall(pc->path,lbuf,PATH_MAX+1)) >= 0) { + if (pc->retval > bufsiz) + pc->retval = bufsiz; + ustoren(pc,pbuf,pc->retval,lbuf); + } else + pc->erno=errno; + lfree(lbuf,bufsiz); + GDEBUG(10,"wrap_in_readlink - rv=%ld\n",pc->retval); + return SC_FAKE; +} + +/******************************************************************/ +/* DIRENTS STRUCTS */ + +void dents64_to_dents(void* buf,int count){ + struct dirent *dirp=buf; + struct dirent64 *dirp64=buf; + int counter=0; + unsigned short int buf_len; + + for( counter=0; counter<count ; ){ + char tmptype; + GDEBUG(10,"dirent64: ino:%lld - off:%lld - reclen:%d - name:%s",dirp64->d_ino,dirp64->d_off,dirp64->d_reclen,&(dirp64->d_name)); + dirp->d_ino = (unsigned long) dirp64->d_ino; + dirp->d_off = (unsigned long) dirp64->d_off; + buf_len = dirp->d_reclen = dirp64->d_reclen; + tmptype = dirp64->d_type; + memmove(dirp->d_name,dirp64->d_name,strlen(dirp64->d_name)+1); + *((char *) dirp + buf_len - 1)=tmptype; + counter= counter + dirp->d_reclen; //bad... + GDEBUG(10,"dirent: ino:%ld - off:%ld - reclen:%d - name:%s",dirp->d_ino,dirp->d_off,dirp->d_reclen,(dirp->d_name)); + GDEBUG(10,"counter: %d count: %d ",counter,count); + dirp = (struct dirent*) ((char*)dirp + buf_len); + dirp64 = (struct dirent64*) ((char*)dirp64 + buf_len); + } +} + +int wrap_in_getdents(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pbuf=pc->sysargs[1]; + unsigned long bufsiz=pc->sysargs[2]; + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + //printk("wrap_in_getdents(sc:%d ,pc,service:%s,syscall);\n",sc_number,ht_get_servicename(hte)); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + char *lbuf=(char *)lalloca(bufsiz); + if ((pc->retval = um_syscall(sfd,lbuf,bufsiz)) >= 0) { + dents64_to_dents(lbuf,pc->retval); + ustoren(pc,pbuf,pc->retval,lbuf); + } + else + pc->erno=errno; + lfree(lbuf,bufsiz); + } + return SC_FAKE; +} + +int wrap_in_getdents64(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pbuf=pc->sysargs[1]; + unsigned long bufsiz=pc->sysargs[2]; + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + //printk("wrap_in_getdents(sc:%d ,pc,service:%s,syscall);\n",sc_number,ht_get_servicename(hte)); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + char *lbuf=(char *)lalloca(bufsiz); + if ((pc->retval = um_syscall(sfd,lbuf,bufsiz)) >= 0) + ustoren(pc,pbuf,pc->retval,lbuf); + else + pc->erno=errno; + lfree(lbuf,bufsiz); + } + return SC_FAKE; +} + +int wrap_in_access(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + unsigned long mode; + long flags; +#ifdef __NR_faccessat + if (sc_number == __NR_faccessat) { + mode=pc->sysargs[2]; + flags=pc->sysargs[3]; + } + else +#endif + { + mode=pc->sysargs[1]; + flags=0; + } + if (isnosys(um_syscall)) { + if ((pc->retval = um_x_access(pc->path,mode,pc,&pc->pathstat) < 0)) + pc->erno=errno; + } + else if ((pc->retval = um_syscall(pc->path,mode,flags)) < 0) + pc->erno=errno; + return SC_FAKE; +} + +#if (__NR__llseek == __NR_doesnotexist) +int wrap_in_lseek(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + long offset =pc->sysargs[1]; + long whence =pc->sysargs[2]; + if ((pc->retval = um_syscall(sfd,offset,whence)) == -1) + pc->erno=errno; + } + return SC_FAKE; +} + +#else +int wrap_in_lseek(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + long offset =pc->sysargs[1]; + long whence =pc->sysargs[2]; + if (isnosys(um_syscall)) { + loff_t lresult; + um_syscall=ht_syscall(hte,uscno(__NR__llseek)); + pc->retval = um_syscall(sfd, + (offset>0)?0:-1,offset,&lresult,whence); + if (pc->retval != -1) { + pc->retval=lresult; + if (pc->retval != lresult) { + pc->retval = -1; + pc->erno = EOVERFLOW; + } + } + } else { + if ((pc->retval = um_syscall(sfd,offset,whence)) == -1) + pc->erno=errno; + } + } + return SC_FAKE; +} + + +int wrap_in_llseek(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + unsigned long offhi=pc->sysargs[1]; + unsigned long offlo=pc->sysargs[2]; + unsigned long result=pc->sysargs[3]; + unsigned int whence=pc->sysargs[4]; + loff_t lresult; + if (!isnosys(um_syscall)) { + if ((pc->retval = um_syscall(sfd,offhi,offlo,&lresult,whence))< 0) + pc->erno=errno; + else + ustoren(pc,result,sizeof(loff_t),(char *)&lresult); + } else {/* backup solution translate it to lseek when possible */ + if ((offhi==0 && !(offlo & 1<<31)) || ((offhi == ~0 && (offlo & 1<<31)))) { + long shortresult; + um_syscall=ht_syscall(hte,uscno(__NR_lseek)); + if ((shortresult=um_syscall(sfd,offlo,whence)) == -1) { + pc->retval=-1; + pc->erno=errno; + } else { + lresult=result; + pc->retval=0; + ustoren(pc,result,sizeof(loff_t),(char *)&lresult); + } + } else { + pc->retval=-1; + pc->erno=EFAULT; + } + } + } + return SC_FAKE; +} +#endif + +int wrap_in_notsupp(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + //printk("wrap_in_notsupp %d\n",sc_number); + pc->retval= -1; + pc->erno= EOPNOTSUPP; + return SC_FAKE; +} + +int wrap_in_readv(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + unsigned long vecp=pc->sysargs[1]; + unsigned long count=pc->sysargs[2]; + unsigned long i,totalsize,size; + struct iovec *iovec; + char *lbuf,*p; + if (__builtin_expect((count > IOV_MAX),0)) count=IOV_MAX; + iovec=(struct iovec *)alloca(count * sizeof(struct iovec)); + umoven(pc,vecp,count * sizeof(struct iovec),(char *)iovec); + for (i=0,totalsize=0;i<count;i++) + totalsize += iovec[i].iov_len; + lbuf=p=(char *)lalloca(totalsize); + /* READV is mapped onto READ */ + if ((size=pc->retval = um_syscall(sfd,lbuf,totalsize)) >= 0) { + for (i=0;i<count && size>0;i++) { + long qty=(size > iovec[i].iov_len)?iovec[i].iov_len:size; + ustoren(pc,(long)iovec[i].iov_base,qty,p); + p += qty; + size -= qty; + } + } + else + pc->erno=errno; + lfree(lbuf,totalsize); + } + return SC_FAKE; +} + +int wrap_in_writev(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + if (sfd < 0) { + pc->retval= -1; + pc->erno= EBADF; + } else { + unsigned long vecp=pc->sysargs[1]; + unsigned long count=pc->sysargs[2]; + unsigned long i,totalsize; + struct iovec *iovec; + char *lbuf, *p; + if (__builtin_expect((count > IOV_MAX),0)) count=IOV_MAX; + iovec=(struct iovec *)alloca(count * sizeof(struct iovec)); + umoven(pc,vecp,count * sizeof(struct iovec),(char *)iovec); + for (i=0,totalsize=0;i<count;i++) + totalsize += iovec[i].iov_len; + lbuf=p=(char *)lalloca(totalsize); + for (i=0;i<count;i++) { + long qty=iovec[i].iov_len; + umoven(pc,(long)iovec[i].iov_base,qty,p); + p += qty; + } + /* WRITEV is mapped onto WRITE */ + if ((pc->retval = um_syscall(sfd,lbuf,totalsize)) < 0) + pc->erno=errno; + lfree(lbuf,totalsize); + } + return SC_FAKE; +} + +/* ATTR management */ +#ifdef __NR_getxattr +int wrap_in_getxattr(int sc_number, struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pname = pc->sysargs[1]; + long pbuf = pc->sysargs[2]; + size_t size = pc->sysargs[3]; + char name[XATTR_NAME_MAX]; + char *buf; + + if (size > XATTR_SIZE_MAX) size=XATTR_SIZE_MAX; + buf = alloca(size); + + umovestr(pc,pname,XATTR_NAME_MAX,name); + if ((pc->retval = um_syscall(pc->path, name, buf, size, -1)) >= 0) + ustoren(pc, pbuf, size, buf); + else + pc->erno = errno; + + return SC_FAKE; +} + +int wrap_in_fgetxattr(int sc_number, struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pname = pc->sysargs[1]; + long pbuf = pc->sysargs[2]; + size_t size = pc->sysargs[3]; + char name[XATTR_NAME_MAX]; + char *path =fd_getpath(pc->fds,pc->sysargs[0]); + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + char *buf; + + if (size > XATTR_SIZE_MAX) size=XATTR_SIZE_MAX; + buf = alloca(size); + + umovestr(pc,pname,XATTR_NAME_MAX,name); + if ((pc->retval = um_syscall(path, name, buf, size, sfd)) >= 0) + ustoren(pc, pbuf, size, buf); + else + pc->erno = errno; + + return SC_FAKE; +} + + +int wrap_in_setxattr(int sc_number, struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pname = pc->sysargs[1]; + long pbuf = pc->sysargs[2]; + size_t size = pc->sysargs[3]; + int flags = pc->sysargs[4]; + char name[XATTR_NAME_MAX]; + char *buf; + + if (size > XATTR_SIZE_MAX) size=XATTR_SIZE_MAX; + buf = alloca(size); + + umovestr(pc,pname,XATTR_NAME_MAX,name); + umoven(pc,pbuf,size,buf); + + if ((pc->retval = um_syscall(pc->path, name, buf, size, flags, -1)) < 0) + pc->erno = errno; + + return SC_FAKE; +} + +int wrap_in_fsetxattr(int sc_number, struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pname = pc->sysargs[1]; + long pbuf = pc->sysargs[2]; + size_t size = pc->sysargs[3]; + int flags = pc->sysargs[4]; + char name[XATTR_NAME_MAX]; + char *path =fd_getpath(pc->fds,pc->sysargs[0]); + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + char *buf; + + if (size > XATTR_SIZE_MAX) size=XATTR_SIZE_MAX; + buf = alloca(size); + + umovestr(pc,pname,XATTR_NAME_MAX,name); + umoven(pc,pbuf,size,buf); + + if ((pc->retval = um_syscall(path, name, buf, size, flags, sfd)) < 0) + pc->erno = errno; + + return SC_FAKE; +} + +int wrap_in_listxattr(int sc_number, struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pbuf = pc->sysargs[1]; + size_t size = pc->sysargs[2]; + char *buf; + + if (size > XATTR_LIST_MAX) size=XATTR_LIST_MAX; + buf = alloca(size); + + if ((pc->retval = um_syscall(pc->path, buf, size, -1)) >= 0) + ustoren(pc, pbuf, size, buf); + else + pc->erno = errno; + + return SC_FAKE; +} + + +int wrap_in_flistxattr(int sc_number, struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pbuf = pc->sysargs[1]; + size_t size = pc->sysargs[2]; + char *path =fd_getpath(pc->fds,pc->sysargs[0]); + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + char *buf; + + if (size > XATTR_LIST_MAX) size=XATTR_LIST_MAX; + buf = alloca(size); + + if ((pc->retval = um_syscall(path, buf, size, sfd)) >= 0) + ustoren(pc, pbuf, size, buf); + else + pc->erno = errno; + + return SC_FAKE; +} + +int wrap_in_removexattr(int sc_number, struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pname = pc->sysargs[1]; + char name[XATTR_NAME_MAX]; + + umovestr(pc,pname,XATTR_NAME_MAX,name); + if ((pc->retval = um_syscall(pc->path, name, -1)) < 0) + pc->erno = errno; + + return SC_FAKE; +} + +int wrap_in_fremovexattr(int sc_number, struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +{ + long pname = pc->sysargs[1]; + char name[XATTR_NAME_MAX]; + char *path =fd_getpath(pc->fds,pc->sysargs[0]); + int sfd=fd2sfd(pc->fds,pc->sysargs[0]); + + umovestr(pc,pname,XATTR_NAME_MAX,name); + if ((pc->retval = um_syscall(path, name, sfd)) < 0) + pc->erno = errno; + + return SC_FAKE; +} +#endif only in patch2: unchanged: --- umview-0.8.2.orig/debian/patches/ppc64el-syscall.patch +++ umview-0.8.2/debian/patches/ppc64el-syscall.patch @@ -0,0 +1,157 @@ +--- a/include/module.h ++++ b/include/module.h +@@ -251,7 +251,7 @@ + + #define __NR_doesnotexist -1 + +-#if defined(__x86_64__) ++#if defined(__x86_64__) || defined(__powerpc64__) + #define __NR_socketcall __NR_doesnotexist + #define __NR__newselect __NR_doesnotexist + #define __NR_umount __NR_doesnotexist +--- a/um_lib/libummod.c ++++ b/um_lib/libummod.c +@@ -49,7 +49,7 @@ + + int fcntl64(int fd, int cmd, long arg) + { +-#if defined(__x86_64__) ++#if defined(__x86_64__) || defined(__powerpc64__) + return syscall(__NR_fcntl, fd, cmd, arg); + #else + return syscall(__NR_fcntl64, fd, cmd, arg); +--- a/xmview/defs_ppc_km.h ++++ b/xmview/defs_ppc_km.h +@@ -31,7 +31,47 @@ + + #define __NR_setpgrp __NR_doesnotexist + +-#define BIGENDIAN ++#ifdef __powerpc64__ ++ ++#ifdef __BIG_ENDIAN__ ++# define BIGENDIAN ++#else ++# define LITTLEENDIAN ++#endif // __BIG_ENDIAN__ ++ ++#define __NR_socketcall __NR_doesnotexist ++ ++#define __NR__newselect __NR_doesnotexist ++#define __NR_umount __NR_doesnotexist ++#define __NR_stat64 __NR_doesnotexist ++#define __NR_lstat64 __NR_doesnotexist ++#define __NR_fstat64 __NR_doesnotexist ++#undef __NR_chown32 ++#define __NR_chown32 __NR_doesnotexist ++#undef __NR_lchown32 ++#define __NR_lchown32 __NR_doesnotexist ++#undef __NR_fchown32 ++#define __NR_fchown32 __NR_doesnotexist ++#define __NR_fcntl64 __NR_doesnotexist ++#define __NR__llseek __NR_doesnotexist ++#define __NR_truncate64 __NR_doesnotexist ++#define __NR_ftruncate64 __NR_doesnotexist ++#define __NR_send __NR_doesnotexist ++#define __NR_recv __NR_doesnotexist ++#define __NR_statfs64 __NR_doesnotexist ++#define __NR_fstatfs64 __NR_doesnotexist ++#define __NR_nice __NR_doesnotexist ++#define __NR_mmap2 __NR_doesnotexist ++ ++/* XXX: should we find a more elegant solution? */ ++#define wrap_in_statfs64 NULL ++#define wrap_in_fstatfs64 NULL ++ ++#define wrap_in_stat wrap_in_stat64 ++#define wrap_in_fstat wrap_in_fstat64 ++ ++#endif // __powerpc64__ ++ + #define LONG_LONG(_l,_h) \ + ((long long)((unsigned long long)(unsigned)(_h) | ((unsigned long long)(_l)<<32))) + +--- a/xmview/defs_ppc_um.h ++++ b/xmview/defs_ppc_um.h +@@ -97,10 +97,50 @@ + #define putsp(SP,PC) ( (PC)->saved_regs[PT_R1]=(SP) ; + #define putpc(PCX,PC) ( (PC)->saved_regs[10]=(PCX) ) + +-#define BIGENDIAN ++#ifdef __powerpc64__ ++ ++#ifdef __BIG_ENDIAN__ ++# define BIGENDIAN ++#else ++# define LITTLEENDIAN ++#endif // __BIG_ENDIAN__ ++ ++#define __NR_socketcall __NR_doesnotexist ++ ++#define __NR__newselect __NR_doesnotexist ++#define __NR_umount __NR_doesnotexist ++#define __NR_stat64 __NR_doesnotexist ++#define __NR_lstat64 __NR_doesnotexist ++#define __NR_fstat64 __NR_doesnotexist ++#undef __NR_chown32 ++#define __NR_chown32 __NR_doesnotexist ++#undef __NR_lchown32 ++#define __NR_lchown32 __NR_doesnotexist ++#undef __NR_fchown32 ++#define __NR_fchown32 __NR_doesnotexist ++#define __NR_fcntl64 __NR_doesnotexist ++#define __NR__llseek __NR_doesnotexist ++#define __NR_truncate64 __NR_doesnotexist ++#define __NR_ftruncate64 __NR_doesnotexist ++#define __NR_send __NR_doesnotexist ++#define __NR_recv __NR_doesnotexist ++#define __NR_statfs64 __NR_doesnotexist ++#define __NR_fstatfs64 __NR_doesnotexist ++#define __NR_nice __NR_doesnotexist ++#define __NR_mmap2 __NR_doesnotexist ++ ++/* XXX: should we find a more elegant solution? */ ++#define wrap_in_statfs64 NULL ++#define wrap_in_fstatfs64 NULL ++ ++#define wrap_in_stat wrap_in_stat64 ++#define wrap_in_fstat wrap_in_fstat64 ++ ++#endif // __powerpc64__ ++ + #define LONG_LONG(_l,_h) \ + ((long long)((unsigned long long)(unsigned)(_h) | ((unsigned long long)(_l)<<32))) + +- + #define __NR_setpgrp __NR_doesnotexist ++ + #endif // _DEFS_PPC +--- a/xmview/um_basicio.c ++++ b/xmview/um_basicio.c +@@ -427,7 +427,7 @@ + }; + #endif + +-#if ! defined(__x86_64__) ++#if !defined(__x86_64__) && !defined(__powerpc64__) + #if 0 + struct kstat { + unsigned long kst_dev; +@@ -473,7 +473,7 @@ + kbuf->kst_mtime = (unsigned long) buf->st_mtime; + kbuf->kst_ctime = (unsigned long) buf->st_ctime; + } +-#endif // if not defined _x86_64 ++#endif // if 0 + + int wrap_in_stat(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) +@@ -512,7 +512,7 @@ + } + return SC_FAKE; + } +-#endif // if not defined _x86_64 ++#endif // if not defined _x86_64 && __powerpc64__ + + int wrap_in_stat64(int sc_number,struct pcb *pc, + struct ht_elem *hte, sysfun um_syscall) only in patch2: unchanged: --- umview-0.8.2.orig/debian/patches/series +++ umview-0.8.2/debian/patches/series @@ -0,0 +1 @@ +ppc64el-syscall.patch only in patch2: unchanged: --- umview-0.8.2.orig/include/module.h +++ umview-0.8.2/include/module.h @@ -251,7 +251,7 @@ #define __NR_doesnotexist -1 -#if defined(__x86_64__) +#if defined(__x86_64__) || defined(__powerpc64__) #define __NR_socketcall __NR_doesnotexist #define __NR__newselect __NR_doesnotexist #define __NR_umount __NR_doesnotexist only in patch2: unchanged: --- umview-0.8.2.orig/um_lib/libummod.c +++ umview-0.8.2/um_lib/libummod.c @@ -49,7 +49,7 @@ int fcntl64(int fd, int cmd, long arg) { -#if defined(__x86_64__) +#if defined(__x86_64__) || defined(__powerpc64__) return syscall(__NR_fcntl, fd, cmd, arg); #else return syscall(__NR_fcntl64, fd, cmd, arg); only in patch2: unchanged: --- umview-0.8.2.orig/xmview/defs_ppc_km.h +++ umview-0.8.2/xmview/defs_ppc_km.h @@ -31,7 +31,47 @@ #define __NR_setpgrp __NR_doesnotexist -#define BIGENDIAN +#ifdef __powerpc64__ + +#ifdef __BIG_ENDIAN__ +# define BIGENDIAN +#else +# define LITTLEENDIAN +#endif // __BIG_ENDIAN__ + +#define __NR_socketcall __NR_doesnotexist + +#define __NR__newselect __NR_doesnotexist +#define __NR_umount __NR_doesnotexist +#define __NR_stat64 __NR_doesnotexist +#define __NR_lstat64 __NR_doesnotexist +#define __NR_fstat64 __NR_doesnotexist +#undef __NR_chown32 +#define __NR_chown32 __NR_doesnotexist +#undef __NR_lchown32 +#define __NR_lchown32 __NR_doesnotexist +#undef __NR_fchown32 +#define __NR_fchown32 __NR_doesnotexist +#define __NR_fcntl64 __NR_doesnotexist +#define __NR__llseek __NR_doesnotexist +#define __NR_truncate64 __NR_doesnotexist +#define __NR_ftruncate64 __NR_doesnotexist +#define __NR_send __NR_doesnotexist +#define __NR_recv __NR_doesnotexist +#define __NR_statfs64 __NR_doesnotexist +#define __NR_fstatfs64 __NR_doesnotexist +#define __NR_nice __NR_doesnotexist +#define __NR_mmap2 __NR_doesnotexist + +/* XXX: should we find a more elegant solution? */ +#define wrap_in_statfs64 NULL +#define wrap_in_fstatfs64 NULL + +#define wrap_in_stat wrap_in_stat64 +#define wrap_in_fstat wrap_in_fstat64 + +#endif // __powerpc64__ + #define LONG_LONG(_l,_h) \ ((long long)((unsigned long long)(unsigned)(_h) | ((unsigned long long)(_l)<<32))) only in patch2: unchanged: --- umview-0.8.2.orig/xmview/defs_ppc_um.h +++ umview-0.8.2/xmview/defs_ppc_um.h @@ -97,10 +97,50 @@ #define putsp(SP,PC) ( (PC)->saved_regs[PT_R1]=(SP) ; #define putpc(PCX,PC) ( (PC)->saved_regs[10]=(PCX) ) -#define BIGENDIAN +#ifdef __powerpc64__ + +#ifdef __BIG_ENDIAN__ +# define BIGENDIAN +#else +# define LITTLEENDIAN +#endif // __BIG_ENDIAN__ + +#define __NR_socketcall __NR_doesnotexist + +#define __NR__newselect __NR_doesnotexist +#define __NR_umount __NR_doesnotexist +#define __NR_stat64 __NR_doesnotexist +#define __NR_lstat64 __NR_doesnotexist +#define __NR_fstat64 __NR_doesnotexist +#undef __NR_chown32 +#define __NR_chown32 __NR_doesnotexist +#undef __NR_lchown32 +#define __NR_lchown32 __NR_doesnotexist +#undef __NR_fchown32 +#define __NR_fchown32 __NR_doesnotexist +#define __NR_fcntl64 __NR_doesnotexist +#define __NR__llseek __NR_doesnotexist +#define __NR_truncate64 __NR_doesnotexist +#define __NR_ftruncate64 __NR_doesnotexist +#define __NR_send __NR_doesnotexist +#define __NR_recv __NR_doesnotexist +#define __NR_statfs64 __NR_doesnotexist +#define __NR_fstatfs64 __NR_doesnotexist +#define __NR_nice __NR_doesnotexist +#define __NR_mmap2 __NR_doesnotexist + +/* XXX: should we find a more elegant solution? */ +#define wrap_in_statfs64 NULL +#define wrap_in_fstatfs64 NULL + +#define wrap_in_stat wrap_in_stat64 +#define wrap_in_fstat wrap_in_fstat64 + +#endif // __powerpc64__ + #define LONG_LONG(_l,_h) \ ((long long)((unsigned long long)(unsigned)(_h) | ((unsigned long long)(_l)<<32))) - #define __NR_setpgrp __NR_doesnotexist + #endif // _DEFS_PPC only in patch2: unchanged: --- umview-0.8.2.orig/xmview/um_basicio.c +++ umview-0.8.2/xmview/um_basicio.c @@ -427,7 +427,7 @@ }; #endif -#if ! defined(__x86_64__) +#if !defined(__x86_64__) && !defined(__powerpc64__) #if 0 struct kstat { unsigned long kst_dev; @@ -473,7 +473,7 @@ kbuf->kst_mtime = (unsigned long) buf->st_mtime; kbuf->kst_ctime = (unsigned long) buf->st_ctime; } -#endif // if not defined _x86_64 +#endif // if 0 int wrap_in_stat(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall) @@ -512,7 +512,7 @@ } return SC_FAKE; } -#endif // if not defined _x86_64 +#endif // if not defined _x86_64 && __powerpc64__ int wrap_in_stat64(int sc_number,struct pcb *pc, struct ht_elem *hte, sysfun um_syscall)