Rob's Blog rss feed old livejournal twitter

2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2002

January 18, 2018

I have a failure mode during software development, which is naming stuff strangely. I had to do a cleanup pass removing the "9 princes in amber" references (a book series by Roger Zelazny) because after enough repetitions of the variable "pattern" I threw a "logrus" in there in self-defense and it spiraled from there.

Now I'm cleaning up ps, which has -o fields living in "struct strawberry" with the variable length char array at the end of course called "forever". This doesn't help anyone understand the code.

I'm banging on gzip right now and resisting calling the --rsyncable option --titanic during development.

All this should have been cleaned up and properly explained long ago, I've just been so drained trying to keep SEI afloat. And now I'm packing to move to Wisconsin for half a year.

January 17, 2018

The reason "sudo echo 0 9999999 > /proc/sys/net/ipv4/ping_group_range" doesn't work is the shell opens the redirect file before calling sudo, which means it does so as your normal user. Alas putting quotes around the sudo arguments doesn't work because it doesn't re-parse the command line so tries to run a single command with spaces and a > character in it.

This is why I wind up doing sudo /bin/bash a lot.

January 16, 2018

Youtube cut off monetization of channels with less than 1000 subscribers. It's the hobbyist->employee->bureaucrat progression again. I should really give a proper _recorded_ version of that talk somewhere.

I gave it at Flourish. I was prepared, reasonably well rested, and gave a version I was proud of. They recorded it. The recording never went up. There is very little a conference an do to annoy me more than _promise_ to post a recording of a talk and then _not_ do it. Sadly common problem: Flourish screwed up the recordings both times I went there, LinuxCon Tokyo 2015 had a video camera that apparently wasn't on, Ohio LinuxFest pointed a video camera at me and then only posted audio....

Penguicon failing to record Neil Gaiman's "crazy hair" reading after which I got him to say "By Grabthar's Hammer, You Shall Be Avenged" into the microphone with NO TAPE IN THE MACHINE was the Science Fiction Oral History Society's fault, but it was at a conference I co-founded so that makes it my fault. I added a "new thing" to each year of Penguicon (year 4 was LN2 ice cream, we dumped the extra LN2 into the swimming pool sunday afternoon), and year 3 (I think?) I bought 5 MP3 lecture recorders with a promised 12 hour battery life and taped them down to the tables in each panel room. No idea what's happened to that since Matt Arnold drove away all the people who used to run it, I haven't been back in 10 years...

January 15, 2018

Ok, fixing ps -T. If I go "ps -AT" I get 13 hits for chrome (pid 1401 and 12 threads). But if I go "ps -T 1401" I get just one hit (pid 1401, no threads).

And done. The /proc layout repeats the thread under the pid, so /proc/123 will have all hte process information for the parent, and then there's a /proc/123/task/123 that _also_ has it. There's a check to notice that and skip it when we're parsing threads, which was supposed to copy the parent pid into the child's PID slot when it doesn't skip it.

I.E. if the parent->PID and my->TID were equal, return. Else my->PID = parent->PID; The else bit was missing.

January 12, 2018

Signed the contract for the new job. I need to be in Milwaukee by the 22nd.

