@PcodeUserop
	@EmuSyscall("open")
	public T unix_open(@OpState PcodeExecutorState<T> state, T pathnamePtr, T flags, T mode) {
		PcodeArithmetic<T> arithmetic = machine.getArithmetic();
		int iflags = (int) arithmetic.toLong(flags, Purpose.OTHER);
		int imode = (int) arithmetic.toLong(mode, Purpose.OTHER);
		long pathnameOff = arithmetic.toLong(pathnamePtr, Purpose.OTHER);
		AddressSpace space = machine.getLanguage().getAddressFactory().getDefaultAddressSpace();

		SettingsImpl settings = new SettingsImpl();
		MemBuffer buffer = state.getConcreteBuffer(space.getAddress(pathnameOff), Purpose.OTHER);
		StringDataInstance sdi =
			new StringDataInstance(StringDataType.dataType, settings, buffer, -1);
		sdi = new StringDataInstance(StringDataType.dataType, settings, buffer,
			sdi.getStringLength());
		// TODO: Can NPE here be mapped to a unix error
		String pathname = Objects.requireNonNull(sdi.getStringValue());
		EmuUnixFile<T> file = fs.open(pathname, convertFlags(iflags), user, imode);
		int ifd = claimFd(createHandle(file, iflags));
		return arithmetic.fromConst(ifd, intSize);
	}
The UNIX {@code open} system call

@param state to receive the thread's state
@param pathnamePtr the file's path (pointer to character string)
@param flags the flags
@param mode the mode
@return the file descriptor
Ghidra/Features/SystemEmulation/src/main/java/ghidra/pcode/emu/unix/AbstractEmuUnixSyscallUseropLibrary.java