fix building the package on x86_64
This commit is contained in:
parent
f5d183abc7
commit
7e4dbde9be
173
psmisc-22.5-peekfd-x86_64.patch
Normal file
173
psmisc-22.5-peekfd-x86_64.patch
Normal file
@ -0,0 +1,173 @@
|
||||
--- psmisc-22.5/configure.ac.x86_64 2007-06-14 12:25:38.000000000 +0200
|
||||
+++ psmisc-22.5/configure.ac 2007-06-14 12:30:28.000000000 +0200
|
||||
@@ -58,13 +58,28 @@
|
||||
AC_TYPE_SIZE_T
|
||||
AC_CHECK_MEMBERS([struct stat.st_rdev])
|
||||
AC_TYPE_UID_T
|
||||
-AC_CHECK_MEMBERS([struct user_regs_struct.orig_eax, struct user_regs_struct.eax, struct user_regs_struct.ebx, struct user_regs_struct.ecx, struct user_regs_struct.edx], [],[], [#include <linux/user.h>])
|
||||
-AM_CONDITIONAL(WANT_PEEKFD,
|
||||
+AC_CHECK_MEMBERS([struct user_regs_struct.orig_eax,
|
||||
+ struct user_regs_struct.eax,
|
||||
+ struct user_regs_struct.ebx,
|
||||
+ struct user_regs_struct.ecx,
|
||||
+ struct user_regs_struct.edx,
|
||||
+ struct user_regs_struct.orig_rax,
|
||||
+ struct user_regs_struct.rax,
|
||||
+ struct user_regs_struct.rdi,
|
||||
+ struct user_regs_struct.rsi,
|
||||
+ struct user_regs_struct.rdx], [],[], [#include <linux/user.h>])
|
||||
+AM_CONDITIONAL(WANT_PEEKFD_I386,
|
||||
test $ac_cv_member_struct_user_regs_struct_orig_eax = yes &&
|
||||
test $ac_cv_member_struct_user_regs_struct_eax = yes &&
|
||||
test $ac_cv_member_struct_user_regs_struct_ebx = yes &&
|
||||
test $ac_cv_member_struct_user_regs_struct_ecx = yes &&
|
||||
test $ac_cv_member_struct_user_regs_struct_edx = yes )
|
||||
+AM_CONDITIONAL(WANT_PEEKFD_X86_64,
|
||||
+ test $ac_cv_member_struct_user_regs_struct_orig_rax = yes &&
|
||||
+ test $ac_cv_member_struct_user_regs_struct_rax = yes &&
|
||||
+ test $ac_cv_member_struct_user_regs_struct_rdi = yes &&
|
||||
+ test $ac_cv_member_struct_user_regs_struct_rsi = yes &&
|
||||
+ test $ac_cv_member_struct_user_regs_struct_rdx = yes )
|
||||
|
||||
dnl Check for language stuff
|
||||
AM_GNU_GETTEXT([external])
|
||||
--- psmisc-22.5/src/peekfd.c.x86_64 2007-06-14 12:26:25.000000000 +0200
|
||||
+++ psmisc-22.5/src/peekfd.c 2007-06-14 12:37:51.000000000 +0200
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
+#include <sys/syscall.h>
|
||||
#include <linux/user.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
@@ -33,6 +34,20 @@
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
+#ifdef I386
|
||||
+ #define REG_ORIG_ACCUM orig_eax
|
||||
+ #define REG_ACCUM eax
|
||||
+ #define REG_PARAM1 ebx
|
||||
+ #define REG_PARAM2 ecx
|
||||
+ #define REG_PARAM3 edx
|
||||
+#elif X86_64
|
||||
+ #define REG_ORIG_ACCUM orig_rax
|
||||
+ #define REG_ACCUM rax
|
||||
+ #define REG_PARAM1 rdi
|
||||
+ #define REG_PARAM2 rsi
|
||||
+ #define REG_PARAM3 rdx
|
||||
+#endif
|
||||
+
|
||||
#define MAX_ATTACHED_PIDS 1024
|
||||
int num_attached_pids = 0;
|
||||
pid_t attached_pids[MAX_ATTACHED_PIDS];
|
||||
@@ -106,11 +121,6 @@
|
||||
{"version", 0, NULL, 'V'},
|
||||
};
|
||||
|
||||
- if (argc < 2) {
|
||||
- usage();
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
/* Setup the i18n */
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale(LC_ALL, "");
|
||||
@@ -118,7 +128,12 @@
|
||||
textdomain(PACKAGE);
|
||||
#endif
|
||||
|
||||
- while ((optc = getopt_long(argc, argv, "8nfdhV",options, NULL)) != -1) {
|
||||
+ if (argc < 2) {
|
||||
+ usage();
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ while ((optc = getopt_long(argc, argv, "8ncdhV",options, NULL)) != -1) {
|
||||
switch(optc) {
|
||||
case '8':
|
||||
eight_bit_clean = 1;
|
||||
@@ -177,35 +192,50 @@
|
||||
ptrace(PTRACE_GETREGS, pid, 0, ®s);
|
||||
|
||||
/*unsigned int b = ptrace(PTRACE_PEEKTEXT, pid, regs.eip, 0);*/
|
||||
+ printf("orig_rax = %ld\n", regs.REG_ORIG_ACCUM);
|
||||
+ printf("rax = %ld\n", regs.REG_ACCUM);
|
||||
+ printf("rbx = %ld\n", regs.REG_PARAM1);
|
||||
+ printf("rcx = %ld\n", regs.REG_PARAM2);
|
||||
+ printf("rdx = %ld\n", regs.REG_PARAM3);
|
||||
+ printf("r8 = %ld\n", regs.r8);
|
||||
+ printf("r9 = %ld\n", regs.r9);
|
||||
+ printf("r10 = %ld\n", regs.r10);
|
||||
+ printf("r11 = %ld\n", regs.r11);
|
||||
+ printf("r12 = %ld\n", regs.r12);
|
||||
+ printf("r13 = %ld\n", regs.r13);
|
||||
+ printf("r14 = %ld\n", regs.r14);
|
||||
+ printf("r15 = %ld\n", regs.r15);
|
||||
+ printf("rsi = %ld\n", regs.rsi);
|
||||
+ printf("rdi = %ld\n", regs.rdi);
|
||||
|
||||
- if (follow_forks && (regs.orig_eax == 2 || regs.orig_eax == 120)) {
|
||||
- if (regs.eax > 0)
|
||||
- attach(regs.eax);
|
||||
+ if (follow_forks && (regs.REG_ORIG_ACCUM == SYS_fork || regs.REG_ORIG_ACCUM == SYS_clone)) {
|
||||
+ if (regs.REG_ACCUM > 0)
|
||||
+ attach(regs.REG_ACCUM);
|
||||
}
|
||||
- if ((regs.orig_eax == 3 || regs.orig_eax == 4) && (regs.edx == regs.eax)) {
|
||||
+ if ((regs.REG_ORIG_ACCUM == SYS_read || regs.REG_ORIG_ACCUM == SYS_write) && (regs.REG_PARAM3 == regs.REG_ACCUM)) {
|
||||
for (i = 0; i < numfds; i++)
|
||||
- if (fds[i] == regs.ebx)
|
||||
+ if (fds[i] == regs.REG_PARAM1)
|
||||
break;
|
||||
if (i != numfds || numfds == 0) {
|
||||
- if (regs.ebx != lastfd || regs.orig_eax != lastdir) {
|
||||
- lastfd = regs.ebx;
|
||||
- lastdir = regs.orig_eax;
|
||||
+ if (regs.REG_PARAM1 != lastfd || regs.REG_ORIG_ACCUM != lastdir) {
|
||||
+ lastfd = regs.REG_PARAM1;
|
||||
+ lastdir = regs.REG_ORIG_ACCUM;
|
||||
if (!no_headers)
|
||||
- printf("\n%sing fd %i:\n", regs.orig_eax == 3 ? "read" : "writ", lastfd);
|
||||
+ printf("\n%sing fd %i:\n", regs.REG_ORIG_ACCUM == SYS_read ? "read" : "writ", lastfd);
|
||||
}
|
||||
if (!remove_duplicates || lastbuf == NULL
|
||||
- || last_buf_size != regs.edx ||
|
||||
- bufdiff(pid, lastbuf, regs.ecx, regs.edx)) {
|
||||
+ || last_buf_size != regs.REG_PARAM3 ||
|
||||
+ bufdiff(pid, lastbuf, regs.REG_PARAM2, regs.REG_PARAM3)) {
|
||||
|
||||
if (remove_duplicates) {
|
||||
if (lastbuf)
|
||||
free(lastbuf);
|
||||
- lastbuf = malloc(regs.edx);
|
||||
- last_buf_size = regs.edx;
|
||||
+ lastbuf = malloc(regs.REG_PARAM3);
|
||||
+ last_buf_size = regs.REG_PARAM3;
|
||||
}
|
||||
|
||||
- for (i = 0; i < regs.edx; i++) {
|
||||
- unsigned int a = ptrace(PTRACE_PEEKTEXT, pid, regs.ecx + i, 0);
|
||||
+ for (i = 0; i < regs.REG_PARAM3; i++) {
|
||||
+ unsigned int a = ptrace(PTRACE_PEEKTEXT, pid, regs.REG_PARAM2 + i, 0);
|
||||
if (remove_duplicates)
|
||||
lastbuf[i] = a & 0xff;
|
||||
|
||||
--- psmisc-22.5/src/Makefile.am.x86_64 2007-06-14 12:26:11.000000000 +0200
|
||||
+++ psmisc-22.5/src/Makefile.am 2007-06-14 12:34:00.000000000 +0200
|
||||
@@ -2,8 +2,13 @@
|
||||
AM_CFLAGS = -Wall -DLOCALEDIR=\"/usr/share/locale\"
|
||||
|
||||
bin_PROGRAMS = fuser killall pstree oldfuser
|
||||
-if WANT_PEEKFD
|
||||
+if WANT_PEEKFD_I386
|
||||
bin_PROGRAMS += peekfd
|
||||
+ AM_CFLAGS += -DI386
|
||||
+endif
|
||||
+if WANT_PEEKFD_X86_64
|
||||
+ bin_PROGRAMS += peekfd
|
||||
+ AM_CFLAGS += -DX86_64
|
||||
endif
|
||||
|
||||
oldfuser_SOURCES = oldfuser.c comm.h signals.c signals.h loop.h i18n.h
|
@ -8,6 +8,8 @@ Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
|
||||
URL: http://psmisc.sourceforge.net
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
Patch0: psmisc-22.6-peekfd64.patch
|
||||
|
||||
BuildRequires: libselinux-devel
|
||||
BuildRequires: gettext
|
||||
BuildRequires: ncurses-devel
|
||||
@ -22,10 +24,11 @@ of processes that are using specified files or filesystems.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
#%patch0 -p1
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE"
|
||||
autoreconf
|
||||
%configure --prefix=/usr --enable-selinux
|
||||
make %{?_smp_mflags}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user