POSIX File Handling and Undefined Behaviour

Whilst porting code between Linux and macOS I have come across two issues which make assumptions about how something works but in reality different implementations of libc handle them differently. In this post I’ll talk about recent issues I faced with fopen() and fclose() in codebases.

Continue reading POSIX File Handling and Undefined Behaviour

Nested Variadic Functions in C

You may be familiar with variadic functions in C, these are basically functions that allow a variable number of parameters, they are normally written like this:

void my_print_func(const char *format, ...)
    va_list args;
    va_start(args, format);
    vprintf(format, args);

Obviously you can do more with them and they are very useful, but if you want to have one function calling another things can get complicated. This post explores the problem and a couple of ways of solving it.

Continue reading Nested Variadic Functions in C

Unicode 7 in CentOS 7 TUI Code

I’m in the middle of developing a project in C which uses NCurses and Unicode 7+ characters. This has been working out great in macOS and Fedora 31 where I have been doing most of my testing. But in CentOS I have been having big problems getting the characters to render. This post goes into why and how to fix it.

Continue reading Unicode 7 in CentOS 7 TUI Code

Fixing an OpenSSL issue with Curl and Autotools

One project I created at MariaDB is libMariaS3 [source, documentation]. It is a lightweight simple LGPL licensed API to access Amazon S3 and compatible object storage implementations. We created it so that GPL v2.0 licensed projects could use S3 without the license incompatibility of Amazon’s Apache 2.0 licensed SDK.

MariaDB itself uses this for the new S3 storage engine coming in 10.5 and several other upcoming projects. I designed it to be easy to use for anyone outside of MariaDB just in case some other project would find it useful.

Continue reading Fixing an OpenSSL issue with Curl and Autotools

Episode 2: Introduction to Open Source and Licensing

Open Source Software is key to many of innovations in technology over the last few decades. It is also a fundamental requirement to build communities around software development. In this episode I give a brief introduction and an overview of Open Source and the licenses behind it.

Please excuse the hay fever induced muffle of my voice during this recording 🙂

Links referred to in the podcast:

Intro music for this Podcast is “Sunshine version 2” by Kevin MacLeod

My Open Source projects that still live on

I have recently created a new library called libMariaS3 for a couple of teams at MariaDB which provides a simple C API to Amazon’s S3. This was created because we needed a library which could link to GPLv2 software and Amazon’s own library is Apache 2.0 licensed which is incompatible.

It is not a perfect code base because I had a very short amount of time to get the first release out but it was a very fun project to work on. It led me to take a quick look this morning at a couple of other things I have created in the past to see where they are at today.

Continue reading My Open Source projects that still live on

Solving my Intel GPU performance issues

For the last few days I had my laptop connected to an external monitor which has a 2560×1600 resolution. Whilst having a few websites open and doing a video chat the laptop completely ground to a halt with the fan going full speed.

My laptop is a Lenovo ThinkPad X260 with an i7 CPU and 16GB RAM, so not really a lightweight which was why this was so unexpected. After trying some random things I have solved this. So I thought I would detail it here if only so I remember in the future.

Continue reading Solving my Intel GPU performance issues