[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: What not to be doing - syscall()
From:       Thiago Macieira <thiago.macieira () kdemail ! net>
Date:       2003-12-24 5:08:20
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Daniel Stone wrote:
>This is a pretty good example of what *not* to do. syscall() is not
>portable across architectures (it caused a recent FTBFS[1] on
>mips/mipsel for Debian packages). To do this, use sysinfo(&info)
>instead.

Hello,

your changes introduced a new FTBFS in kdeutils/ksim/systeminfo.cpp. The 
following patch causes this:

 {
 #ifdef __linux__
   sysinfo system;
-  if (syscall(SYS_sysinfo, &system) < 0) {
-    fprintf(stderr, "Error calling syscall()\n");
+  if (sysinfo(&system) < 0) {
+    fprintf(stderr, "Error calling sysinfo()\n");
     return;
   }

The construct is obviously wrong because "sysinfo" cannot be at the same time 
a type identifier and a function. Prefixing the type identifier with "struct" 
fixes the problem.

I am attaching the patch I have committed to CVS.
-- 
  Thiago Macieira  -  Registered Linux user #65028
   thiagom (AT) mail (dot) com
    ICQ UIN: 1967141   PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

["ksim-systeminfo.diff" (text/x-diff)]

Index: systeminfo.cpp
===================================================================
RCS file: /home/kde/kdeutils/ksim/systeminfo.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -p -r1.20 -r1.21
--- systeminfo.cpp	22 Dec 2003 23:20:50 -0000	1.20
+++ systeminfo.cpp	24 Dec 2003 05:07:11 -0000	1.21
@@ -124,7 +124,7 @@ System::~System()
 void System::updateData()
 {
 #ifdef __linux__
-  sysinfo system;
+  struct sysinfo system;
   if (sysinfo(&system) < 0) {
     fprintf(stderr, "Error calling sysinfo()\n");
     return;

[Attachment #6 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic