From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1332 Path: news.gmane.org!not-for-mail From: John Spencer Newsgroups: gmane.linux.lib.musl.general Subject: Re: sabotage linux X86_64 image with LXDE desktop released Date: Sun, 22 Jul 2012 01:10:59 +0200 Message-ID: <500B3703.5030607@barfooze.de> References: <500B181F.7080406@barfooze.de> <20120721205055.GA544@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1342911600 4535 80.91.229.3 (21 Jul 2012 23:00:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 21 Jul 2012 23:00:00 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1333-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jul 22 01:00:00 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1SsieV-0006WE-SS for gllmg-musl@plane.gmane.org; Sun, 22 Jul 2012 00:59:59 +0200 Original-Received: (qmail 21632 invoked by uid 550); 21 Jul 2012 22:59:58 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 21624 invoked from network); 21 Jul 2012 22:59:58 -0000 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110221 SUSE/3.1.8 Mail/1.0 In-Reply-To: <20120721205055.GA544@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:1332 Archived-At: 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; }