[Linux-ia64] Re: Use of __ia64_syscall() - syscall interface

From: David Mosberger <davidm_at_napali.hpl.hp.com>
Date: 2002-12-18 10:25:38
>>>>> On Tue, 17 Dec 2002 15:00:49 +0100 (NFT), Joel GUILLET <Joel.Guillet@bull.net> said:

  Joel> Actually, I had seen before some (lots of) mails (many from
  Joel> you) that recommands the use of the syscall() interface, but I
  Joel> mis-understood the message...  The problem is that I got some
  Joel> problems to find documentation about this interface and made a
  Joel> mix between the kernel and the glibc interfaces.  (I finally
  Joel> found some in glibc/manual/libc.info-43 )

Yes, syscall() is documented in the glibc manual.

  Joel> #ifndef __NR_sched_setaffinity
  Joel> #ifndef _AFFINITY_H
  Joel> #define _AFFINITY_H

  Joel> #if defined(__ia64__)
  Joel> #define __NR_sched_setaffinity 1231
  Joel> #define __NR_sched_getaffinity 1232
  Joel> #endif

  Joel> #define sched_setaffinity(arg1, arg2, arg3) syscall(__NR_sched_setaffinity, arg1, arg2, arg3)
  Joel> #define sched_getaffinity(arg1, arg2, arg3) syscall(__NR_sched_getaffinity, arg1, arg2, arg3)

  Joel> #endif /* __NR_sched_setaffinity */
  Joel> #endif /* _AFFINITY_H */

This is basically fine, except that for syscall(), the syscall number macros
by convention start with SYS_*.  So I'd rewrite your code to:

#ifndef SYS_sched_setaffinity
#ifndef _AFFINITY_H
#define _AFFINITY_H

#if defined(__ia64__)
#define SYS_sched_setaffinity 1231
#define SYS_sched_getaffinity 1232

#define sched_setaffinity(arg1, arg2, arg3) syscall(SYS_sched_setaffinity, arg1, arg2, arg3)
#define sched_getaffinity(arg1, arg2, arg3) syscall(SYS_sched_getaffinity, arg1, arg2, arg3)

#endif /* SYS_sched_setaffinity */
#endif /* _AFFINITY_H */

Received on Tue Dec 17 15:40:00 2002

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:11 EST