Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] psmisc: Remove including sys/user.h and __WORDSIZE
@ 2016-03-29 23:02 Khem Raj
  2016-03-30 13:41 ` Joshua G Lock
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2016-03-29 23:02 UTC (permalink / raw)
  To: openembedded-core

We can replace __WORDSIZE with UINTPTR_MAX
sys/user.h is in conflict with asm/ptrace.h on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch | 49 ++++++++++++++++++++++
 meta/recipes-extended/psmisc/psmisc_22.21.bb       |  8 ++--
 2 files changed, 54 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-extended/psmisc/psmisc/0001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch

diff --git a/meta/recipes-extended/psmisc/psmisc/0001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch b/meta/recipes-extended/psmisc/psmisc/0001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch
new file mode 100644
index 0000000..2e70d5e
--- /dev/null
+++ b/meta/recipes-extended/psmisc/psmisc/0001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch
@@ -0,0 +1,49 @@
+From 004de754e8b2c3cbfaf3aeba511a1c4149b23eb4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 24 Mar 2016 15:46:14 +0000
+Subject: [PATCH] Use UINTPTR_MAX instead of __WORDSIZE
+
+Do not include sys/user.h since it conflicts with
+pt_regs struct from kernel APIs in asm/ptrace.h
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ src/peekfd.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/peekfd.c b/src/peekfd.c
+index cba2130..e2c39cd 100644
+--- a/src/peekfd.c
++++ b/src/peekfd.c
+@@ -30,8 +30,8 @@
+ #include <asm/ptrace.h>
+ #include <byteswap.h>
+ #include <endian.h>
+-#include <sys/user.h>
+ #include <stdlib.h>
++#include <stdint.h>
+ #include <getopt.h>
+ #include <ctype.h>
+ 
+@@ -228,11 +228,11 @@ int main(int argc, char **argv)
+ 		if (WIFSTOPPED(status)) {
+ #ifdef PPC
+ 			struct pt_regs regs;
+-			regs.gpr[0] = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_R0, 0);
+-			regs.gpr[3] = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_R3, 0);
+-			regs.gpr[4] = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_R4, 0);
+-			regs.gpr[5] = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_R5, 0);
+-			regs.orig_gpr3 = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_ORIG_R3, 0);
++			regs.gpr[0] = ptrace(PTRACE_PEEKUSER, pid, UINTPTR_MAX/8 * PT_R0, 0);
++			regs.gpr[3] = ptrace(PTRACE_PEEKUSER, pid, UINTPTR_MAX/8 * PT_R3, 0);
++			regs.gpr[4] = ptrace(PTRACE_PEEKUSER, pid, UINTPTR_MAX/8 * PT_R4, 0);
++			regs.gpr[5] = ptrace(PTRACE_PEEKUSER, pid, UINTPTR_MAX/8 * PT_R5, 0);
++			regs.orig_gpr3 = ptrace(PTRACE_PEEKUSER, pid, UINTPTR_MAX/8 * PT_ORIG_R3, 0);
+ #elif defined(ARM)
+ 			struct pt_regs regs;
+ 			ptrace(PTRACE_GETREGS, pid, 0, &regs);
+-- 
+1.8.3.1
+
diff --git a/meta/recipes-extended/psmisc/psmisc_22.21.bb b/meta/recipes-extended/psmisc/psmisc_22.21.bb
index 66aba9e..1c6473e 100644
--- a/meta/recipes-extended/psmisc/psmisc_22.21.bb
+++ b/meta/recipes-extended/psmisc/psmisc_22.21.bb
@@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
 SRC_URI[md5sum] = "935c0fd6eb208288262b385fa656f1bf"
 SRC_URI[sha256sum] = "97323cad619210845b696d7d722c383852b2acb5c49b5b0852c4f29c77a8145a"
 
-SRC_URI += "file://0001-Typo-in-fuser-makes-M-on-all-the-time.patch \
-            file://0002-Include-limits.h-for-PATH_MAX.patch \
-            "
+SRC_URI = "${SOURCEFORGE_MIRROR}/psmisc/psmisc-${PV}.tar.gz \
+           file://0001-Typo-in-fuser-makes-M-on-all-the-time.patch \
+           file://0002-Include-limits.h-for-PATH_MAX.patch \
+           file://0001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch \
+           "
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] psmisc: Remove including sys/user.h and __WORDSIZE
  2016-03-29 23:02 [PATCH] psmisc: Remove including sys/user.h and __WORDSIZE Khem Raj
@ 2016-03-30 13:41 ` Joshua G Lock
  2016-03-30 17:09   ` Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Joshua G Lock @ 2016-03-30 13:41 UTC (permalink / raw)
  To: openembedded-core

On Tue, 2016-03-29 at 23:02 +0000, Khem Raj wrote:
> We can replace __WORDSIZE with UINTPTR_MAX
> sys/user.h is in conflict with asm/ptrace.h on musl

psmisc is failing to build on the autobuilder with this patch included:

https://autobuilder.yoctoproject.org/main/builders/nightly-no-x11/build
s/65/steps/BuildImages/logs/stdio

https://autobuilder.yoctoproject.org/main/builders/nightly-non-
gpl3/builds/721/steps/BuildImages/logs/stdio

> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  ...001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch | 49
> ++++++++++++++++++++++
>  meta/recipes-extended/psmisc/psmisc_22.21.bb       |  8 ++--
>  2 files changed, 54 insertions(+), 3 deletions(-)
>  create mode 100644 meta/recipes-extended/psmisc/psmisc/0001-Use-
> UINTPTR_MAX-instead-of-__WORDSIZE.patch
> 
> diff --git a/meta/recipes-extended/psmisc/psmisc/0001-Use-
> UINTPTR_MAX-instead-of-__WORDSIZE.patch b/meta/recipes-
> extended/psmisc/psmisc/0001-Use-UINTPTR_MAX-instead-of-
> __WORDSIZE.patch
> new file mode 100644
> index 0000000..2e70d5e
> --- /dev/null
> +++ b/meta/recipes-extended/psmisc/psmisc/0001-Use-UINTPTR_MAX-
> instead-of-__WORDSIZE.patch
> @@ -0,0 +1,49 @@
> +From 004de754e8b2c3cbfaf3aeba511a1c4149b23eb4 Mon Sep 17 00:00:00
> 2001
> +From: Khem Raj <raj.khem@gmail.com>
> +Date: Thu, 24 Mar 2016 15:46:14 +0000
> +Subject: [PATCH] Use UINTPTR_MAX instead of __WORDSIZE
> +
> +Do not include sys/user.h since it conflicts with
> +pt_regs struct from kernel APIs in asm/ptrace.h
> +
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +---
> +Upstream-Status: Pending
> +
> + src/peekfd.c | 12 ++++++------
> + 1 file changed, 6 insertions(+), 6 deletions(-)
> +
> +diff --git a/src/peekfd.c b/src/peekfd.c
> +index cba2130..e2c39cd 100644
> +--- a/src/peekfd.c
> ++++ b/src/peekfd.c
> +@@ -30,8 +30,8 @@
> + #include <asm/ptrace.h>
> + #include <byteswap.h>
> + #include <endian.h>
> +-#include <sys/user.h>
> + #include <stdlib.h>
> ++#include <stdint.h>
> + #include <getopt.h>
> + #include <ctype.h>
> + 
> +@@ -228,11 +228,11 @@ int main(int argc, char **argv)
> + 		if (WIFSTOPPED(status)) {
> + #ifdef PPC
> + 			struct pt_regs regs;
> +-			regs.gpr[0] = ptrace(PTRACE_PEEKUSER, pid,
> __WORDSIZE/8 * PT_R0, 0);
> +-			regs.gpr[3] = ptrace(PTRACE_PEEKUSER, pid,
> __WORDSIZE/8 * PT_R3, 0);
> +-			regs.gpr[4] = ptrace(PTRACE_PEEKUSER, pid,
> __WORDSIZE/8 * PT_R4, 0);
> +-			regs.gpr[5] = ptrace(PTRACE_PEEKUSER, pid,
> __WORDSIZE/8 * PT_R5, 0);
> +-			regs.orig_gpr3 = ptrace(PTRACE_PEEKUSER,
> pid, __WORDSIZE/8 * PT_ORIG_R3, 0);
> ++			regs.gpr[0] = ptrace(PTRACE_PEEKUSER, pid,
> UINTPTR_MAX/8 * PT_R0, 0);
> ++			regs.gpr[3] = ptrace(PTRACE_PEEKUSER, pid,
> UINTPTR_MAX/8 * PT_R3, 0);
> ++			regs.gpr[4] = ptrace(PTRACE_PEEKUSER, pid,
> UINTPTR_MAX/8 * PT_R4, 0);
> ++			regs.gpr[5] = ptrace(PTRACE_PEEKUSER, pid,
> UINTPTR_MAX/8 * PT_R5, 0);
> ++			regs.orig_gpr3 = ptrace(PTRACE_PEEKUSER,
> pid, UINTPTR_MAX/8 * PT_ORIG_R3, 0);
> + #elif defined(ARM)
> + 			struct pt_regs regs;
> + 			ptrace(PTRACE_GETREGS, pid, 0, &regs);
> +-- 
> +1.8.3.1
> +
> diff --git a/meta/recipes-extended/psmisc/psmisc_22.21.bb
> b/meta/recipes-extended/psmisc/psmisc_22.21.bb
> index 66aba9e..1c6473e 100644
> --- a/meta/recipes-extended/psmisc/psmisc_22.21.bb
> +++ b/meta/recipes-extended/psmisc/psmisc_22.21.bb
> @@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e
> 8d672dc4c32c317bb3"
>  SRC_URI[md5sum] = "935c0fd6eb208288262b385fa656f1bf"
>  SRC_URI[sha256sum] =
> "97323cad619210845b696d7d722c383852b2acb5c49b5b0852c4f29c77a8145a"
>  
> -SRC_URI += "file://0001-Typo-in-fuser-makes-M-on-all-the-time.patch
> \
> -            file://0002-Include-limits.h-for-PATH_MAX.patch \
> -            "
> +SRC_URI = "${SOURCEFORGE_MIRROR}/psmisc/psmisc-${PV}.tar.gz \
> +           file://0001-Typo-in-fuser-makes-M-on-all-the-time.patch \
> +           file://0002-Include-limits.h-for-PATH_MAX.patch \
> +           file://0001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch \
> +           "
> -- 
> 1.9.1
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] psmisc: Remove including sys/user.h and __WORDSIZE
  2016-03-30 13:41 ` Joshua G Lock
