I have application that write some date in linux shared memory (/dev/shm/datahere). I need to show this data in browser with using google native client. it is real? How I can do this?
I had to dig pretty on the Internet, but I found a solution: Just out of the browser can not access because of the sandbox, but there is a Chrome Apps, which with the help NaCl can access the file system.
To build Chrome Apps included with NaCl and access to the file system, do the following:
Download nacl_sdk. Update it, to get examples (pepperX)
In a file nacl_sdk/pepper_46/tools/common.mk
find a line SANDBOX_ARGS: = --no-sandbox and change to:
SANDBOX_ARGS: = --no-sandbox --allow-no-sandbox-job --nacl-dangerous-no-sandbox-nonsfinacl
CHROME_ENV ?=, to:
CHROME_ENV=NACL_DANGEROUS_ENABLE_FILE_ACCESS=1
2.1 If you use run_package, then you need write in a file common.mk:
run_package: check_for_chrome all @echo "$(TOOLCHAIN) $(CONFIG)" > $(CURDIR)/run_package_config Exec=env NACL_DANGEROUS_ENABLE_FILE_ACCESS=1 "$(CHROME_PATH)" --load-and-launch-app=$(CURDIR) $(CHROME_ARGS)
LIBS = ppapi_cpp ppapi pthread nacl_io DEPS = nacl_io CFLAGS = -Wall SOURCES = <filename> .cc # Build rules generated by macros from common.mk: $ (foreach dep, $ (DEPS), $ (eval $ (call DEPEND_RULE, $ (dep)))) $ (foreach src, $ (SOURCES), $ (eval $ (call COMPILE_RULE, $ (src), $ (CFLAGS)))) # The PNaCl workflow uses both an unstripped and finalized / stripped binary.
int file; file = open("/var/run/shm/helloworld.txt", O_RDONLY); char buffer[1024]; memset(&buffer, 0, 1024); read(file, buffer, 13); pp::Var var_reply(buffer); PostMessage(var_reply);
P.S. Maybe it is not a good solution, but it work for me