use Fcntl qw [:flock
:DEFAULT];
my $lock_file = "...";
sysopen my $fh => $lock_file, O_RDWR | O_CREAT
or die "sysopen: $!";
exit unless flock $fh => LOCK_EX | LOCK_NB;
... Code ...
END {! -f $lock_file || unlink $lock_file || warn "unlink: $!"}
It turned out to be incorrect. Can you spot the mistake?
It's my last hour at my current employment. My desk is almost empty - and what's on it has to stay here, unfortunally. Checked in the latest versions of the sources I've been working on - the last feature added was less than half an hour ago. Finished the documentation. Instructed the person taking over my project, making sure he can build the distribution as well. Saved the few files worth keeping on my laptop (well, the companies laptop, I'll have to return it later...). Cleared out all my accounts on the various machines. Removed most of the non-system files on my desktop - what needs to be done is scratching the disk.
One cup of tea to go. Then a few goodbyes, and off I go. Two weeks of vacation, and on Feb 1, I'll start a new gig.
Perhaps one or two smaller European workshops, specially if their dates are on a weekend. I very much liked the London Perl Workshop, and if there's one this year, I'll try to make it there.
Is there a web site that lists all planned conferences/workshops? That would be extremely convenient.
So I had about 42kb of free space on my 1680kb floppy disk when I got this feature request yesterday. Whether I could fit in a 'real' ps, instead of busybox's ps. Right. A real ps, with just 42 kb to spare.
In order to save space, all binaries (except for the kernel) on the distro have been compiled using uClibc, which is very nice gcc front end to produce really small, statically linked, binaries. As part of the make process of the distribution, any tool that isn't found on our (quite bare) RedHat servers is compiled as well. Including uClibc.
So, I set off to compile ps with uClibc. No go. It needs a compiler configured for wide chars. I configure uClibc so it can deal with wide chars. ps compiles, and seems to work! Now, will it all fit on the floppy disk? I no longer need ps in busybox, so I kick out the module and attempt to create a floppy disk. It's too big! Not a lot - I can fit the compressed initrd on the floppy disk, but not two additional, small files.
I notice that the other binaries are slightly larger than they used to be. Must be because they now have wide char support compiled in. Aha! What if I create two compilers - one with wide char support to compile 'ps', and the other without wide char support for the rest? A bit of Makefile hacking, and I end with a floppy disk with 1 or 2 kb to spare (the amount of kb to spare fluctuates from build to build - there's a compressed file system on the floppy and filesystems contain timestamps. And if they are just right, they compress better...).
That's going to be last feature added.
Time flies. I'm getting old.
In 2006, I'd like to do 600km at least.
First I finished 100 mannen (100 men) by Mart Smeets. Mart Smeets is a sports journalist, and he has covered the Tour de France for about 30 years now. In this book, he describes 100 cyclists who have participated in the Tour de France - a short article for each rider. It's full with stories, amusing ones, heroic ones, many with a personal touch. It brings up a lot of memories - since the 1970s, I've spend countless hours in front of the TV every July.
Second, Amerikanen zijn niet gek (Americans aren't crazy) by Charles Groenhuijsen. Groenhuijsen is a journalist working for the Dutch television, who has spend the last 16 years in the USA. In the book, he describes how Americans are, and how they differ from Europeans. Unlike many others, he doesn't do it to poke fun at Americans, or to reiterate myths. Instead, he describes how the American society came to be, and why it's unlikely to change. His conclusion: America is a hard society with good manners, Europe is a social society with bad manners. I'd say, a must read for every European who easily ciritizes or generalizes Americans.
The book I finished today (well, technically, yesterday) is Watching the English by Kate Fox. I picked up the book during my 10 minute shopping spree on Gatwick when returning home from the London Perl Workshop. Kate Fox is an anthropologist who tries to describe what "Englishness" is. She has spend countless hours observing people queueing, ordering drinks in pubs, commuting to work, etc. She looks how people behave in work situations, at home, how they spend their free time, how they handle sex, etc, and describes everything in reoccuring rules. Quite an interesting read, and maybe next time I visit England, I can understand people better. (Yeah, London.pm, with my new knowledge, I just have to look at your clothes, or the car you drive in to determine your class).
Currently reading: The World According to Clarkson, by Jeremy Clarkson.
A white Christmas after all.