@ 2016-03-30 17:09   ` Khem Raj
  0 siblings, 0 replies; 3+ messages in thread
From: Khem Raj @ 2016-03-30 17:09 UTC (permalink / raw)
  To: Joshua G Lock; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 4683 bytes --]


> On Mar 30, 2016, at 6:41 AM, Joshua G Lock <joshua.g.lock@linux.intel.com> wrote:
> 
> On Tue, 2016-03-29 at 23:02 +0000, Khem Raj wrote:
>> We can replace __WORDSIZE with UINTPTR_MAX
>> sys/user.h is in conflict with asm/ptrace.h on musl
> 
> psmisc is failing to build on the autobuilder with this patch included:
> 
> https://autobuilder.yoctoproject.org/main/builders/nightly-no-x11/build
> s/65/steps/BuildImages/logs/stdio
> 
> https://autobuilder.yoctoproject.org/main/builders/nightly-non-
> gpl3/builds/721/steps/BuildImages/logs/stdio

Thanks for pointing out. It seems to be x86 only case. I will add appropriate guards
and send a v2.

> 
>> 
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>  ...001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch | 49
>> ++++++++++++++++++++++
>>  meta/recipes-extended/psmisc/psmisc_22.21.bb       |  8 ++--
>>  2 files changed, 54 insertions(+), 3 deletions(-)
>>  create mode 100644 meta/recipes-extended/psmisc/psmisc/0001-Use-
>> UINTPTR_MAX-instead-of-__WORDSIZE.patch
>> 
>> diff --git a/meta/recipes-extended/psmisc/psmisc/0001-Use-
>> UINTPTR_MAX-instead-of-__WORDSIZE.patch b/meta/recipes-
>> extended/psmisc/psmisc/0001-Use-UINTPTR_MAX-instead-of-
>> __WORDSIZE.patch
>> new file mode 100644
>> index 0000000..2e70d5e
>> --- /dev/null
>> +++ b/meta/recipes-extended/psmisc/psmisc/0001-Use-UINTPTR_MAX-
>> instead-of-__WORDSIZE.patch
>> @@ -0,0 +1,49 @@
>> +From 004de754e8b2c3cbfaf3aeba511a1c4149b23eb4 Mon Sep 17 00:00:00
>> 2001
>> +From: Khem Raj <raj.khem@gmail.com>
>> +Date: Thu, 24 Mar 2016 15:46:14 +0000
>> +Subject: [PATCH] Use UINTPTR_MAX instead of __WORDSIZE
>> +
>> +Do not include sys/user.h since it conflicts with
>> +pt_regs struct from kernel APIs in asm/ptrace.h
>> +
>> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> +---
>> +Upstream-Status: Pending
>> +
>> + src/peekfd.c | 12 ++++++------
>> + 1 file changed, 6 insertions(+), 6 deletions(-)
>> +
>> +diff --git a/src/peekfd.c b/src/peekfd.c
>> +index cba2130..e2c39cd 100644
>> +--- a/src/peekfd.c
>> ++++ b/src/peekfd.c
>> +@@ -30,8 +30,8 @@
>> + #include <asm/ptrace.h>
>> + #include <byteswap.h>
>> + #include <endian.h>
>> +-#include <sys/user.h>
>> + #include <stdlib.h>
>> ++#include <stdint.h>
>> + #include <getopt.h>
>> + #include <ctype.h>
>> +
>> +@@ -228,11 +228,11 @@ int main(int argc, char **argv)
>> + 		if (WIFSTOPPED(status)) {
>> + #ifdef PPC
>> + 			struct pt_regs regs;
>> +-			regs.gpr[0] = ptrace(PTRACE_PEEKUSER, pid,
>> __WORDSIZE/8 * PT_R0, 0);
>> +-			regs.gpr[3] = ptrace(PTRACE_PEEKUSER, pid,
>> __WORDSIZE/8 * PT_R3, 0);
>> +-			regs.gpr[4] = ptrace(PTRACE_PEEKUSER, pid,
>> __WORDSIZE/8 * PT_R4, 0);
>> +-			regs.gpr[5] = ptrace(PTRACE_PEEKUSER, pid,
>> __WORDSIZE/8 * PT_R5, 0);
>> +-			regs.orig_gpr3 = ptrace(PTRACE_PEEKUSER,
>> pid, __WORDSIZE/8 * PT_ORIG_R3, 0);
>> ++			regs.gpr[0] = ptrace(PTRACE_PEEKUSER, pid,
>> UINTPTR_MAX/8 * PT_R0, 0);
>> ++			regs.gpr[3] = ptrace(PTRACE_PEEKUSER, pid,
>> UINTPTR_MAX/8 * PT_R3, 0);
>> ++			regs.gpr[4] = ptrace(PTRACE_PEEKUSER, pid,
>> UINTPTR_MAX/8 * PT_R4, 0);
>> ++			regs.gpr[5] = ptrace(PTRACE_PEEKUSER, pid,
>> UINTPTR_MAX/8 * PT_R5, 0);
>> ++			regs.orig_gpr3 = ptrace(PTRACE_PEEKUSER,
>> pid, UINTPTR_MAX/8 * PT_ORIG_R3, 0);
>> + #elif defined(ARM)
>> + 			struct pt_regs regs;
>> + 			ptrace(PTRACE_GETREGS, pid, 0, &regs);
>> +--
>> +1.8.3.1
>> +
>> diff --git a/meta/recipes-extended/psmisc/psmisc_22.21.bb
>> b/meta/recipes-extended/psmisc/psmisc_22.21.bb
>> index 66aba9e..1c6473e 100644
>> --- a/meta/recipes-extended/psmisc/psmisc_22.21.bb
>> +++ b/meta/recipes-extended/psmisc/psmisc_22.21.bb
>> @@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e
>> 8d672dc4c32c317bb3"
>>  SRC_URI[md5sum] = "935c0fd6eb208288262b385fa656f1bf"
>>  SRC_URI[sha256sum] =
>> "97323cad619210845b696d7d722c383852b2acb5c49b5b0852c4f29c77a8145a"
>> 
>> -SRC_URI += "file://0001-Typo-in-fuser-makes-M-on-all-the-time.patch
>> \
>> -            file://0002-Include-limits.h-for-PATH_MAX.patch \
>> -            "
>> +SRC_URI = "${SOURCEFORGE_MIRROR}/psmisc/psmisc-${PV}.tar.gz \
>> +           file://0001-Typo-in-fuser-makes-M-on-all-the-time.patch \
>> +           file://0002-Include-limits.h-for-PATH_MAX.patch \
>> +           file://0001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch \
>> +           "
>> --
>> 1.9.1
>> 
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-30 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-29 23:02 [PATCH] psmisc: Remove including sys/user.h and __WORDSIZE Khem Raj
2016-03-30 13:41 ` Joshua G Lock
2016-03-30 17:09   ` Khem Raj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox