Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
GNU is Not Unix

Journal Journal: Stable API Nonsense 2

Recently there was a discussion about how Linux cell phones are basically DOA, and within that discussion was a thread on a stable driver interface in Linux. Rather than respond to every comment as to why this is a bad idea, I figured I would just post the original response to this request for a stable driver API which was put together the first time people noticed it was hard to ship binary drivers for Linux:

Let me just point out that this approach *works* and *has worked* quite well for quite sometime. These days, when I buy a new piece of hardware, I throw out the driver CD without even looking at it. I plug in the hardware to my Linux box fully expecting it to work; if it doesn't, I figure it's broken. Occasionally, it's not broken hardware but rather I have made a mistake and invested in a piece of hardware from a company that has not seen the light and open sourced their drivers. I make a point never to buy from that company again, and I get a refund for the hardware. I might point out that this is a very rare occurrence. Most of the time there is support for hardware out of the box under Linux - no driver CDs, no install and no reboot required - just plug and go.

Implementing a stable API for drivers would lead to bloat, insecurity and instability; we've seen it happen in Windows, and even starting to happen with binary drivers under Linux! The technical argument is that Linus (and his kernel devs) reserve the right to rip out or reimplement anything they please in the kernel, with no regard whatsoever to backwards compatibility. This model has worked very well so far, as evidenced by the fact that you can plug in 99% of hardware into a Linux box and have it just work, no driver CD, download or install required.

Still, some people argue this is a political issue, not a technical one. I would agree, on one point: the hardware vendors are the ones making this a political issue. By refusing to release their source code, they limit how well their device can be supported. For what purpose do they need to keep their drivers closed? They sell hardware, not software, therefore they don't even have an economical reason. The arguments for releasing source are legion: support in ALL distros on ALL architectures by default; more stable and better tuned drivers; no need to ship driver CDs; no worry about having to support your drivers as they are now in the kernel, etc. I can think of no reason other than petty greed to keep drivers closed. And it's greed that doesn't even function properly at that, as it doesn't gain the greedy companies anything.

Is there any *technical* reason to keep drivers closed source? Please elucidate, and remember that even if there is, it must somehow outweigh all the benefits of having the same driver as an open source driver in the kernel in order to argue that there should be a stable driver API. This isn't an ideological, or even political issue; open source drivers have been shown *in practice* to work better, and provide all of the benefits I've listed. Why should we throw out one model that works for one that has been shown to not work nearly as well?

Music

Journal Journal: Found something that I think sounds cool 6

*Sigh*, I'm still waiting on my 1TB HDDs for the file server, which I will use to replace the 250GB drive, which I can then put in the web and email server. For now, that means I still post journal/blog entries here, as I don't see the point of upgrading the software on the web/email server until I have the drive available for it. Anyway, my pointless rambling is all a preface for this:

http://www.archive.org/details/Snu-op025-Caravan

I found it while looking for recordings of sheet music we play in our Big Band (guess which song I was looking for :). I thought the song sounded pretty cool, so I'm sharing it with you. Hope you enjoy it!

GNU is Not Unix

Journal Journal: "Free Software doesn't have end users" 3

So, I was going through the links on BBSpot today, and I found what I can only describe as one of the most lucid, well-written articles on Free culture I've seen in a long time: Thank you for giving me the opportunity to explain this to you. It's so fan-fucking-tastically good that I'm severely tempted to make my new signature on slashdot a link to that article with the title "Free Software doesn't have end users".

Every time I see some whiny bastard say "but Linux will never take over the desktop! you have to pay attention to MEEEE -*- cough -*- I mean, you have to pay attention to the end users!" I just want to bitchslap the little schmuck. What have these so-called "end users" done for Linux? Fuck them! The end users of Linux and Free Software have always been the same people who created it: the developers. If you "just want it to work", and you can't even be arsed to file a bug report, fuck you. It works for us; you should be grateful we decided to share the source with you.

Ranting aside, this really cuts to the heart of why I use Free Software: even if it wasn't technologically superior (which it is, precisely because it is Free Software), I would still use it because it is the only software I can modify and use however I want without having to say the equivalent of "please sir, may I have another?" to some big corp. whose only concern is next quarter's earnings.

Free Software doesn't have end users; that's kind of the point. You can either participate and contribute a little something back or you can pay some company to tell you what you are not allowed to do. We welcome your input, but if all you can do is say "your software sucks! do what I say or I'll use someone else's software!" then all I can say is farewell and peace be to you.

User Journal

Journal Journal: Mod points 3

So after lurking on the site a while, I kicked off my Slashdot account with this post. Just over six years later, I get mod points for the first time today. What's up with that?

Slashback

Journal Journal: Getting messages to show at the top of the page 2

Messages used to show at the top of the page above the first article, in a format like: "You have 2 new messages and 1 old message". Now they show up in a box on the right which, even though I know it's there, just doesn't work for me. As a consequence, I'm constantly missing out on replies and others' journal entries. I noticed you can drag the box around, but only in that column. Anybody know how to get the message notification to show up like it used to?

Books

Journal Journal: John Taylor Gatto's "Underground History of Education" 5

So I've been reading The Underground History of American Education by John Taylor Gatto. I've found it very enlightening, and up until Chapter 14 I was pretty much agreeing with the author. Now, I'm not one who dismisses everything I disagree with out of hand; on the contrary, I try to seek out opinions different from mine and test them (and mine) against evidence to better understand the world. But when Gatto starts citing court rulings such as the "posting the ten commandments in school rooms is unconstitutional" as bad and anti-religious, I start to grow a bit skeptical.

As I had been reading TUHoAE I detected faint warning signs that Gatto might have a religious bias. Little things that warned me, such as his antipathy towards what he called "scientific teaching". I could excuse some of these as perhaps merely terminology differences; what Gatto meant by "scientific thinking" did not match up with what I meant by it.

But then the other shoe dropped: Gatto demonstrates his bias against science which contradicts his religion:

Instead of remaining merely a useful description of how things work, great synthesizing theories like Big Bang or Natural Selection purport to explain the origin of the universe or how life best progresses. Yet by their nature, these things are beyond proof or disproof. Few laymen understand that the synthesizing theories of Science are religious revelations in disguise.

How are the big bang theory and the theory of natural selection not useful descriptions of how things work? How could someone who is obviously so erudite and had researched previous chapters so well fall into the trap of baseless assertions and a basic misunderstanding of the way science works? Is he not aware that natural selection has been demonstrated many times?

Another quote that left me gaping:

We are hidden by more than a half-century from the shock and numbness this new doctrine of "separation of church and state" occasioned, a great bewilderment caused in part by the absence of any hint of such a separation doctrine in the Declaration, Constitution, or the Bill of Rights.

Did he seriously just ignore the first amendment? Is he completely oblivious to the treaty of Tripoli, which by the constitution is legally binding as law of the land, and it states "the Government of the United States of America is not, in any sense, founded on the Christian religion" and it was signed over two centuries ago?

Another question I had was why had no one noticed this? In all the reviews I read, no one had mentioned that Gatto turned into a raving young-earth creationist midway through his book. Had these people read the book all the way through? Where are all the people who should be calling him out on his kookiness? The chapter I'm currently reading is his least footnoted and therefore least supported by evidence one so far, although I notice that previous chapters had been slowly but steadily heading towards less references.

Gatto tries to sound unbiased and reasonable, but the way he phrases things makes it obvious he thinks that there can be no morality without religion. Through the court decisions he throws out as "anti-religious" the reader can also tell he is one of those christians who believes he is being persecuted because he isn't allowed to force his religion on others.

I will try to make myself finish the book, grating though Gatto's unfounded assertions may be. I do value the eye-opening, well-researched and well-documented information that was contained in the earlier part of the book. It had always seemed to me that there was something wrong with public school education in America; I'm grateful to have substantiating evidence to back that assertion up. But I think that Gatto has misdiagnosed the cause and blamed the wrong driving forces for the downfall of education in this country. While I will not deny that anything can be taken dogmatically, I don't believe that returning to one dogma (religion) in place of another (so called unscientific "scientism") is the answer. I believe the answer is to become more rational, less biased and more pragmatic towards how people learn.

What do you think?

Programming

Journal Journal: read() vs recv() vs recvfrom() for UDP sockets

This may be old news to network programming gurus out there, and those dealing with saner programming languages and libraries probably won't have to worry about it, but I figured I'd post it for all those newbs (like me) to hopefully save them some time.

In C, it turns out that read() and recv() don't work on unconnected sockets (at least UDP, in this, my little story). The man pages do say something along the lines of "recv() is normally used on connected sockets", but to me that seems a bit subtle. Sometimes, some of us need a good *WHACK* on the head with a cluestick, and I finally got one when I was perusing the netcat source code to see what they did that made read() work with UDP. Turns out you have to call recvfrom() at least once on a UDP socket before you can call read() or recv() on it and get it work "reliably". I say "reliably" because what took me so long on this was that I figured UDP meant UNRELIABLE datagram protocol, so that's why I wasn't getting all the data. Turns out sending data over loopback shouldn't drop any packets, even when you use UDP.

And just for reference: no, select() accept() and listen() don't seem to work on UDP sockets either. Bummer :(

User Journal

Journal Journal: Relationship Change

The Slashdot relationship system is a useful way of keeping track of people I personally find interesting. If you're reading this, you've probably come here because you're curious about why you've been placed on my friends list. Simply put: I happened to have found a post of your interesting or insightful. Perhaps you offered unique insight into something that I had not previously considered. Perhaps your posting history is funny enough to warrant making you stand out from the thousands of other posters. Nevertheless, if you're on my friends list, it doesn't necessarily mean that I agree with your statements--it just means that I found your contribution to the fray worthwhile enough to include you on a list that makes your posts easier for me to find. If you're on my friends list, you're also much more likely to receive moderation points (I almost always moderate up--I hate modding down simply because moderation points are so valuable). Is this fair? Well, maybe not, but I am a fairly lazy reader. If you stand out from the crowd, I'm going to reward you for it.

I do cull my friends list on a very infrequent basis. There isn't much order to it with the exception that this usually occurs when: a) your last comment was made over two years ago and b) you haven't already friended me in return. People who have me on their friends list as well are immune to the periodic culling. (Of course, if your posts suddenly become entirely inflammatory and your history takes a gross turn for the worst, you're likely to be removed!)

So, don't be alarmed! My intentions are mostly neutral, with the exception that you're a little more likely to receive a slight karma boost the next time you post, and I have mod points. It isn't a guarantee, of course, but it does make it much more likely.

Additionally, following in the footsteps of a friends journal some time back, I will friend you if you friend me. If you put me on the enemy list, I'll friend you. In fact, I might even change the relationship at random just to generate "relationship changed" notices--for fun.

EDIT: Aug. 2008 culling completed. Anyone whose last post was prior to Aug. 2006 and does not have me friended has been removed.

User Journal

Journal Journal: Subject: :) [smiley spam] 2

What's up with the smiley spam I've been seeing lately? Anyone else run into emails where the subject contains only a smiley :) and there's nothing in the body? The email server implements greylisting (go spamd!), so the messages are being retried by the delivering system. Anyone know what the scoop is?

User Journal

Journal Journal: Send your name to the moon 4

The Planetary Society is offering to send your name to the moon. Scheduled to launch between November and December of this year, the Lunar Reconnaissance Orbiter's objectives are to find safe landing sites, locate potential resources, characterize the radiation environment, and demonstrate new technology. It costs nothing, it's fun, and you'll receive a certificate showcasing your support of the mission. The deadline is July 25, 2008 for the submission of names. If you had signed up for "Send your name to Mars", your name is now on the surface of Mars aboard NASA's Phoenix mission which landed on May 25, 2008.

The Military

Journal Journal: Working for the Government 1

So, reading this, it got me to thinking (again): why do I work for the government?

First, a little background: I graduated with a BS in CS in 2000. I then went to work for a startup started by my most challenging professor (I figure I'd learn more working for him than going to graduate school). Half a year later, they lay me off (but toss me some contracting work) because they can't afford to pay me (dotcom bust and all that). Somewhat naively, I decide to try consulting. Seven months later, after burning through all my savings, I'm desperate for a job. I mention this to a college friend who had gone back to his home town to work for DoD, and he manages to get me a site visit. A month later (surprisingly fast for the Feds!), I'm working at a Navy base in the middle of the desert.

So here I am, seven years later, wondering "why do I still work for the government?". A lot has changed since then. I love the town. It's small, dry and hot year round (I grew up in very similar desert). Plenty of very tall and fun to climb/hike/camp in mountains are within a days drive. I play alto sax in the local big band (and occasionally orchestra). I just got sworn in to the local mountain rescue group. The one thing that sucks is the job, and even it's not that bad.

You know how everyone says government employees don't work? It's true, but not for reasons you think. Sure, there are many who are just plain lazy. But out here at a place where we are far from the bureaucracy, where the majority of employees are engineers and scientists who are passionate about their work, the real reasons work doesn't get done are also the major reasons people quit or just gripe about their jobs. Security, while necessary, is a significant speed bump on the road to productivity. Having to get hardware you need to test out of a safe that only one person (not you) has access to, only to find out that you need a computer (that's in another safe that you don't have access to), can be demoralizing.

Not being allowed to install software that you need to do your job is another frustrating thing. It seems that even though someone may be trustable with state secrets, and be an expert in their field, they aren't allowed to decide what the best tool for the job is.

There are numerous other reasons: waiting for months for parts, having to pay credit card bills out of pocket for travel expenses (because vouchers in the travel system are 3 months behind), being forced to "standardize" on one software platform at a place where by definition, standards may be in flux (we are a research center, after all), or the standards are not the best tool for the job and were only chosen for political reasons.

So why do I still work here? I have been tempted, quite often to quit. However, there is nowhere else in this town where I could get the same salary for the same job. It's too small a town. I don't want to move; I love the town. I could try consulting/contracting, but that's iffy. And despite all it's drawbacks, it's not really all that bad. I work with smart people, and the one good thing about bureaucracy is that it's slow, so I haven't been completely cut off yet in the self-administration arena (I have a development machine that I alone am root on; the network admins and I have an understanding: I never call for help or create a problem, and they keep my connection up). All those times when I can't get real work done because I'm waiting for something? I've been playing with different programming languages, toolkits, development tools, etc. Recently, I've been going through "The Pragmatic Programmer" and quite enjoying it. I have some qualms about helping a corrupt government design weapons, but I don't blame Smith and Wesson for gun deaths.

I would jump at an opportunity to get paid to work on open source software from home (telecommute), but I'm not moving. I'm married and my wife also works on base. She has complaints about her job as well, but we both like the town; relocation is out of the question unless we could both get comparable jobs somewhere else in a similar environment.

Now, if they try to make me into a manager who doesn't get to write any code, then I will be looking for a new job.

Programming

Journal Journal: Re-usable vs Re-editable 1

Given the recent controversy over Prof. Knuth's comments, I'm left pondering one (of many) questions: why can't code be both re-usable and re-editable? (no, I haven't read the article)

Are re-usable and re-editable code fundamentally opposed? Would it just take too much time (or genius) to make code both re-usable and re-editable? Or is Knuth just calling designing for re-usability a waste of time like unit tests?

