paulgorman.org

< ^ txt

Thu Jan 18 09:40:11 EST 2018 Slept from ten-thirty to six-thirty without waking. High of twenty-nine today and partly sunny. Stopped at Starbucks on my way in to work. Work: - 10 AM manager meeting Done. - Ask Roger if Florida has remote access logs from the post-hurricane period Done. - Investigate Asterisk file locking Some. Twenty-minute walk at lunch. A slightly bitter wind, but otherwise pleasant. The ground is drier underfoot than yesterday. $ grep -r -e 'flock(' $ grep -r -e 'fcntl(' $ grep -r -e 'AST_LOCK_TYPE' Mainly `asterisk/main/app.c` and `asterisk/main/asterisk.c`. static enum AST_LOCK_RESULT ast_lock_path_lockfile(const char *path) static enum AST_LOCK_RESULT ast_lock_path_flock(const char *path) static int ast_unlock_path_flock(const char *path) enum AST_LOCK_RESULT ast_lock_path(const char *path) int ast_unlock_path(const char *path) Asterisk seems to have two mutually exclusive lock modes: "lockfile" and "flock"; this appears to be a configurable setting in `/etc/asterisk.conf`. We haven't set it, so it defaults to `lockfile`. Chapter 55 of _The Linux Programming Interface_ describes file locking. Asterisk `flock` mode uses the `flock` system call. Asterisk `lockfile` mode (the default we're using) used the ancient `open` plus `unlink` technique described in section 55.7 of _TLPI_. _TLPI_ paints this as worse in every way than `flock` except perhaps backwards compatibility, so I'm not sure why it's the Asterisk default. Home: - Make Nginx pass the Let's Encrypt acme verification location unencrypted Done. - Blog about OpenBSD httpd charset No, but I blogged about Asterisk file locks. - Grocery shopping Done. Winter oppresses me less when, every so often, a few days of thaw break up the stretches of frigidness and snow. Breakfast: cafe latte, sausage and egg sandwich Lunch: gyro, coffee Dinner: chips

< ^ txt