My next choice is do I drive up or fly up? I have southwest credit from cancelling my return flight from ELC last year (work flew me from LA straight to Tokyo instead, yes those trips were always on that short notice), and if I don't use that it expires soon. But if I drive up I'd have the car with me and can drive to see Fade on weekends. (It's a little under 5 hours drive each way, reasonable to drive up friday after work and drive back sunday evening. Flying each way probably takes _longer_ if you add in getting to the airport, through security theatre, and then public transit through minneapolis.)

Decisions, decisions...

January 11, 2018

I tried -rc7 in mkroot. The arm build grew a perl dependency again. The x86-64 build died because it couldn't find an ORC unwinder. Wheee!

New battery arrived! It's 6 cell rather than 9 cell but hopefully that means it's less fragile. (I ordered 2 9 cell batteries and wound up breaking both, they stick out awkwardly as a sort of footrest leaving the keyboard at an angle and only letting the screen fully open if everything aligns exactly. The 6 cell ones I've never broken (just worn out) and I can almost lay the screen flat back.)

Downloading email is _so_ much faster now I've cleaned out LKML. I'm still shoveling out qemu-devel, and then buildroot's got over 100k messages in it that should probably get moved out of the folder my mail filters are dumping new messages into. (You can have an enormous mbox that doesn't get USED during download and it won't slow down email downloading.)

Yes, this is related to the "I have to download from gmail via pop because imap is far more broken".

January 10, 2018

Met with the recruiters for the new job, picked up the pile of paperwork to sign. Feeling kind of morose, like I'm letting SEI down.

I've spent 3 years working for Jeff, which I think is longer than I've been at any other job. (Even beat out my first job at IBM by a few months.) I believe in what SEI's trying to do, and stayed a year and a half longer than they could reliably pay me, and I'd happily go _back_ there after this contract... if there's anything left. Jeff insists that there's a new contract coming soon that gives us a change of direction and fresh funding, except the fix for everything has been Real Soon Now for 2 years. This is the THIRD set of investors that have deliberated at length about giving us money. The stress is killing me, I need a break.

Alas, you can't fund from operations targeting utilities without bootstrapping to a large size and going through standards compliance nonsense. To get around that Jeff parnered with a big company that screwed us over for internal big company political reasons, and then he tried to put together a funding round based on another big company that was once _again_ paralyzed by big company internal politics. Disruptive technology 101: a large existing corporation cannot commercialize anything new in-house, it can only buy it once it's already proven.

This is not on the tech side of the house, I dunno how to fix it. Make a product and sell a product to people who will use the product I understand, navigate corporate status/dominance games where everything is some shade of affinity fraud and nobody involved in the decision making will be personally affected by the outcome except politically... that's not a domain I've spent a lot of time building skills in, because I sympathize with the people polishing guillotines every time it comes up. During the entire "postwar booom" period the top tax rate in the USA was 91%. (In 1963 they lowered it to 70%. Reagan lowered it to 28%, at which point our deficit exploded and corporations stopped investing in anything. Taxing profits makes companies spend money on research and training and all sorts of things that won't impact next quarter's numbers but are better than seeing the money confiscated by the feds. Lowering taxes makes them stop making any long-term investments in their business, their fig leaf being they can pile up cash and buy some other company that did all the right things later, the reality being they legally embezzle it all. Why is this hard to understand? This guilded age royal court nonsense is a _sickness_. It is symptomatic of an unhealthy economy, these are parasites feasting.)

Sigh. Happier thoughts.

My sad little netbook is plugged into wall current. It'll run without a battery, but isn't happy about it.

Thunderbird's terrible at dealing with large mbox folders, where large" is "a year of linux-kernel or qemu-devel". So I've created "lkml-2017" and "qemu-2017" subfolders and am once again copying all the year's messages into them and compacting stuff. It's REALLY slow.

You click on the first message, scroll down to the end of the range you'd like to copy (too much and it triggers the OOM killer, I can get away with maybe 20k each pass), shift-click on the ending message, then wait multiple minutes for the highlight to happen, then right click on any of the highlighted messages and wait the same amount again for the pop-up menu to appear, then navigate to the folder you want under "copy to->", click, and go to lunch.

If you've highlighted more than about 25,000 messages the copy will complete (and it deletes them as it goes), but afterwards thunderbird does some insane processing that exhausts all memory, drives the system into swap, and eventually triggers the OOM killer to kill thunderbird. (That's assuming you don't think the system is hung because your mouse cursor takes 3 minutes to respond to attempts to move it.)

If it's less than 25k messages it just takes forever to complete. As in I went to the grocery store and it wasn't done when I got back. Did I mention 25k messages is maybe 2 months of lkml traffic? It's something like 350 messages a day, plus bursts of ignorable bot-generated nonsense. (Your patch failed to build against the -tip tree! Why are you mailing the list? The giant backports against -stable patch series need their own list, but nobody would read it, so...)

Mostly I read the web archive, but I need the messages to reply to.

January 9, 2018

Dropped Fade and Adverb off at the airport. New semester starting, she's going back to her dorm in Minneapolis.

Sigh. LWN's is it time for open processors article (in response to meltdown and spectre) doesn't even mention of j-core. It mentions openrisc, and clones of powerpc and sparc, and links to riscy's press release. I guess we look too dead to matter.

(I _cannot_ get excited about RISC-V, it strikes me as Open Itanium. They promised everything to everyone and are cashing very large checks, and I see no obvious reason for it to displace x86 or arm? And that's _with_ meltdown and spectre. Maybe china will standardize on it by fiat, but didn't they already try that with a mips fork?)

Of course j-core's still a nommu processor, so you don't _need_ a memory protection bypass because there's no protection to bypass, but... Rich hasn't posted to the linux-sh list in months, and it has an outstanding futex bug for how many releases? QEMU's sh4 serial console's been broken for ages and still not fixed? Our last VHDL code release tarball was 2016 (did that support SMP? I don't remember). We never got even _part_ of the VHDL code up on github...

Jen says that Jeff had a good meeting with the new investors yesterday, but they didn't sign a check at the meeting. Just like we didn't get actual money from the december meeting, or the november meeting, or the october meeting. Not even the money for the "statement of work" that was supposed to tide us over until the end of last year. (I.E. it's a quarter's worth of money we've already spent a quarter trying to get.)

I can't make this happen by myself.

Heard back from the recruiter about the Milwaukee gig. They want me, but the recruiter was trying to talk down my quoted hourly rate at the last minute? Confused.

I had my netbook closed on a bench, it fell off about a foot onto a tile floor, and the battery case cracked in 3 places. Wheee. The screen no longer opened because it was hitting a piece of cracked battery case, and pulling it off took off about half the plastic.

Running it without a battery right now. Fade's ordered me a new one. (Did I mention I know too much about how the sausage is made to be comfortable typing my credit card info in to a website _ever_? I'm aware having someone else on a joint bank account do it does not improve matters, and yet.)

January 8, 2018

And my netbook finally rebooted. I tried to reproduce a mkroot issue which meant a script ran oneit as root, which couldn't attach to the requested console, and on the way out it rebooted the system.

Todo item: fix that.

January 7, 2018

I've found the jpop group responsible for Miss Kobayashi's Maid Dragon's opening and closing music. It is All The Bouncy.

Appending it to my normal music playlist put it right after Demi Lovato's cover of "Take me to Church" and the switch between the two has gears grinding.

Listening to colorado video about demand charges being one of the big drivers for pairing battery walls with solar and going for "complete curtailment". I.E. collect extra solar in your battery wall, and when your batteries are full just switch off the solar panels. Never try to feed anything upstream into the electrical grid. Apparently getting to 80% of this is easy, getting to 100% is hard.

January 6, 2018

Fade took me to Dead Lobster, by which I mean I drove and she paid. Took the hybrid loaner car, which remains deeply shiny. I looked up its price (they're so clearly letting my use this thing as a form of advertising) and it's $29k. That's for last year's model, not the new one. It's not outside what I could afford, but it's outside my comfort zone.

When I was 7 years old I got all excited about the idea of compound interest, and was pretty sure I could retire at 30 (or at least get to the point where I earned more in interest than in paycheck), and I was on course to do that circa 1999 or so (earning $50/hour and offered $75/hour to stay, plus owned two condos that went up $20k each in price while I owned them, not bad for a 27 year old), but over the years instead of saving and investing I gave time and money to friends and family in need. I'm doing ok, but I'm not close to retired.

Take SEI: I've been on half pay there for a year and a half, and they haven't even made those reliably. They're making about 2 out of 3 paychecks these days, which means I'm down to 1/2*2/3 = 2/6 = 1/3 pay which is not sustainable with this house even without the flooding. And that's on TOP of the fact I could make twice that fulltime hourly rate if I went back to consulting, so I'm choosing to earn 1/6 my market rate. I don't care about money, but I do care about a _lack_ of money, and things like social security and medicare won't survive the GOP, so I need to provide for my own retirement. After ten years of marriage Fade's never had kids so I'm pretty sure that's not happening at this point, and she's up in Minnesota, so I might as well go back to the Lucrative Nomad lifestyle before age discrimination kicks in too hard. (It's easy to find work if you go where the work is and do what they pay you to do. I've worked from home on stuff I find interesting, but the stress is getting to me.)

At the start of the new year I decided to look around. I did a phone interview for a gig in Milwaukee on Thursday, and I'm told I'll hear back on that Monday. I very much want to see SEI succeed but I can't make customers pay their bills or investors follow through on their promises, and they're not really sponsoring toybox development anymore...

I got a reminder about the CELF deadline (which has been extended to tuesday). Do I want to commit to travel at this point? Hmmm...

Where did I leave off... ping.c! (Although if I'm to make proper use of that cortex-m board before innoflight asks for it back again, I should do tftp/tftpd since that tftpboots.)

I need to check timestamps in fractions of a second, and I vaguely recall I created a millitime() function which returns current time in milliseconds (for the pun if no other reason: it's millitime). But it's not in lib, it's in ps.c, which means I have a second file wanting to use it so I should move it to lib/lib,c, and looking at that I trivially cleaned up the last function there, environ_bytes(). Except that function should really take environ as its argument, and this be able to iterate over argv[] too. But I shouldn't go down that tangent just _now_...

Hmmm, this implies that xparsetime() from yesterday should probably return milliseconds too. (When launching command line binaries, that's about the resolution you can expect. You need nanosecond accuracy for things like filesystem timestamps where you're reproducing a previous reading exactly, but not delta-from-current with pages faulted in from storage and a potential call to the dynamic linker in there before any of your code runs. Again, todo item for later.

Sigh. It would be nice if posix made proper use of C's object orientation. Specifically, in struct sockaddr and friends, wouldn't it be nice if:

struct sockaddr {
  short family;
  // whatever else

struct sockaddr_in {
  struct sockaddr sa;
  blah blah blah;

struct sockaddr_in6 {
  struct sockaddr sa;
  blah blah blah;

Right now you can typecast either to struct sockaddr and works fine, but it's not obvious what portion of that you can use. With the above you could &(sockaddr_in->sa) and not even have to typecast. (You'd still have to typecast it back once you knew what the type was, the pointers will be the same because a pointer to a struct is a pointer to the first member of the struct, there can be no padding or alignment space at the beginning. But right now it's implicit, not explicit, and if I declare a function to accept "struct sockaddr *" you have to typecast to call it with sockaddr_in or sockaddr_in6. At which point it might as well just be a void *, because that's what I'm going to typecast it TO to make the compiler shut up.)

There are ways to declare your data so "I know what I'm doing, let me do it" does not require hitting the compiler with a rock, but the network stack doesn't do it that way.

(But no, people think you need C++ for that kind of thing. You very much don't. C++ only makes things worse. Because they don't teach how to do it right, and the berkeley guys especially spent their first decade doing CRAZY THINGS. Everything's a file... except network interfaces, those aren't. Ken and Dennis were very good at finding the "sweet spot" between not enough capability and too much complexity, and I greatly admire what they accomplished. Many of their successors in BSD and AT&T, not so much...)

January 5, 2018

Cycled back around to ping. Specifying time between ping instances means you do fractions of a second, but I'm trying to restrict the use of floating point in the code and keep it under #ifdefs (to work on really tiny systems). So my infrastructure for that is xparsetime() (originally for sleep) which returns seconds and fractional seconds in two longs, and only uses floating point when the ifdefs are defined.

I want to add -i, which needs fractional seconds, and at the moment that means I need to turn its optargs from a number to a string (# to :) and call xparsetime() on the string myself. That raises the question of whether I should do the same for -s and -W, so the time parsing is consistent. But neither of those particularly care about fractional seconds, and the OTHER thing the optargs number parsing does is range checking and default value assignment. Having to do that manually raises the expense a bit.

Speaking of range checking, if you _do_ feed a negative time to xparsetime() the non-float path errors, and the float path returns the negative value, except if it's -0.5 then you have to check the seconds and fractions seperately to catch that it's a negative value, and really I should just check it in the strtod path. Alas, then it needs another error message which seems wasteful. Also strtod() can skip arbitrary spaces and allows a + at the front so checking for - at the start is more complicated than it seems... (So many corner cases.)

I could add an xparsetime() type to lib/args.c but there aren't realy enough users to justify it? The other big one is sleep, but there it's an optarg, not a flag argument, so sleep_main() has to parse it anyway, and in GLOBALS it would still have a sizeof(long) slot needing to fit 2 fields, and a struct that fits in 32 bits on 32 bit systems would have to be 2 short ints so it couldn't do nanoseconds, which eliminates about half the other uses.

Ah, I see: if you go "sleep -1" it says 1 is an unknown option, that's probably why I didn't care at the time. Of course you can do "sleep ' -1'" and strtod() eats the leading space and then parses it and returns a negative number, although sleep then returns immediately so it doesn't hurt anything...

Sigh, ok. Keep -w and -W doing the optargs # integer parsing, and have -i do something different.

January 4, 2018

All the bugs in the world. I updated my offline backups.

Wouldn't it be nice if we had an organization like the NSA that was supposed to find and publish the sort of vulnerabilities that make Hardison from Leverage or Finch from Person of Interest's ability to hack into any computer anywhere NOT FICTION? Instead of hoarding them so it can keep their budgets unlimited in perpetuity by blackmailing future politicians with the porn they browsed as teenagers, and treating any other possible use of the data (such as law enforcement) as compromising their sources? Wouldn't that have been nice.

I know it sounds crazy blaming those sorts of guys for vulnerabilities that go back before September 11, 2001. But we know they're _trying_, the counter-argument is they're not as _effective_ as they'd like to be.

January 3, 2018

The Call For Papers deadlines for both ELC and TXLF are coming up. I'm still sort of "too tired, dowanna travel, I should just podcast", but at the same time I should show the flag and I do have various things I should probably talk about: 0BSD and licensing stuff, mkroot, making android self-hosting... Heck, I could do a panel of just war stories. Haven't bothered to write up any proposals yet though.

Dropped the car off at Howdy Honda. In addition to the crunchy noises from the suspension when it hits uneven road (cv joint?), it's now making growling noises when it's cold and you turn the wheel. (Power steering pump?) It's a 2002 car, about 16 years old now (we bought it used). I've been waiting for app-summonable self driving car services, but that's like 2 more years for early adopters and maybe 5 to be ubiquitous in urban centers. (And in about 7 gasoline volume declines enough that the profit marging for refining, distributing, and selling it with the current infrastructure and transportation network goes negative, at which point a car running on gasoline isn't quite so useful. And yes the auto industry knows this so resale value's likely to decline well before then, but "when does the herd break and run" is always a hard financial question. All the manufacturers are switching over to electric cars now, but the first generation models are still too expensive for my tastes and when the self-driving subscription fleets show up why own your own? Don't sink a well when city water's 5 years away from reaching your neighborhood...)

So yeah, waiting out the awkward adolescence of yet another industry. I rememer the days of "when can I get an ISP instead of dialing in to my university or work", "when can I get broadband instead of dialup", "when is my cell phone good enough to stop paying for a landline", "should I just have a laptop and not bother having a desktop", "when can we switch from netflix mailing us DVDs to just the streaming", "hard drive or ssd"...

These days there's "when to get rooftop solar and a battery wall", "when can I get a development environment on my phone/tablet so I don't need a PC anymore"... There's usually some case where :I know where it's GOING but is it quite HERE yet", and a car is a large purchase that kind of imposes itself upon you at times...

January 2, 2018

Jeff just asked me to work on an 8-bit chip design with him, but I'm already stretched too thin on the stuff I'm already doing. The Big Push in november involved GPS, helping arrange investor meetings, trying to track todo items for the whole company, turtle manufacturing stuff, and of course the endless uncertainty. (During investor prep Jeff kept gaming out how the bloq guys might screw us over or flake, so we'd be prepared. About half the time I didn't know where I'd be sleeping the next day.)

Jen not showing up wasn't Jeff's fault but it meant plans changed and I had to try to figure out what Jen does and maybe try to come up to speed on the existing customer phone calls (maintaining their trickle of R&D funding) and see if Weekly Engineering Call With Jeff could replace Daily Engineering Call With Jen if she flaked completely. That's a management job I got sucked into a vacuum for.

Jeff tried to sit me down and teach me enough VHDL to help with the ASIC tapeout, despite niishi and arakawa with years of experience in it _not_ being up to help with the tapeout. He tried very hard to get me to track what RiscV was doing and I _cannot_ bring myself to care, it smells too much like an open source version of Itanium made from hype and overcommitted promises and absorbing all the funding in the world to be less interesting than x86, let alone arm. We met with a nice lady at a university who's doing a toy processor. We sat down to try to sort the instruction bit patterns of j-core so we could redo the front end more efficiently, but didn't have time to finish that. We started to triage the build system for a github release, but didn't have time to finish that. We talked about hooking up the GPS-stabilized nanosecond accurate clock to the userspace signal monitoring package, but didn't have time to finish that...

All this has put me way over mental budget on my normal ecosystem (which used to be aboriginal linux+busybox and is now toybox+mkroot/aosp). Trying to turn android into a self-hosting development environment is STALLED HARD. (Politics: the pixel 7 tablet is discontinued so all the google in-house testing systems are now chromebooks; chromeos runs android apps but what does this mean for testing android base layers? How is development shifting inside google? I haven't had a chance to ask. Whatever it is is happening without me and I'll find out 6 months later when it's too late to provide feedback that might influence any of the decisions. Oh well.)

I haven't done half of what I need to on SEI's Board Support Package because that hasn't really been my job in forever. The website is in pieces and the mailing list is silent because I'm not sure what I'm allowed to _say_. The website needs to turn into kernel Documentation/ files. The arch/sh and linux-sh stuff is badly stale upstream and in _theory_ that's Rich's task but in practice he hasn't got cycles for it (and he only cares about testing on real hardware, even though QEMU is what the upstream kernel guys can actually regression test against; the serial console's been broken for most of a year and we never fixed it translates to a perception that "this platform is dead"). I haven't kept up with new kernel developments in general for the quarterly releases, and I've had patches I've wanted to push upstream for a year, but haven't.

I have a significant issue that that my own projects look dead to other people. I haven't posted to the mkroot list since October. I spent some time getting mkroot closer to parity with aboriginal in terms of supported targets (the reboot was required by swapping out the toolchain for musl-cross-make) but I still haven't got the native toolchains working, let alone the distcc trick or the build control image automation layer. The last mkroot release was in June, using a 4.11 kernel (which is over a year old now).

I spent part of this vacation getting my technical development blog caught up closer to current, which means I've gotten it up to mid-september. (I have daily-ish rough draft notes-to-self in a text file but it needs significant editing and expansion to make sense to anyone else. Plus html tags and links and proofreading.)

I've spent the rest of this vacation trying to do enough toybox work the project doesn't look dead to the android guys. I got the smallest two commands promoted out of pending and I'm trying to deal with the new submission of fmt.c (from the android guys).

I'm sitting on the west coast Embedded Linux Conference call for papers and haven't submitted anything yet because I'm _tired_. It would be really good to show the flag there but my talk there last year and the one before that at were incoherent because I was too exhausted to prepare and give good talk. (And given my baseline fatigue and redeye flights one day was NOT enough to recover from jeglag in either case.) It hasn't gotten better since.

It looks like I can either stop doing open source development, or I can get a day job doing something less taxing which I can stop thinking about when I leave the office.

Sigh. Jeff talked about how great sitting down and grinding is, and I WANT to do that but I CAN'T because it's a constant stream of interruptions swap-thrashing between too many projects that never produce output and idle for so long between bursts that when you go back to them you spend all your time trying to figure out where you left off and why because you've forgotten all the context and have to reverse engineer your own code. This has been the failure mode of toybox development for the past couple years, now it's becoming the failure mode of EVERYTHING, because I can't focus and when I do carve out time I'm too exhausted to make good use of it.

Random example: waiting at the airport for the flight back from tokyo, I caught up another couple weeks on the j-core news page. Triaged, edited, and uploaded. Haven't touched it since, so of course it's now further behind than it was when I did that. And of course there's no https on that website even though doing so is like half a day's work. (Well, for Rich. Probably about 3 days for me, the update scripts are fiddly and there's a dozen implementations with no obvious winner because the one Let's Encrypt provided/recommends is overcomplicated crap so many people have made their own but _because_ there's an "official" one none of the others has coalesced a big community around it yet and become the obvious one to use.)

I remember when Jeff and I talked about moving all the servers to tokyo. A year or so back, we bought a USB drive to do backups to, and he had me install ubuntu on an old 32-bit machine he had lying around. Might have been the end of the trip with Tokyo Big Sight?) Out of curiosity I just ssh'd into and did a sudo aptitude update and it has 58 packages it wants to upgrade. I'm afraid to do the corresponding upgrade because if it breaks, what do I do? The person Jen tried to transfer wale's sysadmin responsibilities to was... me. The servers are in the back of an office in canada, I'm in texas.

I'm not sure I'm still making a difference here.

January 1, 2018

Happy new year.

Next low hanging fruit pending command to clean up, sorting by source file size, is logger.c. The main reason it's in pending is it depends on CONFIG_SYSLOGD. That kind of cross-command dependency is unpleasant, I try to either merge them into the same .c file (ala ps/top/pgrep) or move whatever they share to lib.

Since the actual function logger wanted out of syslogd was only a few lines long, I just inlined it in the two calls in logger, did the other obvious cleanups, and tried a test build... at which point I noticed the next problem.

The function I inlined is iterating through two arrays, facilitynames and prioritynames, which are defined in sys/syslog.h. But you have to #define SYSLOG_NAMES before #including that in order to get them. Why? Because #ifdef in the header is instantiating the array, which means if you #include it from two places you get two copies of the array.

The really STUPID part is I can't #include it from one file and then extern reference it elsewhere because the TYPE is defined in the same #ifdef.

One of Rich Felker's coworkers complained about this before, and clearly this was a case of glibc being stupid, but it's one of those things that shipped and now fixing it would break existing programs.

Back to 2017