Alex's Log /dev/random

Rakudo Perl 6 2012.01 uploaded to unstable

I’ve uploaded yesterday the rakudo package version 0.1~2012.01-1 to unstable. It ships the Rakudo upstream release from January, running on top of the Parrot stable release 4.0.0 (which was uploaded earlier).

Rakudo is a compiler that implements the Perl 6 specification and runs on top of the Parrot virtual machine (if you are interested on Perl 6 you may have a look at some nice articles, and at the talk of Damian Conway, about Perl 6).

This is the first upload since a few months, and the first release being uploaded to Debian based on the nom (New Object Model) development branch of Rakudo, which opened the door for substantial performance improvements. This release brings other nice things too, such as the support for meta-programming, better package and exception handling and more.

The latest upstream release 2012.04 (which brings, among other things, improvements in startup times thanks to bounded serialization) has been released a few days ago and uses the new Parrot stable release 4.3.0 (which has been released about a week ago), so we hope to test and upload both in time for the Wheezy freeze (and hopefully we’ll be a bit more timely for future updates too).

Although existing art media have been transformed in the digital age, the advent of computers has brought new art forms into being. In the past, visual arts and music required both intellectual and physical skills, but in the present, computer programming permits people to make art just by using their minds. Moleman 2 presents a subculture of digital artists working with both new and old computing technology who push their machines to their limits.

Event-driven server with ØMQ and libev

Some time ago I have written on how to implement a simple ØMQ-based multithreaded server. After that I’ve also written some code to build a simple event-based server with ØMQ and libev, but never actually published it on this blog (I kind of forgot about it). Sooo, here it is:

Compile with:

$ cc -o zmq-server-ev zmq-server-ev.c -lzmq -lev

You can use the Perl client described in the previous article to do some tests.

The code is so simple that shouldn’t require much explanation, only note that ZMQ_FD is edge-triggered, which means that we need to consume all the events from the socket when we receive an EV_READ (that’s what the while (1) loop is for in the watcher_routine). Also, since the ZMQ_FD is only a control socket (i.e. a Unix domain socket) we must only register for EV_READ events.

The code is, of course, also on GitHub.

Kernel module to disable ptrace()

I don’t really know why I ended writing this, but it all started as a way to do some Linux module coding.

Anyway, all this module does is overwriting the Linux syscall table, and replacing the ptrace() syscall with a custom one (which does nothing but printing a message).

Now, I’m quite sure there are better ways of doing this, so take the whole code just as a humble example of Linux module development.

The code as usual, is also on GitHub where you can also find a Makefile to compile the code.

Before compiling, you have to modify the sys_call_table_addr value, to point at your syscall table address:

$ grep sys_call_table /boot/System.map-`uname -r` 
ffffffff8143b1a0 R sys_call_table

Then, when built, load the module with:

# insmod noptrace.ko

And look at the output of dmesg:

$ dmesg | tail -1
[25374.003588] [noptrace] ptrace syscall disabled

Which means everything went as expected.

Simple Brainfuck interpreter

Yay, learning WTF is Ragel: let’s do something funny!!! The result is yet another Brainfuck interpreter (because we really needed another one!).

It is very simple, and somewhat limited (e.g. it does not support nested loops). But it works!

Here’s the code:

and also on GitHub. Compile with:

$ ragel bf.rl
$ cc -o bf bc.c

And test by feeding it some random BF code from the command-line.

x86 booting code

I have written a little snippet of code that magically boots on x86 hardware (not sure if it works on x86_64 as well). It’s a few lines of assembly code, just for fun.

It compiles with nasm(1):

$ nasm -o boot.bin boot.asm

It works pretty well under qemu(1), but I have not tried it on bare metal hardware yet. Not that it does anything fancy: it boots, prints a string and loops forever.

The code on GitHub includes a Makefile to make the iso image generation (using genisoimage(1)) and the vm start-up, easier.

With a simple make run it compiles the code, generates the iso and starts the virtual machine.

Enjoy :)

Make git ignore changes to files

Just another nice feature of git(1) that I always forget about when I need it (it just happened)… posting it here, in the hope that it’ll get stuck in my head.

$ git update-index --assume-unchanged some_file

This will make git to stop tracking the changes to the given file, even if it has already been added to the repository index.

To revert it:

$ git update-index --no-assume-unchanged some_file

And voilà, as if nothing ever happened.

Page 1 of 11