140: def read_mounts
141: mounts = ""
142: begin
143: if File.instance_methods.include? "read_nonblock"
144:
145:
146: mountfh = File.open("/proc/mounts")
147: mounts += mountfh.read_nonblock(1024) while true
148: else
149:
150: mountfh = IO.popen("/bin/cat /proc/mounts")
151: mounts = mountfh.read
152: end
153: rescue EOFError
154:
155: rescue
156: return nil
157: ensure
158: mountfh.close if mountfh
159: end
160:
161: mntpoint = {}
162:
163:
164:
165:
166: mounts.collect do |line|
167: params = line.split(' ')
168: next if params[2] == 'rootfs'
169: mntpoint[params[1]] = params[2]
170: end
171: mntpoint
172: end