Re: Same syscall is defined to different numbers on 3 different archs(was

Robert Williamson (robbiew@us.ibm.com)
Mon, 7 Apr 2003 11:26:49 -0500


Hmmm...so I guess the only viable solution for a single test to cover as
many archs as possible, is to explicitly define the number for each arch.
Here's how I would do it Aniruddha:
------------------------------------------
#ifdef __i386__
#define __NR_timer_create 259
#endif

#ifdef __x86_64__
#define __NR_timer_create 222
#endif

#if defined(__ppc__) || defined(__ppc64__)
#define __NR_timer_create 240
#else /* Not defined on this architecture */

#include "test.h"
#include "usctest.h"

int TST_TOTAL = 0; /* Total number of testcases */

int main()
{
tst_resm(TCONF,"This system call is not defined for this architecture.");
tst_exit();
/* NOT REACHED */
return(0);
}
#endif /* Not defined on this architecture */

<REST OF TEST HERE>
------------------------------------------

Any comments???

- Robbie

Robert V. Williamson <robbiew@us.ibm.com>
Linux Test Project
IBM Linux Technology Center
Phone: (512) 838-9295 T/L: 678-9295
Fax: (512) 838-4603
Web: http://ltp.sourceforge.net
IRC: #ltp on freenode.irc.net
====================
"Only two things are infinite, the universe and human stupidity, and I'm
not sure about the former." -Albert Einstein


Andi Kleen
<ak@suse.de> To: Robert Williamson/Austin/IBM@IBMUS
Sent by: cc: linux-kernel@vger.kernel.org, aniruddha.marathe@wipro.com,
ak@suse.de ltp-list@lists.sourceforge.net
Subject: Re: Same syscall is defined to different numbers on 3 different archs(was
Re: Makefile issue)
04/07/2003 10:54
AM

"Robert Williamson" <robbiew@us.ibm.com> writes:
>
> Obviously, we could add additional code to check for the running arch and
> define the syscall accordingly, however I'm not sure this is the correct
> way to go. I'm copying our list, as well as the kernel mailing list
about
> this, because I "think" the system calls should be defined to the same
> numbers across all architectures....but I'm not positive. BTW, I
attached

No. Linux has traditionally used different syscall numbers for different
architectures. The original ports (alpha etc.) always used the syscall
numbers
of the "native" Unix, so the numbering was often completely different.
Newer ports who weren't concered about such compatibility often did
a renumbering too. For example x86-64 has a completely new
"cache line optimized" ordering.

What should work on most architectures is
(most = someone told me it doesn't work properly on IA64)

#include </path/to/kernel/source/include/asm-<arch>/unistd.h>
(you need the version in the kernel source because many glibc packagers
in their infinite wisdom use an old outdated copy of asm/ usually from
the last stable kernel only)

_syscallN(...)

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/