Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(122)

Delta Between Two Patch Sets: src/pkg/syscall/rlimit_linux_test.go

Issue 11803043: code review 11803043: syscall: prlimit argument error for Getrlimit and Setrl...
Left Patch Set: diff -r 40bbcafc819c https://go.googlecode.com/hg/ Created 10 years, 8 months ago
Right Patch Set: diff -r 40bbcafc819c https://go.googlecode.com/hg/ Created 10 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/syscall/syscall_linux_386.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package syscall_test
6
7 import (
8 "syscall"
9 "testing"
10 )
11
12 func TestRlimit(t *testing.T) {
13 var rlimit, zero syscall.Rlimit
14 err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit)
15 if err != nil {
16 t.Fatalf("Getrlimit: save failed: %v", err)
17 }
18 if zero == rlimit {
19 t.Fatalf("Getrlimit: save failed: got zero value %#v", rlimit)
20 }
21 set := rlimit
22 set.Cur = set.Max - 1
23 err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &set)
24 if err != nil {
25 t.Fatalf("Setrlimit: set failed: %#v %v", set, err)
26 }
27 var get syscall.Rlimit
28 err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &get)
29 if err != nil {
30 t.Fatalf("Getrlimit: get failed: %v", err)
31 }
32 set = rlimit
33 set.Cur = set.Max - 1
34 if set != get {
35 t.Fatalf("Rlimit: change failed: wanted %#v got %#v", set, get)
36 }
37 err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlimit)
38 if err != nil {
39 t.Fatalf("Setrlimit: restore failed: %#v %v", rlimit, err)
40 }
41 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b