AddFile adds a file.
(name string, file *os.File)
| 380 | |
| 381 | // AddFile adds a file. |
| 382 | func (f *Fds) AddFile(name string, file *os.File) error { |
| 383 | key := fileName{fdKind, name} |
| 384 | |
| 385 | dup, err := dupConn(file, key) |
| 386 | if err != nil { |
| 387 | return err |
| 388 | } |
| 389 | |
| 390 | f.mu.Lock() |
| 391 | defer f.mu.Unlock() |
| 392 | |
| 393 | delete(f.inherited, key) |
| 394 | f.used[key] = dup |
| 395 | return nil |
| 396 | } |
| 397 | |
| 398 | func (f *Fds) copy() map[fileName]*file { |
| 399 | f.mu.Lock() |