Urgent: 5000 Euro Reward

bridged with qnx.rtos
Ryan J. Allen

Re: process name vs. file name

Post by Ryan J. Allen » Mon Apr 10, 2006 8:28 pm

ysw wrote:
Yes, I do use the usemsg, and also ldrel to place my own QNX_info
section. As soon as I disable them the .note section is filled with
01.01. I can even delete the this section after I call usemsg and
ldrel. Actually, it is fine with me if any information is plased
there. What wonders me is why that data is taken as a process name.
Ultimately this is not the expected behavior. I have filed a PR for this.

I've noticed that the problem happens when using ldrel. usemsg, by
default, uses ldrel to insert the use message into the binary. By
supplying the -o argument to usemsg you can force it to use objcopy.
This is the make project (with qconfig.mk, qtargets.mk, and etc.) on
self-hosted Neutrino (6.3.0 SP2) platform.
If usemsg -o is an acceptable workaround for you you can insert the
following into your common.mk to have the build system invoke usemsg
with the -o parameter:

UM_HOST = $(QNX_HOST)/usr/bin/usemsg -o
UM_nto_x86_wcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_x86_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_mips_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_ppc_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_sh_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_arm_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE

Regards,

--
Ryan J. Allen
ryallen@qnx.com

Ryan J. Allen

Re: process name vs. file name

Post by Ryan J. Allen » Mon Apr 10, 2006 8:28 pm

ysw wrote:
Yes, I do use the usemsg, and also ldrel to place my own QNX_info
section. As soon as I disable them the .note section is filled with
01.01. I can even delete the this section after I call usemsg and
ldrel. Actually, it is fine with me if any information is plased
there. What wonders me is why that data is taken as a process name.
Ultimately this is not the expected behavior. I have filed a PR for this.

I've noticed that the problem happens when using ldrel. usemsg, by
default, uses ldrel to insert the use message into the binary. By
supplying the -o argument to usemsg you can force it to use objcopy.
This is the make project (with qconfig.mk, qtargets.mk, and etc.) on
self-hosted Neutrino (6.3.0 SP2) platform.
If usemsg -o is an acceptable workaround for you you can insert the
following into your common.mk to have the build system invoke usemsg
with the -o parameter:

UM_HOST = $(QNX_HOST)/usr/bin/usemsg -o
UM_nto_x86_wcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_x86_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_mips_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_ppc_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_sh_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_arm_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE

Regards,

--
Ryan J. Allen
ryallen@qnx.com

Ryan J. Allen

Re: process name vs. file name

Post by Ryan J. Allen » Mon Apr 10, 2006 8:28 pm

ysw wrote:
Yes, I do use the usemsg, and also ldrel to place my own QNX_info
section. As soon as I disable them the .note section is filled with
01.01. I can even delete the this section after I call usemsg and
ldrel. Actually, it is fine with me if any information is plased
there. What wonders me is why that data is taken as a process name.
Ultimately this is not the expected behavior. I have filed a PR for this.

I've noticed that the problem happens when using ldrel. usemsg, by
default, uses ldrel to insert the use message into the binary. By
supplying the -o argument to usemsg you can force it to use objcopy.
This is the make project (with qconfig.mk, qtargets.mk, and etc.) on
self-hosted Neutrino (6.3.0 SP2) platform.
If usemsg -o is an acceptable workaround for you you can insert the
following into your common.mk to have the build system invoke usemsg
with the -o parameter:

UM_HOST = $(QNX_HOST)/usr/bin/usemsg -o
UM_nto_x86_wcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_x86_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_mips_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_ppc_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_sh_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_arm_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE

Regards,

--
Ryan J. Allen
ryallen@qnx.com

Ryan J. Allen

Re: process name vs. file name

Post by Ryan J. Allen » Mon Apr 10, 2006 8:28 pm

ysw wrote:
Yes, I do use the usemsg, and also ldrel to place my own QNX_info
section. As soon as I disable them the .note section is filled with
01.01. I can even delete the this section after I call usemsg and
ldrel. Actually, it is fine with me if any information is plased
there. What wonders me is why that data is taken as a process name.
Ultimately this is not the expected behavior. I have filed a PR for this.

I've noticed that the problem happens when using ldrel. usemsg, by
default, uses ldrel to insert the use message into the binary. By
supplying the -o argument to usemsg you can force it to use objcopy.
This is the make project (with qconfig.mk, qtargets.mk, and etc.) on
self-hosted Neutrino (6.3.0 SP2) platform.
If usemsg -o is an acceptable workaround for you you can insert the
following into your common.mk to have the build system invoke usemsg
with the -o parameter:

UM_HOST = $(QNX_HOST)/usr/bin/usemsg -o
UM_nto_x86_wcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_x86_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_mips_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_ppc_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_sh_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_arm_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE

Regards,

--
Ryan J. Allen
ryallen@qnx.com

Ryan J. Allen

Re: process name vs. file name

Post by Ryan J. Allen » Mon Apr 10, 2006 8:28 pm

ysw wrote:
Yes, I do use the usemsg, and also ldrel to place my own QNX_info
section. As soon as I disable them the .note section is filled with
01.01. I can even delete the this section after I call usemsg and
ldrel. Actually, it is fine with me if any information is plased
there. What wonders me is why that data is taken as a process name.
Ultimately this is not the expected behavior. I have filed a PR for this.

I've noticed that the problem happens when using ldrel. usemsg, by
default, uses ldrel to insert the use message into the binary. By
supplying the -o argument to usemsg you can force it to use objcopy.
This is the make project (with qconfig.mk, qtargets.mk, and etc.) on
self-hosted Neutrino (6.3.0 SP2) platform.
If usemsg -o is an acceptable workaround for you you can insert the
following into your common.mk to have the build system invoke usemsg
with the -o parameter:

UM_HOST = $(QNX_HOST)/usr/bin/usemsg -o
UM_nto_x86_wcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_x86_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_mips_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_ppc_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_sh_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_arm_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE

Regards,

--
Ryan J. Allen
ryallen@qnx.com

Ryan J. Allen

Re: process name vs. file name

Post by Ryan J. Allen » Mon Apr 10, 2006 8:28 pm

ysw wrote:
Yes, I do use the usemsg, and also ldrel to place my own QNX_info
section. As soon as I disable them the .note section is filled with
01.01. I can even delete the this section after I call usemsg and
ldrel. Actually, it is fine with me if any information is plased
there. What wonders me is why that data is taken as a process name.
Ultimately this is not the expected behavior. I have filed a PR for this.

I've noticed that the problem happens when using ldrel. usemsg, by
default, uses ldrel to insert the use message into the binary. By
supplying the -o argument to usemsg you can force it to use objcopy.
This is the make project (with qconfig.mk, qtargets.mk, and etc.) on
self-hosted Neutrino (6.3.0 SP2) platform.
If usemsg -o is an acceptable workaround for you you can insert the
following into your common.mk to have the build system invoke usemsg
with the -o parameter:

UM_HOST = $(QNX_HOST)/usr/bin/usemsg -o
UM_nto_x86_wcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_x86_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_mips_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_ppc_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_sh_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_arm_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE

Regards,

--
Ryan J. Allen
ryallen@qnx.com

Ryan J. Allen

Re: process name vs. file name

Post by Ryan J. Allen » Mon Apr 10, 2006 8:28 pm

ysw wrote:
Yes, I do use the usemsg, and also ldrel to place my own QNX_info
section. As soon as I disable them the .note section is filled with
01.01. I can even delete the this section after I call usemsg and
ldrel. Actually, it is fine with me if any information is plased
there. What wonders me is why that data is taken as a process name.
Ultimately this is not the expected behavior. I have filed a PR for this.

I've noticed that the problem happens when using ldrel. usemsg, by
default, uses ldrel to insert the use message into the binary. By
supplying the -o argument to usemsg you can force it to use objcopy.
This is the make project (with qconfig.mk, qtargets.mk, and etc.) on
self-hosted Neutrino (6.3.0 SP2) platform.
If usemsg -o is an acceptable workaround for you you can insert the
following into your common.mk to have the build system invoke usemsg
with the -o parameter:

UM_HOST = $(QNX_HOST)/usr/bin/usemsg -o
UM_nto_x86_wcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_x86_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_mips_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_ppc_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_sh_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_arm_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE

Regards,

--
Ryan J. Allen
ryallen@qnx.com

Ryan J. Allen

Re: process name vs. file name

Post by Ryan J. Allen » Mon Apr 10, 2006 8:28 pm

ysw wrote:
Yes, I do use the usemsg, and also ldrel to place my own QNX_info
section. As soon as I disable them the .note section is filled with
01.01. I can even delete the this section after I call usemsg and
ldrel. Actually, it is fine with me if any information is plased
there. What wonders me is why that data is taken as a process name.
Ultimately this is not the expected behavior. I have filed a PR for this.

I've noticed that the problem happens when using ldrel. usemsg, by
default, uses ldrel to insert the use message into the binary. By
supplying the -o argument to usemsg you can force it to use objcopy.
This is the make project (with qconfig.mk, qtargets.mk, and etc.) on
self-hosted Neutrino (6.3.0 SP2) platform.
If usemsg -o is an acceptable workaround for you you can insert the
following into your common.mk to have the build system invoke usemsg
with the -o parameter:

UM_HOST = $(QNX_HOST)/usr/bin/usemsg -o
UM_nto_x86_wcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_x86_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_mips_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_ppc_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_sh_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_arm_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE

Regards,

--
Ryan J. Allen
ryallen@qnx.com

Ryan J. Allen

Re: process name vs. file name

Post by Ryan J. Allen » Mon Apr 10, 2006 8:28 pm

ysw wrote:
Yes, I do use the usemsg, and also ldrel to place my own QNX_info
section. As soon as I disable them the .note section is filled with
01.01. I can even delete the this section after I call usemsg and
ldrel. Actually, it is fine with me if any information is plased
there. What wonders me is why that data is taken as a process name.
Ultimately this is not the expected behavior. I have filed a PR for this.

I've noticed that the problem happens when using ldrel. usemsg, by
default, uses ldrel to insert the use message into the binary. By
supplying the -o argument to usemsg you can force it to use objcopy.
This is the make project (with qconfig.mk, qtargets.mk, and etc.) on
self-hosted Neutrino (6.3.0 SP2) platform.
If usemsg -o is an acceptable workaround for you you can insert the
following into your common.mk to have the build system invoke usemsg
with the -o parameter:

UM_HOST = $(QNX_HOST)/usr/bin/usemsg -o
UM_nto_x86_wcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_x86_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_mips_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_ppc_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_sh_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE
UM_nto_arm_gcc = $(UM_HOST) -s __USAGENTO -s __USAGE

Regards,

--
Ryan J. Allen
ryallen@qnx.com

jiv

Re: how to let hogs run only once,don't update every 3 secon

Post by jiv » Sun Apr 15, 2007 8:30 am

dxwangwrote:
I want to print the percent of cpu for idle process in my c program.
1) if pclose(ptr) is used (this means I just want hogs run only
once). the program can't print the message I want, just print the
message about the broken pipe. (if use fd , the program run
correctly. I know this problem occurs because hogs update message
every 3 seconds . but I just want to print message only once.)
2) if pclose(ptr) isn't used (this means print the message all the
time ) , the program can't print the message immediately. I have
tried fflush(stdout) and setvbuf为_IONBF,but still can't solve it
I don't know how to slove this two programs. Thanks.


char *cmd = "hogs | awk '{if($1==1)print$4}'";
// char *cmd = "hogs | awk '{print$4}'";
char buf [10];
FILE *ptr;
short idlecpu;
if ((ptr = popen(cmd, "r")) != NULL)
if(fgets(buf,10, ptr) != NULL)
{
if(fgets(buf,10, ptr) != NULL)
idlecpu=atoi(buf);
printf("idlecpu=%d \n",idlecpu);
printf("%s ",buf);

}
pclose(ptr);
printf("exit!");
Hi!
Maybe you try one's luck with hogslike code inside?
good luck!

jiv

re:how to let hogs run only once,don't update every 3 second

Post by jiv » Sun Apr 15, 2007 8:30 am

dxwangwrote:
You mean I could refer the hogs source code ? I have read it , I
think it is difficult for me to get information I want. I just want
to get the whole cpu information, not the information for every
process.
Eclipse IDE with profiler support?

dxwang

re:how to let hogs run only once,don't update every 3 second

Post by dxwang » Sun Apr 15, 2007 8:30 am

You mean I could refer the hogs source code ? I have read it , I
think it is difficult for me to get information I want. I just want
to get the whole cpu information, not the information for every
process.

Post Reply

Return to “qnx.rtos”