From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.62) (envelope-from ) id 1HF3N6-0001wk-CB for garchives@archives.gentoo.org; Thu, 08 Feb 2007 07:07:08 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.0/8.14.0) with SMTP id l1875uwZ014598; Thu, 8 Feb 2007 07:05:56 GMT Received: from mail.netspace.net.au (mail-out2.netspace.net.au [203.10.110.72]) by robin.gentoo.org (8.14.0/8.14.0) with ESMTP id l1871kmj010022 for ; Thu, 8 Feb 2007 07:01:47 GMT Received: from [172.16.0.52] (ppp246-231.static.internode.on.net [203.122.246.231]) by mail.netspace.net.au (Postfix) with ESMTP id 94BB267F4F for ; Thu, 8 Feb 2007 18:01:40 +1100 (EST) Subject: Re: [gentoo-user] Re: _syscallX isn't in linux-headers-2.6.20 ?? From: Iain Buchanan To: gentoo-user@lists.gentoo.org In-Reply-To: <20070208051045.GA8845@tiny.chatswood.mooter.com> References: <1170895989.14243.49.camel@orpheus> <20070208051045.GA8845@tiny.chatswood.mooter.com> Content-Type: text/plain Date: Thu, 08 Feb 2007 16:31:37 +0930 Message-Id: <1170918098.14243.74.camel@orpheus> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.8.2.1 Content-Transfer-Encoding: 7bit X-Archives-Salt: 9c3d0cd1-7674-4a7e-94bb-6c12615b688c X-Archives-Hash: 3dd041bf85a948ea03f6301ddd6197e1 On Thu, 2007-02-08 at 16:10 +1100, Christian Marie wrote: > On Thu, Feb 08, 2007 at 10:23:09AM +0930, Iain Buchanan wrote: > > Hi all, > > > > I'm trying to use: > > > > _syscall3(int, ioprio_set, int, which, int, who, int, ioprio); > > _syscall2(int, ioprio_get, int, which, int, who); > > > > and supposedly I just > > > > #include > > > > but I'm getting these error from gcc: > > > > error: syntax error before "ioprio_set" > > warning: data definition has no type or storage class > > error: syntax error before "ioprio_get" > > warning: data definition has no type or storage class > > Hi, > > It would be helpful to provide us with the failing code as we have no > clue what you could be doing wrong. sure - my question was more "where has the define for _syscall2 gone?", but here is the code. It comes from /usr/src/linux/Documentation/block/ioprio.txt. I compile it with: $ gcc -o ionice ionice.c ionice.c:36: error: syntax error before "ioprio_set" ionice.c:36: warning: data definition has no type or storage class ionice.c:37: error: syntax error before "ioprio_get" ionice.c:37: warning: data definition has no type or storage class ------begin ionice.c------ // // Sample ionice utility copied from // /usr/src/linux/Documentation/block/ioprio.txt from gentoo kernel version // 2.6.19-suspend2-r1. Probably (C) Jens Axboe and GPL'd? // #include #include #include #include #include #include extern int sys_ioprio_set(int, int, int); extern int sys_ioprio_get(int, int); #if defined(__i386__) #define __NR_ioprio_set 289 #define __NR_ioprio_get 290 #elif defined(__ppc__) #define __NR_ioprio_set 273 #define __NR_ioprio_get 274 #elif defined(__x86_64__) #define __NR_ioprio_set 251 #define __NR_ioprio_get 252 #elif defined(__ia64__) #define __NR_ioprio_set 1274 #define __NR_ioprio_get 1275 #else #error "Unsupported arch" #endif int ioprio_get(int which, int who); int ioprio_set(int which, int who, int ioprio); _syscall3(int, ioprio_set, int, which, int, who, int, ioprio); _syscall2(int, ioprio_get, int, which, int, who); enum { IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE, IOPRIO_CLASS_IDLE, }; enum { IOPRIO_WHO_PROCESS = 1, IOPRIO_WHO_PGRP, IOPRIO_WHO_USER, }; #define IOPRIO_CLASS_SHIFT 13 const char *to_prio[] = { "none", "realtime", "best-effort", "idle", }; int main(int argc, char *argv[]) { int ioprio = 4, set = 0, ioprio_class = IOPRIO_CLASS_BE; int c, pid = 0; while ((c = getopt(argc, argv, "+n:c:p:")) != EOF) { switch (c) { case 'n': ioprio = strtol(optarg, NULL, 10); set = 1; break; case 'c': ioprio_class = strtol(optarg, NULL, 10); set = 1; break; case 'p': pid = strtol(optarg, NULL, 10); break; } } switch (ioprio_class) { case IOPRIO_CLASS_NONE: ioprio_class = IOPRIO_CLASS_BE; break; case IOPRIO_CLASS_RT: case IOPRIO_CLASS_BE: break; case IOPRIO_CLASS_IDLE: ioprio = 7; break; default: printf("bad prio class %d\n", ioprio_class); return 1; } if (!set) { if (!pid && argv[optind]) pid = strtol(argv[optind], NULL, 10); ioprio = ioprio_get(IOPRIO_WHO_PROCESS, pid); printf("pid=%d, %d\n", pid, ioprio); if (ioprio == -1) perror("ioprio_get"); else { ioprio_class = ioprio >> IOPRIO_CLASS_SHIFT; ioprio = ioprio & 0xff; printf("%s: prio %d\n", to_prio[ioprio_class], ioprio); } } else { if (ioprio_set(IOPRIO_WHO_PROCESS, pid, ioprio | ioprio_class << IOPRIO_CLASS_SHIFT) == -1) { perror("ioprio_set"); return 1; } if (argv[optind]) execvp(argv[optind], &argv[optind]); } return 0; } ------end ionice.c------ thanks, -- Iain Buchanan Progress might have been all right once, but it's gone on too long. -- Ogden Nash -- gentoo-user@gentoo.org mailing list