Пример #1
0
def open(path, oflag=0, mode=0):
    if oflag != openfile.O_CREAT | openfile.O_EXCL and oflag != openfile.O_RDONLY and \
       oflag != openfile.O_RDWR and oflag != openfile.O_WRONLY:
        raise UnsupportedOFlagError('oflag value: ' + str(oflag))

    return syscall(path + ' ' + str(oflag) + ' ' + str(mode),
                   syscalls.FileSysCall.OPEN.value, int)
Пример #2
0
def rmdir(path):
    return syscall(path, syscalls.DirSysCall.DELETE.value, int)
Пример #3
0
def mkdir(path, mode):
    return syscall(path + ' ' + str(mode), syscalls.DirSysCall.CREATE.value, int)
Пример #4
0
def readdir(fd):
    return syscall(str(fd), syscalls.DirSysCall.READ.value, literal_eval)
Пример #5
0
def closedir(fd):
    return syscall(str(fd), syscalls.DirSysCall.CLOSE.value, int)
Пример #6
0
def opendir(path):
    return syscall(path, syscalls.DirSysCall.OPEN.value, int)
Пример #7
0
def seek(fd, offset):
    return syscall(
        str(fd) + ' ' + str(offset), syscalls.FileSysCall.SEEK.value, int)
Пример #8
0
def exit():
    return syscall('', syscalls.UserSysCall.EXIT.value, int)
Пример #9
0
def read(fd, nbytes):
    return syscall(
        str(fd) + ' ' + str(nbytes), syscalls.FileSysCall.READ.value,
        base64.b64decode)
Пример #10
0
def append(fd, buf, nbytes):
    return syscall(
        str(fd) + ' ' + buf.decode(encoding='ASCII') + ' ' + str(nbytes),
        syscalls.FileSysCall.APPEND.value, int)
Пример #11
0
def unlink(path):
    return syscall(path, syscalls.FileSysCall.DELETE.value, int)
Пример #12
0
def close(fd):
    return syscall(str(fd), syscalls.FileSysCall.CLOSE.value, int)
Пример #13
0
def creat(path, mode):
    return syscall(path + ' ' + str(mode), syscalls.FileSysCall.CREATE.value,
                   int)
Пример #14
0
def stat(path):
    return syscall(path, syscalls.FileSysCall.GET_ATTRIBUTES.value,
                   literal_eval)
Пример #15
0
def write(fd, buf, nbytes):
    return syscall(
        (str(fd) + ' ' + base64.b64encode(buf).decode(encoding='ASCII') + ' ' +
         str(nbytes)), syscalls.FileSysCall.WRITE.value, int)
Пример #16
0
def chmod(path, mode):
    return syscall(path + ' ' + str(mode),
                   syscalls.FileSysCall.SET_ATTRIBUTES.value, int)
Пример #17
0
def login(user, passwd):
    return syscall(user + ' ' + passwd, syscalls.UserSysCall.AUTH.value, int)