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