Software updates by Troy D. Hanson


uthash final
November 18, 2014, 11:32 pm
Filed under: Software updates

uthash-mini.png

It’s time to unclutter, and for me that means calling the current version of uthash the “final” version. So, as of 2015 it’s going to be unmaintained. Going forward, I can’t answer any uthash questions or accept any bug reports, so please use the Google group for those. Thanks to all of you who have made it better over the years.



A quick sampler of initscripts
March 9, 2014, 10:41 pm
Filed under: Software updates

I’ve fixed some links on this blog post I made a while back. Going forward this sampler of initscripts is on Github. There’s a lot that could be written about initscripts, but this minimal example might be enough if you just need a quick ‘n dirty template.

Initscripts
a general term for the scripts that start and stop daemon (server) processes on Unix-style OS’s. Often used to start processes at boot.

initscripts

Initscripts vary by OS and distro. Here’s a quick sample of initscripts on four platforms:

  • Ubuntu
  • RedHat/CentOS
  • Debian
  • Mac OS X

These examples show how to run an imaginary daemon, exd, at boot.

Note

An easier way?

You might find my pmtr tool much easier to use than writing an initscript.

These initscripts expect the daemon to stay in the foreground.

Ubuntu

On Ubuntu, the init system is called upstart. It’s quite nice and easy to use.

  1. Place this script in /etc/init/exd.conf.
  2. It’s all ready to go. Start it up using start exd

RedHat/CentOS

This platform uses sysvinit-style scripts.

  1. Place this script in /etc/rc.d/init.d/exd.
  2. Run chkconfig --add exd to symlink it into the runlevel directories.
  3. Start it up using /etc/init.d/exd start.

Debian

  1. Place this script in /etc/init.d/exd
  2. Run /usr/sbin/update-rc.d exd defaults to symlink it into place.
  3. Start it: /usr/sbin/service exd start

Mac OS X

Mac uses “launchd” to start daemons.

  1. Place this file in /Library/LaunchDaemons/exd.plist
  2. Load and start it using, launchctl load /Library/LaunchDaemons/exd.plist


uthash 1.9.9 released
February 25, 2014, 11:43 pm
Filed under: Software updates

uthash-mini.png

uthash v1.9.9 has been released.

This release is basically a tag over the last year of patches. My goal at this point is stability with uthash, as I don’t have time to improve it much these days. There are too many fun Arduino projects waiting for me and my kids to tackle!


Version 1.9.9 (2014-02-25)

  • made HASH_ADD_STR compatible with char* or char[] (thanks, Samuel Thibault!)
  • fixed header inclusion of sys/types.h for ssize_t (thanks, Fernando Campos!)
  • added LL_COUNT/DL_COUNT/CDL_COUNT (thansk, Paul Praet!)
  • added LRU cache example in tests/lru_cache (thanks, Oliver Lorenz!)
  • fix LL_DELETE2 for VS2008 (thanks, Greg Davydouski!)
  • fix missing argument in HASH_REPLACE_STR (thanks, Alex!)
  • bump version number in source files to match docs (thanks, John Crow!)
  • add HASH_OVERHEAD macro to get overhead size for hash table

Please use the uthash Google Group to to ask questions, and the Github page for issues. Thanks again to everyone for continuing to improve things along the way.

@troydhanson



uthash 1.9.8 released
March 10, 2013, 1:59 am
Filed under: Software updates

uthash-mini.png

uthash v1.9.8 has been released.


What’s in version 1.9.8 (2013-03-10)

  • We now have a HASH_REPLACE macro (thanks, Nick Vatamaniuc!)
  • fixed clang warnings (thanks wynnw!)
  • fixed utarray_insert when inserting past array end (thanks Rob Willett!)
  • you can now find uthash on GitHub
  • there’s a uthash Google Group

On GitHub…
The official home of uthash is now the Github site. You can go there to clone it, grab a zipfile, or to contribute changes back as a pull request.

Google Group
The uthash Google Group is the new “go-to” place, to ask questions. Please ask them there first- and help me answer them there, if you can help!

Simplifying
Regarding versioned releases- it’s much easier to just merge changes, than to also bump version numbers and do announcements. Going forward I may only bump version numbers rarely and keep the master branch as a rolling current release.

I’ve also removed a few things– the PDF version of the documentation, and the tarball of the sources. Long live the tarball.

I’m bad at replying to people
An apology to people who have sent contributions and questions and didn’t hear back from me for weeks or months at a time: sorry! My life, and probably yours, is hectic. I hope the Google Group and the pull queue on Github help.

Twitter
You can follow me at @troydhanson for this kind of news too.

Thanks, again, to everyone who helps keep uthash going.



uthash 1.9.7 released
October 9, 2012, 3:01 am
Filed under: technotes

uthash-mini.png

uthash v1.9.7 has been released.

A lot of people have sent me patches for uthash, utlist and utstring that have been building up for a while now. So- without further ado, here’s uthash 1.9.7:


Version 1.9.7 (2012-10-09)

  • utstring now supports substring search using utstring_find (thanks, Joe Wei!)
  • utlist can now prepend and replace elements (thanks, Zolt├ín Lajos Kis!)
  • utlist prev/next fields can now have any names (thanks, Pawel S. Veselov!)
  • uthash quiets a clang warning (thanks, Roman Divacky and Baptiste Daroussin!)
  • uthash userguide example shows key uniqueness check (thanks, Richard Cook!)
  • uthash HASH_MUR compiles under MSVC++ 10 in C mode (thanks, Arun Kirthi Cherian!)
  • utstring now supports format checking in utstring_printf (thanks, Donald Carr!)

What is uthash?

If you’re new here, welcome. Uthash is a hash table for C structures. It’s implemented entirely as a single header file, uthash.h. In the same spirit, it includes a dynamic string implementation in utstring.h, a set of linked list tools in utlist.h and a dynamic array in utarray.h. They’re all in C, dependency-free, and open-source.

For docs and download links see the uthash website.



Running Minecraft & Mumble Servers under pmtr
September 4, 2012, 11:26 pm
Filed under: technotes

From the something-completely-different department:

What do you get when you mix a holiday weekend, with a cold and fever and a son who likes Minecraft? A lot of fun actually. As a dad and son activity, we set up a Minecraft server. To take it up a notch, we threw in a Mumble server for voice chat. It’s one thing to start them manually (or via GUI in the case of the Minecraft server). But I wanted to put them on a server without GUI access, and install them as services- so they’d restart if they die, or if the box reboots. There’s various ways to do this but I decided to run both servers under my pmtr process monitor.

Here’s my configuration from /etc/pmtr.conf:

job {
 name minecraft-server
 dir /home/mc/minecraft
 cmd /usr/bin/java -Xms32M -Xmx292M -jar minecraft_server.jar nogui
 user minecraft
}
job {
 name murmur-server
 dir /home/mc/murmur
 cmd /usr/bin/murmurd -fg -ini murmur.ini
 user minecraft
}

I grabbed the minecraft_server.jar, the Murmur binaries (the server for Mumble voice chat clients), a Linux box, put pmtr on it, and edited some config files. (Minecraft has server.properties, Murmur has murmur.ini, and pmtr has pmtr.conf). My son got to see under the hood of a Linux server, and then as the fruits of our labors we could enjoy some Minecraft with friends.

On a final note- I’m blown away with the artistry of Minecraft and the quality of Mumble. I even asked my son to turn his Minecraft guy so we could watch the Minecraft sunset- the gradients are just beautiful!, the falling snow or the rain. Mumble (which is free) makes our voice chats sound like we’re in recording studios. Great work by talented developers.



Minimal sysvinit, launchd and upstart
August 21, 2012, 7:47 am
Filed under: Software updates

Here’s a quick example of how to run a daemon process at boot on four platforms:

  • Ubuntu, using upstart
  • CentOS/RHEL, using sysvinit
  • Debian, using sysvinit
  • Mac OS X, using launchd

Typically your system services- web servers, etc, start up through these mechanisms. The idea across all these platforms is that you put a script or text file describing your service in the right place, and the OS init apparatus starts everything.

Caveat: I’m not a initscript expert by any means. There are many options that vary across these platforms. What I’ve written here is a quick glance.

For the examples here – imagine we have a daemon called exd that we want to run at boot. The settings used in the initscripts here expect exd to stay in init’s foreground (that is, it doesn’t daemonize by forking again).

An easier way?

You might find my pmtr tool much easier to use than writing an initscript.

Ubuntu

Ubuntu uses “upstart” to manage jobs (at least for the modern releases).

  1. Place this script in /etc/init/exd.conf.
  2. It’s all ready to go. Start it up: start exd

CentOS/RHEL

This platform uses sysvinit-style scripts.

  1. Place this script in /etc/rc.d/init.d/exd.
  2. Symlink it to the runlevel-specific directories: chkconfig --add exd
  3. Start up the job (on reboot it’ll be automatic): /etc/init.d/exd start

Debian

  1. Place this script in /etc/init.d/exd
  2. Symlink it into place: /usr/sbin/update-rc.d exd defaults
  3. Start it: /usr/sbin/service exd start

Mac OS X

Mac uses “launchd” to start daemons.

  1. Place this file in /Library/LaunchDaemons/exd.plist
  2. Load and start it: launchctl load /Library/LaunchDaemons/exd.plist

That’s it

That’s a minimalistic look at initscripts on four platforms.

Edited to add: Debian example and replace the inline files with links.




Follow

Get every new post delivered to your Inbox.