[maemo-developers] System calls

From: Visti Andresen talpa at galnet.dk
Date: Mon Feb 19 19:53:33 EET 2007
On Mon, 19 Feb 2007 12:09:10 +0100
"Carlos GP" <cbing0786 at gmail.com> wrote:

> The following program works just fine under my regular Linux box.
> #include <unistd.h>
> int main()
> {
>  system("ls>kk");
>  return 0;
> }
> ----
> I don't think so. It doesn't create me any "kk" archive...
> I'll try again, but...
> -- 
> Carlos GP

I "upgraded" the test to:
#include <stdio.h>
#include <stdlib.h>

int main()
  int error = system("ls>kk");
  if (error == 0){
  else {
    printf("Failure: %d\n", error);
  return 0;

and tried to compile it under scratchbox-apophis:

gcc -Wall -O0 -g -o test_armtel test.c

-Wall, told me that unistd.h didn't define "system", oddly the exe works just fine with unistd.h too...
I was too lazy to use -Wall last night. Just another example why all code should be compiled using Wall :)
As you can see the code has been compiled "gdb friendly" so you should be able to use the in gdb.

I have attached a small tar.gz archive containing the source and exe files for both i386 and arm.

The exe files work just fine in the scratchbox, and the arm exe also works on my n770

More information about the maemo-developers mailing list