Uncategorized

You are currently browsing the archive for the Uncategorized category.

For nearly 9 years this site has been hosted at pair.com, and I have had no problems there. Any time I have contacted pair support, I have had excellent response, they host everything on FreeBSD, and have, in the past, made monetary contributions to the FreeBSD project. They seem to be very professional, and uptime has been fantastic.

I have become more and more unhappy with their pricing though. I have been using pairs Advanced account, which provides 1.5GB of disk space and 80GB/month bandwidth, and paying $20/month for it. A few years ago pair introduced a pairlite service which would have suited my needs better, but I had already been a customer for years, and moving was harder than doing nothing, so I did nothing :)

I kept an eye on webhost pricing though, and finally my stinginess exceeded my laziness, and I decided to move. I looked at dreamhost, tried a trial, liked it, but wanted more control, so I began to look for a VPS. Eventually I stumbled on Prgmr.com. I don’t care if uptime is a little lower than it has been, it’s only a blog, a collection of random crap, and email. Prgmr is cheap, dirt cheap. For my same $20, I get a VPS with 22GB of disk space, 1024MB of memory, and 160GB/month bandwidth. Of course, it is no longer managed hosting, it is entirely DIY hosting. And that’s just fine :)

Not everything is moved to prgmr yet, web site is moved, so is DNS, email not yet. Will move that in a few days, and then finally cancel my account with pair.

Alignment

Due to some recent bus errors, I have been thinking a bit about alignment lately.

When the compiler lays out a struct it will generally ensure that the members of the struct are aligned on the required boundaries for the target architecture. For example, given:

struct foo {
int32_t a;
int16_t b;
};

A compiler may lay it out something like this:

0x??????04 a
0x??????05
0x??????06
0x??????07
0x??????08 b
0x??????09
0x??????0A pad
0x??????0B

The entire struct will likely be placed at an address aligned on a 4 byte boundary because the largest struct member is 4 bytes long, and the int16 type will be followed by a 2 byte pad. Why? So that an array of structs will have the ‘a’ member for all array elements aligned on a 4 byte boundary. All is good, right?

If we add a char to the struct:

struct foo {
int32_t a;
char c;
int16_t b;
};

0x??????04 a
0x??????05
0x??????06
0x??????07
0x??????08 c
0x??????09 pad
0x??????0A b
0x??????0B

Changing our char type to a 64 bit type may result in something like this:

struct foo {
int32_t a;
int64_t c;
int16_t b;
};

0x??????00 a
0x??????01
0x??????02
0x??????03
0x??????04 pad
0x??????05
0x??????06
0x??????07
0x??????08 c
0x??????09
0x??????0A
0x??????0B
0x??????0C
0x??????0D
0x??????0E
0x??????0F
0x??????10 b
0x??????11
0x??????12 pad
0x??????13
0x??????14
0x??????15
0x??????16
0x??????17

In this case (for this imaginary compiler) the entire struct is aligned on an 8 byte boundary, with the 8 byte member also aligned on an 8 byte boundary. So we can still create an array of struct foo, and things will be properly aligned. Of course, even though the individual members of the structure are 4, 8 and 2 bytes long, the entire structure with padding is 24 bytes long, so 10 bytes are “wasted”, it is best to design structs with this in mind, so that my imaginary compiler does not waste space. In the above case, changing the order of the elements is helpful:

struct foo {
int32_t a;
int16_t b;
int64_t c;
};

0x??????00 a
0x??????01
0x??????02
0x??????03
0x??????04 b
0x??????05
0x??????06 pad
0x??????07
0x??????08 c
0x??????09
0x??????0A
0x??????0B
0x??????0C
0x??????0D
0x??????0E
0x??????0F

Now, on some systems a program will run faster if types are aligned “properly”, on others a bus error will occur for misaligned access. Misaligned access will often occur in cases like this:
char array[1024];
...
struct foo * bar = (struct foo *)array;
bar->c = 1;

In the above case, although the array certainly is large enough to hold a foo structure, there is no guarantee that a char will be aligned on an 8 byte boundary, it is a 1 byte type, so there is no need for the compiler to align it. Because of this bar->c = 1; could cause a bus error. OtherĀ  bus errors can occur casting structs of the same size, but with different alignment requirements, etc.

