]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: fix mksysnum_linux.sh
authorAnthony Martin <ality@pbrane.org>
Tue, 11 Jan 2011 19:38:14 +0000 (14:38 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 11 Jan 2011 19:38:14 +0000 (14:38 -0500)
A few system call numbers on x86 Linux are
defined in terms of a previous definition,

e.g.,
#define __NR_timer_create 259
#define __NR_timer_settime (__NR_timer_create+1)
...
#define __NR_mq_open 277
#define __NR_mq_unlink (__NR_mq_open+1)

This change assumes the numbers are sorted
sequentially in the input file.

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/3946041

src/pkg/syscall/mksysnum_linux.sh
src/pkg/syscall/zsysnum_linux_386.go

index 74a1931bb78934dc06788ed62c85e61b8149b5d8..89ece8a91464e0b0d60c381a7455f5cdd4435daa 100755 (executable)
@@ -14,12 +14,20 @@ package syscall
 const(
 EOF
 
+sub fmt {
+       my ($name, $num) = @_;
+       $name =~ y/a-z/A-Z/;
+       print " SYS_$name = $num;\n";
+}
+
+my $prev;
 while(<>){
        if(/^#define __NR_(\w+)\s+([0-9]+)/){
-               my $name = "SYS_$1";
-               my $num = $2;
-               $name =~ y/a-z/A-Z/;
-               print " $name = $num;\n";
+               $prev = $2;
+               fmt($1, $2);
+       }
+       elsif(/^#define __NR_(\w+)\s+\(\w+\+([0-9]+)\)/){
+               fmt($1, $prev+$2)
        }
 }
 
index e45e00fd467a2fbd085b67cd3909c60c6a2039ce..55529adaa71e97e46aad6e6184cc6f3f24d3b806 100644 (file)
@@ -262,6 +262,14 @@ const (
        SYS_REMAP_FILE_PAGES       = 257
        SYS_SET_TID_ADDRESS        = 258
        SYS_TIMER_CREATE           = 259
+       SYS_TIMER_SETTIME          = 260
+       SYS_TIMER_GETTIME          = 261
+       SYS_TIMER_GETOVERRUN       = 262
+       SYS_TIMER_DELETE           = 263
+       SYS_CLOCK_SETTIME          = 264
+       SYS_CLOCK_GETTIME          = 265
+       SYS_CLOCK_GETRES           = 266
+       SYS_CLOCK_NANOSLEEP        = 267
        SYS_STATFS64               = 268
        SYS_FSTATFS64              = 269
        SYS_TGKILL                 = 270
@@ -272,6 +280,11 @@ const (
        SYS_GET_MEMPOLICY          = 275
        SYS_SET_MEMPOLICY          = 276
        SYS_MQ_OPEN                = 277
+       SYS_MQ_UNLINK              = 278
+       SYS_MQ_TIMEDSEND           = 279
+       SYS_MQ_TIMEDRECEIVE        = 280
+       SYS_MQ_NOTIFY              = 281
+       SYS_MQ_GETSETATTR          = 282
        SYS_KEXEC_LOAD             = 283
        SYS_WAITID                 = 284
        SYS_ADD_KEY                = 286