def makedev(self, type, major, minor):
"""Make a special file with specified type, and major/minor nums"""
if type == 'c':
datatype = 'chr'
mode = stat.S_IFCHR | 0600
elif type == 'b':
datatype = 'blk'
mode = stat.S_IFBLK | 0600
else: raise RPathException
try: self.conn.os.mknod(self.path, mode, self.conn.os.makedev(major, minor))
except (OSError, AttributeError), e:
if isinstance(e, AttributeError) or e.errno == errno.EPERM:
# AttributeError will be raised by Python 2.2, which
# doesn't have os.mknod
log.Log("unable to mknod %s -- using touch instead" % self.path, 4)
self.touch()
self.setdata()
评论列表
文章目录