At least firefox works for us on HP-UX now :)

Shantonu noted that for gcc, using -Wcast-align will at least warn about this issue.

Well, at the end of a week in Disney we got tired of hearing “Have a magical day”, had very sore feet and legs, and were sunburned. We did have fun though, despite the heat and all the happy helpful people that we encountered.

When we lived in Japan we went to Tokyo Disney once, and to Universal Studios Japan several times. At Tokyo Disney, even though we went in the off-season on a school day, the wait times for most rides were over 60 minutes. At Universal Studios Japan (unless you purchase their “Express Pass Booklet” which allows you to go into a faster queue) we have seen wait times of 180 minutes for popular rides. We also went to Disney Paris a couple of times in January, snow and freezing rain tend to keep the visitor numbers down, so we did not have to wait at all for most rides. My expectations for Florida’s Disney world were wait times similar to Japan. I was very pleasantly surprised. The longest wait times we saw were 60 minutes, and for those rides that did have longer wait times, we got the “Fast Pass” and went back to them. Jessica at a slide in

The flights were fine and we were able to get to the “All Star Music Resort” on the Disney coach fairly easily. Little did we realize that escape from Disney would be impossible for the next 7 days. This had us paying $14 for a six-pack of beer, and $2 for a bottle of water for the week. The $10 a day extra for a fridge in the room and $9.95 a day for internet access also made me feel that we were being gouged.

The food was better than I had expected. I had thought that we would be eating burgers and fries for a week, but there were delicious alternatives – the kids meals all came with a choice of 2 sides, Jessica usually chose carrot sticks to go along with her fries, and there were delicious salads available too.

Jessica loved the rides, especially the scarier, faster ones. Space Mountain 5 times, Thunder Mountain 4 times, Splash Mountain 3 times, Everest adventure 3 times, Tower of Terror 4 times, Fast Track twice and Mission: Space. Unfortunately she did not quite make the 48 inch height requirement for some of the water slides at Typhoon Lagoon.

I am glad to be back at work – now I do not have to walk miles every day in 90+ F temperatures :-) Hopefully we can avoid theme parks for a couple of years.

My niece asked for an update. This is an update.

Really though, some things have happened, I got work building pacakges
for The Written Word on a part
time basis. It’s fairly interesting.

My daughter is growing up, see some pictures at pic.pogma.com(slow!)

Oh, yeah, almost 2 years without smoking, not too bad. Now if only I
could stop gaining weight. :(

Well, that’s it for another year!

Wow! I surprised myself. I didn’t really believe that I could give up smoking for more than a day or two,
having been a smoker most of my life. I smoked for 22 years, which I figure means I had about 200,000 cigarettes,
spent nearly U.S. $20,000 and shortened my life.

We’ll see if I can continue, I still spend a large amount of time thinking about smoking, but am able to concentrate
for more than 5 minutes at a time again (I couldn’t for a while, just kept thinking about how much I wanted to smoke).

So I was always annoyed by the way dlcompat
used to just leak. Then one day a couple of months ago, I said to myself “Hey, just add a call to atexit(3) and put in some cleanup code”.
I figured that it would be safe to deallocate everything then, after all we are in exit(), nothing could possibly call dlopen/dlclose/dlerror/dlsym from there right?

WRONG!

I discovered today that it is indeed possible to call dl functions after exit() has been called.
C++ static destructors can be called after I do my cleaning in dlcompat_cleanup. So, exit calls dlcompat_cleanup which deallocates all it’s malloc’d blocks and the pthread locks etc. exit then proceeds to call
the c++ static destructors which call dlclose, at which point dlcompat barfs all kinds of ugly stuff before it dies rather vocally.

So now I guss I have to go patch dlcompat to leak again. Sometimes it is better to leak
than have something squat on your head and do a big poop.

Well it has taken a little while, but I finally have a working Mac OS X 10.2 install again.
Time to get fink up to date and update my packages this week, then with a bit of luck
I will be able to help out drm and jfm with the gcc-3.3 fink updates.

« Older entries