<feed xmlns='http://www.w3.org/2005/Atom'>
<title>change/src/utility, branch master</title>
<subtitle>Transparent fs change tracking based on function interposition</subtitle>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/change/'/>
<entry>
<title>Interpose `open` library function</title>
<updated>2016-02-20T21:30:11+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2016-02-20T21:30:11+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/change/commit/?id=b3ef0fc8daa41e433f1919a4933a1cc047f59341'/>
<id>b3ef0fc8daa41e433f1919a4933a1cc047f59341</id>
<content type='text'>
`open` is not as side effect free as I had imagined - i.e. if the flag `O_TRUNC` is passed it truncates the file contents alongside opening the file descriptor. In practice this is done by _emacs_ prior to writing the new file content and as such needs to be intercepted so we can start tracking the file before it is changed.

Interposing `open` required some changes to make the library work without including `fcntl.h`. This header not only defines some of the flags we require to check if a library call actually is able to change files but also defines the `open` library function.

While implementing this change I noticed that the function interpositions implemented in C++ actually need to be declared as `external "C"` so their names do not get wrangled during compilation. I suspect that this was previously implicitly done for e.g. `mmap` and `write` by the included C standard library headers. However this did not work for `open` which is why all function interpositions are now explicitly declared external.

End result: _emacs_ file changes are now tracked correctly.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`open` is not as side effect free as I had imagined - i.e. if the flag `O_TRUNC` is passed it truncates the file contents alongside opening the file descriptor. In practice this is done by _emacs_ prior to writing the new file content and as such needs to be intercepted so we can start tracking the file before it is changed.

Interposing `open` required some changes to make the library work without including `fcntl.h`. This header not only defines some of the flags we require to check if a library call actually is able to change files but also defines the `open` library function.

While implementing this change I noticed that the function interpositions implemented in C++ actually need to be declared as `external "C"` so their names do not get wrangled during compilation. I suspect that this was previously implicitly done for e.g. `mmap` and `write` by the included C standard library headers. However this did not work for `open` which is why all function interpositions are now explicitly declared external.

End result: _emacs_ file changes are now tracked correctly.
</pre>
</div>
</content>
</entry>
<entry>
<title>Rename some functions to match overall naming scheme</title>
<updated>2016-02-19T18:11:33+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2016-02-19T18:11:33+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/change/commit/?id=5021c97e31ef8bb7cf40471e3fa98b451097451b'/>
<id>5021c97e31ef8bb7cf40471e3fa98b451097451b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Move io utilities into separate compilation unit</title>
<updated>2016-02-17T21:06:36+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2016-02-17T21:06:36+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/change/commit/?id=50f2ef4ba33b540fa5a8e324996fa639500765f4'/>
<id>50f2ef4ba33b540fa5a8e324996fa639500765f4</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Reduce `ChangeTracker` public _interface_ to `track`</title>
<updated>2016-02-14T12:31:59+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2016-02-14T12:31:59+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/change/commit/?id=f8eecef184c8684a3ed27712ccf8f7f866d47c40'/>
<id>f8eecef184c8684a3ed27712ccf8f7f866d47c40</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Reimplement locking in `Logger::append`</title>
<updated>2016-02-13T15:30:08+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2016-02-13T15:30:08+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/change/commit/?id=0ba583aa35bccf268e30dd03a6d423df5f98b40e'/>
<id>0ba583aa35bccf268e30dd03a6d423df5f98b40e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace macro argument expansion with more idiomatic recursive template</title>
<updated>2016-02-10T20:38:10+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2016-02-10T20:38:10+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/change/commit/?id=801ddda073b04c9751bc9e4f935bd102d7741c7b'/>
<id>801ddda073b04c9751bc9e4f935bd102d7741c7b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Increase log message generation readability</title>
<updated>2016-02-07T21:18:10+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2016-02-07T21:18:10+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/change/commit/?id=77ca603e933af25088057dc5e26cfda84bde7147'/>
<id>77ca603e933af25088057dc5e26cfda84bde7147</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Introduce thread synchronization for tracking init and logging</title>
<updated>2015-12-27T09:07:24+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2015-12-27T09:07:24+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/change/commit/?id=0f083843bc31bf985991728125ef74efca6ef7b7'/>
<id>0f083843bc31bf985991728125ef74efca6ef7b7</id>
<content type='text'>
This obviously leads to synchronizing syscalls that would otherwise happen in parallel. Luckily the goal of this library is to monitor file changes performed by single, user facing applications and as such it doesn't matter if some operations are slightly slower.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This obviously leads to synchronizing syscalls that would otherwise happen in parallel. Luckily the goal of this library is to monitor file changes performed by single, user facing applications and as such it doesn't matter if some operations are slightly slower.
</pre>
</div>
</content>
</entry>
<entry>
<title>Explicitly set log file permissions</title>
<updated>2015-12-27T08:45:56+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2015-12-27T08:45:56+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/change/commit/?id=0f1b6aea1fc7a2753cfde98a74c1ab74e258576e'/>
<id>0f1b6aea1fc7a2753cfde98a74c1ab74e258576e</id>
<content type='text'>
This ensures that the log file is actually accessable - there was a problem where e.g. `change rm test` did not create the log file correctly.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This ensures that the log file is actually accessable - there was a problem where e.g. `change rm test` did not create the log file correctly.
</pre>
</div>
</content>
</entry>
<entry>
<title>Match namespace and directory structure</title>
<updated>2015-12-23T23:11:06+00:00</updated>
<author>
<name>Adrian Kummerlaender</name>
</author>
<published>2015-12-23T23:11:06+00:00</published>
<link rel='alternate' type='text/html' href='https://code.kummerlaender.eu/change/commit/?id=baf30b7b83822b7d6efd0c16761b8e42a1e96101'/>
<id>baf30b7b83822b7d6efd0c16761b8e42a1e96101</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
