From: John Spencer <maillist-musl@barfooze.de>
To: musl@lists.openwall.com
Subject: Re: sabotage linux X86_64 image with LXDE desktop released
Date: Sun, 22 Jul 2012 01:10:59 +0200 [thread overview]
Message-ID: <500B3703.5030607@barfooze.de> (raw)
In-Reply-To: <20120721205055.GA544@brightrain.aerifal.cx>
On 07/21/2012 10:50 PM, Rich Felker wrote:
> On Sat, Jul 21, 2012 at 10:59:11PM +0200, John Spencer wrote:
>> the desktop works, but is not polished at all - there's no
>> background image and the icon paths seem to be misconfigured.
>> this can be considered a technoloy preview.
>> here is a screenshot: http://i.imgur.com/Lz7Ov.png
> Something seems very wrong with those task manager vm sizes...
> Is this indicative of a bug on musl's side?
>
> Rich
>
here's what it's doing (note that PAGE_SIZE was originally an external
variable which got once filled with sc_sysconf values,
i needed to patch it away because of the conflict with the macro of the
same name)
lxtask-0.1.4/src/xfce-taskmanager-linux.c:
reading the values ...
void get_task_details(gint pid,struct task *task)
{
task->size=0;
sprintf(line,"/proc/%d/statm",pid);
fd=open(line,O_RDONLY);
if(fd==-1) return;
read(fd,line,256);
sscanf(line,"%d %d",&task->size,&task->rss);
close(fd);
if(!task->size) return;
task->size*=PAGE_SIZE;
task->rss*=PAGE_SIZE;
struct task
{
// ...
gint size;
gint rss;
};
displayed using
gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_RSS,
size_to_string(buf, task->rss*1024), -1);
where
char* size_to_string( char* buf, guint64 size )
{
char * unit;
/* guint point; */
gfloat val;
/*
FIXME: Is floating point calculation slower than integer division?
Some profiling is needed here.
*/
if ( size > ( ( guint64 ) 1 ) << 30 )
{
if ( size > ( ( guint64 ) 1 ) << 40 )
{
/*
size /= ( ( ( guint64 ) 1 << 40 ) / 10 );
point = ( guint ) ( size % 10 );
size /= 10;
*/
val = ((gfloat)size) / ( ( guint64 ) 1 << 40 );
unit = "TB";
}
else
{
/*
size /= ( ( 1 << 30 ) / 10 );
point = ( guint ) ( size % 10 );
size /= 10;
*/
val = ((gfloat)size) / ( ( guint64 ) 1 << 30 );
unit = "GB";
}
}
else if ( size > ( 1 << 20 ) )
{
/*
size /= ( ( 1 << 20 ) / 10 );
point = ( guint ) ( size % 10 );
size /= 10;
*/
val = ((gfloat)size) / ( ( guint64 ) 1 << 20 );
unit = "MB";
}
else if ( size > ( 1 << 10 ) )
{
/*
size /= ( ( 1 << 10 ) / 10 );
point = size % 10;
size /= 10;
*/
val = ((gfloat)size) / ( ( guint64 ) 1 << 10 );
unit = "KB";
}
else
{
unit = size > 1 ? "Bytes" : "Byte";
sprintf( buf, "%u %s", ( guint ) size, unit );
return buf;
}
/* sprintf( buf, "%llu.%u %s", size, point, unit ); */
sprintf( buf, "%.1f %s", val, unit );
return buf;
}
next prev parent reply other threads:[~2012-07-21 23:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-21 20:59 John Spencer
2012-07-21 20:50 ` Rich Felker
2012-07-21 23:10 ` John Spencer [this message]
2012-07-21 23:05 ` Rich Felker
2012-07-21 23:50 ` John Spencer
2012-07-22 9:32 ` Daniel Cegiełka
2012-08-07 23:06 ` Roy
2012-08-07 23:29 ` John Spencer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=500B3703.5030607@barfooze.de \
--to=maillist-musl@barfooze.de \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).