-
Notifications
You must be signed in to change notification settings - Fork 17.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syscall: prlimit argument error for Getrlimit and Setrlimit on Linux …
…32-bit The rlimit arguments for prlimit are reversed for linux 32-bit (386 and arm). Getrlimit becomes Setrlimit and vice versa. Fixes #5949. R=iant, mikioh.mikioh, rsc CC=golang-dev https://golang.org/cl/11803043
- Loading branch information
Showing
3 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2013 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package syscall_test | ||
|
||
import ( | ||
"syscall" | ||
"testing" | ||
) | ||
|
||
func TestRlimit(t *testing.T) { | ||
var rlimit, zero syscall.Rlimit | ||
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit) | ||
if err != nil { | ||
t.Fatalf("Getrlimit: save failed: %v", err) | ||
} | ||
if zero == rlimit { | ||
t.Fatalf("Getrlimit: save failed: got zero value %#v", rlimit) | ||
} | ||
set := rlimit | ||
set.Cur = set.Max - 1 | ||
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &set) | ||
if err != nil { | ||
t.Fatalf("Setrlimit: set failed: %#v %v", set, err) | ||
} | ||
var get syscall.Rlimit | ||
err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &get) | ||
if err != nil { | ||
t.Fatalf("Getrlimit: get failed: %v", err) | ||
} | ||
set = rlimit | ||
set.Cur = set.Max - 1 | ||
if set != get { | ||
t.Fatalf("Rlimit: change failed: wanted %#v got %#v", set, get) | ||
} | ||
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlimit) | ||
if err != nil { | ||
t.Fatalf("Setrlimit: restore failed: %#v %v", rlimit, err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters