LEFT | RIGHT |
(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 // Windows system calls. | 5 // Windows system calls. |
6 | 6 |
7 package syscall | 7 package syscall |
8 | 8 |
9 import ( | 9 import ( |
10 "unicode/utf16" | 10 "unicode/utf16" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 func Read(fd Handle, p []byte) (n int, err error) { | 260 func Read(fd Handle, p []byte) (n int, err error) { |
261 var done uint32 | 261 var done uint32 |
262 e := ReadFile(fd, p, &done, nil) | 262 e := ReadFile(fd, p, &done, nil) |
263 if e != nil { | 263 if e != nil { |
264 if e == ERROR_BROKEN_PIPE { | 264 if e == ERROR_BROKEN_PIPE { |
265 // NOTE(brainman): work around ERROR_BROKEN_PIPE is retu
rned on reading EOF from stdin | 265 // NOTE(brainman): work around ERROR_BROKEN_PIPE is retu
rned on reading EOF from stdin |
266 return 0, nil | 266 return 0, nil |
267 } | 267 } |
268 return 0, e | 268 return 0, e |
269 } | 269 } |
| 270 if raceenabled { |
| 271 raceAcquire(unsafe.Pointer(&ioSync)) |
| 272 } |
270 return int(done), nil | 273 return int(done), nil |
271 } | 274 } |
272 | 275 |
273 func Write(fd Handle, p []byte) (n int, err error) { | 276 func Write(fd Handle, p []byte) (n int, err error) { |
| 277 if raceenabled { |
| 278 raceReleaseMerge(unsafe.Pointer(&ioSync)) |
| 279 } |
274 var done uint32 | 280 var done uint32 |
275 e := WriteFile(fd, p, &done, nil) | 281 e := WriteFile(fd, p, &done, nil) |
276 if e != nil { | 282 if e != nil { |
277 return 0, e | 283 return 0, e |
278 } | 284 } |
279 return int(done), nil | 285 return int(done), nil |
280 } | 286 } |
| 287 |
| 288 var ioSync int64 |
281 | 289 |
282 func Seek(fd Handle, offset int64, whence int) (newoffset int64, err error) { | 290 func Seek(fd Handle, offset int64, whence int) (newoffset int64, err error) { |
283 var w uint32 | 291 var w uint32 |
284 switch whence { | 292 switch whence { |
285 case 0: | 293 case 0: |
286 w = FILE_BEGIN | 294 w = FILE_BEGIN |
287 case 1: | 295 case 1: |
288 w = FILE_CURRENT | 296 w = FILE_CURRENT |
289 case 2: | 297 case 2: |
290 w = FILE_END | 298 w = FILE_END |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 | 795 |
788 func (s Signal) String() string { | 796 func (s Signal) String() string { |
789 if 0 <= s && int(s) < len(signals) { | 797 if 0 <= s && int(s) < len(signals) { |
790 str := signals[s] | 798 str := signals[s] |
791 if str != "" { | 799 if str != "" { |
792 return str | 800 return str |
793 } | 801 } |
794 } | 802 } |
795 return "signal " + itoa(int(s)) | 803 return "signal " + itoa(int(s)) |
796 } | 804 } |
LEFT | RIGHT |