def sys_getcwd(self, buf, size):
try:<EOL><INDENT>current_dir = os.getcwd()<EOL>length = len(current_dir) + <NUM_LIT:1><EOL>if size > <NUM_LIT:0> and size < length:<EOL><INDENT>logger.info("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>return -errno.ERANGE<EOL><DEDENT>if not self.current.memory.access_ok(slice(buf, buf + length), '<STR_LIT:w>'):<EOL><INDENT>logger.info("<STR_LIT>")<EOL>return -errno.EFAULT<EOL><DEDENT>self.current.write_string(buf, current_dir)<EOL>logger.debug(f"<STR_LIT>")<EOL>return length<EOL><DEDENT>except OSError as e:<EOL><INDENT>return -e.errno<EOL><DEDENT>
getcwd - Get the current working directory
:param int buf: Pointer to dest array
:param size: size in bytes of the array pointed to by the buf
:return: buf (Success), or 0