def _open_dev(name): fd = os.open(name, os.O_SYNC | os.O_RDWR) if fd < 0: raise IOError("Failed to open " + name) return fd