Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(155)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Delta Between Two Patch Sets: src/net/port_unix.go

Issue 142200044: code review 142200044: net: allow all unix /etc/* pathes to be assignable.
Left Patch Set: Created 11 years, 3 months ago
Right Patch Set: diff -r 6b163ec2122a172030284060788f535ab3b9d0e3 https://code.google.com/p/go Created 11 years, 3 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 | « src/net/lookup_unix.go ('k') | no next file » | no next file with change/comment »
('i') | ('e') | ('c') | ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris 5 // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
6 6
7 // Read system port mappings from /etc/services 7 // Read system port mappings from /etc/services
8 8
9 package net 9 package net
10 10
11 import "sync" 11 import "sync"
12 12
13 // services contains minimal mappings between services names and port 13 // services contains minimal mappings between services names and port
14 // numbers for platforms that don't have a complete list of port numbers 14 // numbers for platforms that don't have a complete list of port numbers
15 // (some Solaris distros). 15 // (some Solaris distros).
16 var services = map[string]map[string]int{ 16 var services = map[string]map[string]int{
17 "tcp": {"http": 80}, 17 "tcp": {"http": 80},
18 } 18 }
19 var servicesError error 19 var servicesError error
20 var onceReadServices sync.Once 20 var onceReadServices sync.Once
21 21
22 // ServicesPath points to the file with port/service mapping.
23 var ServicesPath = "/etc/services"
24
22 func readServices() { 25 func readServices() {
23 var file *file 26 var file *file
24 » if file, servicesError = open("/etc/services"); servicesError != nil { 27 » if file, servicesError = open(ServicesPath); servicesError != nil {
25 return 28 return
26 } 29 }
27 for line, ok := file.readLine(); ok; line, ok = file.readLine() { 30 for line, ok := file.readLine(); ok; line, ok = file.readLine() {
28 // "http 80/tcp www www-http # World Wide Web HTTP" 31 // "http 80/tcp www www-http # World Wide Web HTTP"
29 if i := byteIndex(line, '#'); i >= 0 { 32 if i := byteIndex(line, '#'); i >= 0 {
30 line = line[0:i] 33 line = line[0:i]
31 } 34 }
32 f := getFields(line) 35 f := getFields(line)
33 if len(f) < 2 { 36 if len(f) < 2 {
34 continue 37 continue
(...skipping 29 matching lines...) Loading...
64 network = "udp" 67 network = "udp"
65 } 68 }
66 69
67 if m, ok := services[network]; ok { 70 if m, ok := services[network]; ok {
68 if port, ok = m[service]; ok { 71 if port, ok = m[service]; ok {
69 return 72 return
70 } 73 }
71 } 74 }
72 return 0, &AddrError{"unknown port", network + "/" + service} 75 return 0, &AddrError{"unknown port", network + "/" + service}
73 } 76 }
LEFTRIGHT
« src/net/lookup_unix.go ('k') | no next file » | ('i') | ('e') | ('c') | ('s')
Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /