unbit/uwsgi — pull request #332 by alb-i986 (2013-07-03 23:19:21+00:00)
Title: Emperor - extending the imperial monitor (dir and glob) .. 

.. to recognize a 'touch --no-dereference $INI_FILE' (changing the mtime of the symlink) which is supposed to reload only one vassal instead of reloading all of the vassals defined by a symlink pointing to the same physical file.

Two main points:

1) checking for instances that need to be reloaded
I just extended the test that checks whether mtime has changed, making it check also the mtime of the symbolic link (having saved it previously).
Wisely placed the new test as the *right* OR operand as it should not be used often (until known and appreciated, perhaps :) )

``` C
if (st.st_mtime > ui_current->last_mod || lst.st_mtime > ui_current->last_mod) {
time_t new_mtime = lst.st_mtime >= st.st_mtime ? lst.st_mtime : st.st_mtime;
emperor_respawn(ui_current, new_mtime);
}
```

2) checking for instances to be removed
Restored the code before the introduction of the option 'emperor-nofollow'.
The idea is that it's not relevant in the case of whether the file is a symlink or not:
- if it is a symlink and it has been removed, then both stat and lstat will return an error => stat is OK
- if it is a symlink and it has NOT been removed, then the decision for removing the instance depends on the physical file => stat wins
- if it is not a symlink, stat and lstat will give the same result => stat is OK

``` C
if (stat(filename, &st)) {
emperor_stop(c_ui);
}
```