Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 83671 Details for
Bug 128284
Merging slowness (1-2 files per second) with newer ~x86 portage
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
saner fd closing example
patch (text/plain), 1017 bytes, created by
Brian Harring (RETIRED)
on 2006-04-01 19:14:56 UTC
(
hide
)
Description:
saner fd closing example
Filename:
MIME Type:
Creator:
Brian Harring (RETIRED)
Created:
2006-04-01 19:14:56 UTC
Size:
1017 bytes
patch
obsolete
>=== modified file 'pkgcore/spawn.py' >--- pkgcore/spawn.py >+++ pkgcore/spawn.py >@@ -8,13 +8,20 @@ > > from pkgcore.util.mappings import ProtectedDict > from pkgcore.const import BASH_BINARY, SANDBOX_BINARY, FAKED_PATH, LIBFAKEROOT_PATH >- > > try: > import resource > max_fd_limit = resource.getrlimit(resource.RLIMIT_NOFILE)[0] > except ImportError: > max_fd_limit = 256 >+ >+if os.path.isdir("/proc/%i/fd" % os.getpid()): >+ def get_open_fds(): >+ return map(int, os.listdir("/proc/%i/fd" % os.getpid())) >+else: >+ def get_open_fds(): >+ return xrange(max_fd_limit) >+ > > sandbox_capable = (os.path.isfile(SANDBOX_BINARY) and > os.access(SANDBOX_BINARY, os.X_OK)) >@@ -163,6 +170,7 @@ > fd_pipes[1] = pw > fd_pipes[2] = pw > >+ > pid = os.fork() > > if not pid: >@@ -246,7 +254,7 @@ > os.dup2(my_fds[fd], fd) > # Then close _all_ fds that haven't been explictly > # requested to be kept open. >- for fd in range(max_fd_limit): >+ for fd in get_open_fds(): > if fd not in my_fds: > try: > os.close(fd) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 128284
: 83671