To me, the re-usableness and re-editableness of code seem orthogonal. You can write code that is re-usable but completely un-editable (it's usually unreadable at that point). If you're writing code properly, it seems to me that re-editable is a given. Re-usable is more difficult to do, but it seems like a good idea, and a best practice that most programmers should try to get into the habit of (just like writing re-editable code).

Maybe I'm just missing something here, but I always aim to make my code re-editable and re-usable, and one doesn't seem to get in the way of the other, other than competing for my time. Thoughts?

User Journal

Journal Journal: Boycott China Olympic Games

1. I won't watch _any_ of the olympic games, nor its opening, nothing;
2. I will write to my sat TV operator (Sky) and I'll make them know about it;
3. I won't visit _any_ olympic games-related website;
4. I will make sure who advertises in Beijing'2008 and I won't buy any merchandise from them for the whole year, starting now.

My initial compiled list of 2008 sponsors/advertisers to boycott (specific to Beijing and non-chinese):

* Volkswagen
* Adidas
* Jonhson & Jonhson's (China?)
* UPS
* Heier
* Budweiser

Programming

Journal Journal: Heap Debugging in C 5

I learned some very interesting things today. First, valgrind kicks ass. Second, don't always believe what you read in man pages. Take this little snippet I'd been working on for the past 1.5 days:

uint16_t
checksum (packet)
    struct re_packet *packet;
{
  int i = 0;
  uint16_t checksum = 0, temporary = 0;
  unsigned int intermediate = 0;
  unsigned int *binary_blob = calloc (1, sizeof (struct re_header) + packet->header.size);
  if (binary_blob == NULL)
    return (-1);
 
/// Necessary because checksum doesn't include itself.
  temporary = packet->header.checksum;
  packet->header.checksum = 0;
 
  if (!memcpy (binary_blob, &packet->header, sizeof (struct re_header)))
    return (-1);
  if (!memcpy (binary_blob + sizeof (struct re_header),
          packet->data, packet->header.size))
    return (-1);
 
  for (i = 0; i < (packet->header.size + sizeof (struct re_header)) / 4 ;
      ++i)
    intermediate ^= binary_blob[i];
 
// Restore original checksum.
  packet->header.checksum = temporary;
 
  checksum = intermediate ^ (intermediate >> 16);
 
  SAFE_FREE (binary_blob);
 
  return (checksum);
}

Now, you see, the "binary_blob" has to be a pointer to an array of unsigned integers because that's what we're using for the checksum. So far so good, right? Except that the program using this little snippet has weird memory errors, and when I say weird, I mean segfaulting in calloc(). A sure sign of heap corruption. But where could it be coming from. Just as a check, I insert some code to print out how many iterations it goes through before it crashes; ends up being just one. Hmm, heap corruption usually takes longer than that.

As I watch the compile for the zillionth time, it occurs to me that wxWidgets is being linked because this project has a separate GUI; but this little piece of code doesn't need it. Perhaps wxWidgets is doing some weird initialization stuff that is really not necessary in a piece of C code. So I also quickly learn how to turn that off in automake, and recompile. Still the same error in the same place. Hmmm . . .

Go learn how to use valgrind with memory checking. It says that "binary_blob" is being written beyond it's end. Huh? It's exactly as big the writes *should* be. Double-check memcpy(3); nope, it clearly says the third argument "n" is the number of bytes.

After banging my head against this for another couple of hours, I finally get the crazy idea, "hey let's just try casting to see if that fixes it, even though it shouldn't make a difference." Et voila! It works:

uint16_t
checksum (packet)
    struct re_packet *packet;
{
  int i = 0;
  uint16_t checksum = 0, temporary = 0;
  unsigned int intermediate = 0;
  unsigned int *binary_blob = calloc (1, sizeof (struct re_header) + packet->header.size);
  if (binary_blob == NULL)
    return (-1);
 
/// Necessary because checksum doesn't include itself.
  temporary = packet->header.checksum;
  packet->header.checksum = 0;
 
  if (!memcpy ((void *) binary_blob, &packet->header,
    sizeof (struct re_header)))
    return (-1);
  if (!memcpy ((void *) binary_blob + sizeof (struct re_header),
          packet->data, packet->header.size))
    return (-1);
 
  for (i = 0; i < (packet->header.size + sizeof (struct re_header)) / 4 ;
      ++i)
    intermediate ^= binary_blob[i];
 
// Restore original checksum.
  packet->header.checksum = temporary;
 
  checksum = intermediate ^ (intermediate >> 16);
 
  SAFE_FREE (binary_blob);
 
  return (checksum);
}

Apparently, memcpy(3) does some hinky where it actually looks at the type of the dest you pass it and decides that, no, "n" doesn't actually mean bytes, it means the number of elements you want to write to in that array. At least that's my theory.

(Posting this here because I don't have my own blog and I'm too lazy to look up the C newsgroup on groups.google.com; excuse the incoherence; I'm really frazzled and just happy it works (for now)).

Slashdot Top Deals

The Tao is like a glob pattern: used but never used up. It is like the extern void: filled with infinite possibilities.

Working...