154: def read_mounts
155: mounts = ""
156: begin
157: if File.instance_methods.include? "read_nonblock"
158:
159:
160: mountfh = File.open("/proc/mounts")
161: mounts += mountfh.read_nonblock(1024) while true
162: else
163:
164: mountfh = IO.popen("/bin/cat /proc/mounts")
165: mounts = mountfh.read
166: end
167: rescue EOFError
168:
169: rescue
170: return nil
171: ensure
172: mountfh.close
173: end
174:
175: mntpoint = {}
176:
177:
178:
179:
180: mounts.collect do |line|
181: params = line.split(' ')
182: next if params[2] == 'rootfs'
183: mntpoint[params[1]] = params[2]
184: end
185: return mntpoint
186: end