Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embed extra files, .so/.dll? #13

Open
droundy opened this issue May 22, 2016 · 5 comments
Open

embed extra files, .so/.dll? #13

droundy opened this issue May 22, 2016 · 5 comments

Comments

@droundy
Copy link

droundy commented May 22, 2016

Would it be possible to embed the extra files into fsatrace itself?

It would seem lovely to be able to enable at least the possibility of static linking (when there is, e.g. a C API). Not needed, but it does seem like it could enhance the user experience.

@jacereda
Copy link
Owner

The injection is based on LD_PRELOAD/DYLD_INSERT_LIBRARIES, the injected code must reside as a separate file AFAIK.

@droundy
Copy link
Author

droundy commented May 22, 2016

Yes, but could the file be generated dynamically? On the other hand, perhaps it would be disingenuous to support static linking of a tool that doesn't work with statically linked tools...

@jacereda
Copy link
Owner

We can always cat both files and generate the DLL in a temporary directory. Would require checking the executable and DLL timestamps to decide if the DLL must be overwritten. Doing it properly would be tricky, some other process might be trying to write the DLL at the same time.

@droundy
Copy link
Author

droundy commented May 22, 2016

Yes, it's definitely doable. I might be tempted to put it in ~/.cache/fsatrace/, so it would seldom need to be replaced, and you avoid the dangers of working with /tmp/. One option if you have a fsatrace version (possibly git-derived) would be to use that in the filename to ensure synchronicity. Simultaneous writing is typically handled on posix systems pretty easily by writing to another name and then using rename. I don't know how to deal very well with Windows semantics, but am sure it's just a question of reading up on file writing on Windows.

@ndmitchell
Copy link
Contributor

Doing it on Windows is possible, but a bit of a pain. However, if the file changes names with each git revision, and has a known size, that might be enough to make the extraction predictable. Having a single "lump" to pass around would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants