<?xml version="1.0" encoding="utf-8"?> 
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <generator uri="https://gohugo.io/" version="0.78.2">Hugo</generator><title type="html"><![CDATA[NetBSD on Roy's Blog]]></title>
    
        <subtitle type="html"><![CDATA[Mainly about tech stuff I have a hand in]]></subtitle>
    
    
    
            <link href="https://roy.marples.name/blog/tags/netbsd/" rel="alternate" type="text/html" title="HTML" />
            <link href="https://roy.marples.name/blog/tags/netbsd/atom.xml" rel="self" type="application/atom+xml" title="Atom" />
            <link href="https://roy.marples.name/blog/tags/netbsd/feed.json" rel="alternate" type="application/json" title="Json" />
    <updated>2021-03-12T11:08:32+00:00</updated>
    
    <id>https://roy.marples.name/blog/tags/netbsd/</id>
        
        <entry>
            <title type="html"><![CDATA[Ubiquiti ERLite and the Dodgy Power Supply]]></title>
            <link href="https://roy.marples.name/blog/posts/ubiquiti_erlite_dodgy_power_supply/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/ubiquiti_erlite_dodgy_power_supply/</id>
            
            <published>2021-01-24T19:14:00+00:00</published>
            <updated>2021-01-24T19:14:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p>I recently <a href="../ubiquiti_usg/">posted about that my ERLite died</a>.
Well, it turns out that the flashing green light generally means a power
supply issue. <em>EDIT</em> The ERLite is about 3 and a half years old as I&rsquo;ve
had a few people ask me that.</p>
<p>Not having a spare 12V 1A adapter with the right barrel made testing this
pretty darn hard and desperate times convinced me to buy the USG
<em>(which is still working like a champ, no regrets here!)</em>.
So I waited until everyone was in bed
<em>(not hard due to my medication as I don&rsquo;t sleep much)</em> and used the USG
power supply. Still didn&rsquo;t boot, but performing a hardware reset did!</p>
<p>Unsure what the hardware reset does, maybe update some internal flash a little,
unsure if it touches the USB stick or relies on EdgeOS being installed
rather than say NetBSD, but it&rsquo;s done the trick!
I bought a cheapo 12V 1A AC adapter with the right barrel size and plugged it
in today and it still boots.</p>
<p>This means I can keep the USG powering my internet at blazingly fast speeds
and the ERLite for NetBSD development as it doesn&rsquo;t support any of the
network hardware offload the ERLite has, so throughput suffers as a result.</p>
<p>If anyone from Ubiquiti reads this, please do something about your
power adapters as it seems this <strong>has happened to quite a few customers</strong>
after reading <a href="https://community.ui.com/questions/ERL-Power-supplies-failing/600882c4-0cad-4d00-ae10-1f084bbf12d7">past community posts on your forums</a>!</p>
<p>Thanks to the wonderful folks over at the
<a href="https://mail-index.netbsd.org/port-mips/2021/01/19/msg001001.html">NetBSD port-mips mailing list</a>
for their valuable assistance.</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/tech" term="tech" label="tech" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[NetBSD curses erase functions fixed]]></title>
            <link href="https://roy.marples.name/blog/posts/curses_erase_fixes/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/curses_erase_fixes/</id>
            
            <published>2020-03-15T07:55:00+00:00</published>
            <updated>2020-03-15T07:55:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p><a href="http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=23910">NetBSD PR lib/23910</a>
was filed over 16 years ago.
It describes how NetBSD curses fails to work with <a href="https://vifm.info/">Vifm</a>,
a <a href="https://www.vim.org/">Vim</a> interface for a curses GUI file manager.
It&rsquo;s quite a nice idea after playing around with it some as Vim is my favourite
text editor.</p>
<p>Since I was the main protagonist in bringing <a href="terminfo_married_to_curses.html">terminfo to NetBSD</a>, I had a reasonable grasp on how our curses worked and
I had looked at this bug before, but left scratching my head over it.</p>
<p>Since I looked at it, Valery Ushakov added a simple test case to demonstrate
the issue.</p>
<div class="highlight"><pre style="background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-c" data-lang="c"><span style="color:#099">#include</span> <span style="color:#099">&lt;curses.h&gt;</span><span style="color:#099">
</span><span style="color:#099">#include</span> <span style="color:#099">&lt;err.h&gt;</span><span style="color:#099">
</span><span style="color:#099">#include</span> <span style="color:#099">&lt;stdio.h&gt;</span><span style="color:#099">
</span><span style="color:#099">#include</span> <span style="color:#099">&lt;stdlib.h&gt;</span><span style="color:#099">
</span><span style="color:#099">#include</span> <span style="color:#099">&lt;unistd.h&gt;</span><span style="color:#099">
</span><span style="color:#099"></span>
<span style="color:#078;font-weight:bold">int</span>
<span style="color:#c0f">main</span>()
{
	<span style="color:#069;font-weight:bold">const</span> <span style="color:#078;font-weight:bold">char</span> <span style="color:#555">*</span>errmsg <span style="color:#555">=</span> <span style="color:#366">NULL</span>;
	<span style="color:#078;font-weight:bold">int</span> err;

<span style="color:#099">#define CHECKERR(_msg)					\
</span><span style="color:#099">	do {						\
</span><span style="color:#099">		if (err != OK) {			\
</span><span style="color:#099">			errmsg = _msg &#34; failed&#34;;	\
</span><span style="color:#099">			goto out;			\
</span><span style="color:#099">		}                                       \
</span><span style="color:#099">	} while (0)
</span><span style="color:#099"></span>

	WINDOW <span style="color:#555">*</span>scrw <span style="color:#555">=</span> initscr();
	<span style="color:#069;font-weight:bold">if</span> (scrw <span style="color:#555">==</span> <span style="color:#366">NULL</span>)
		errx(EXIT_FAILURE, <span style="color:#c30">&#34;initscr failed</span><span style="color:#c30;font-weight:bold">\n</span><span style="color:#c30">&#34;</span>);

	<span style="color:#069;font-weight:bold">if</span> (<span style="color:#555">!</span>has_colors()) {
		errmsg <span style="color:#555">=</span> <span style="color:#c30">&#34;no colors&#34;</span>;
		<span style="color:#069;font-weight:bold">goto</span> out;
	}

	err <span style="color:#555">=</span> start_color();
	CHECKERR(<span style="color:#c30">&#34;start_color&#34;</span>);

	err <span style="color:#555">=</span> init_pair(<span style="color:#f60">2</span>, COLOR_WHITE, COLOR_RED);
	CHECKERR(<span style="color:#c30">&#34;init_pair&#34;</span>);

	<span style="color:#078;font-weight:bold">int</span> maxy, maxx;
	getmaxyx(stdscr, maxy, maxx);

	WINDOW <span style="color:#555">*</span>lborder <span style="color:#555">=</span> newwin(maxy<span style="color:#555">-</span> <span style="color:#f60">1</span>, <span style="color:#f60">1</span>, <span style="color:#f60">0</span>, <span style="color:#f60">0</span>);
	<span style="color:#069;font-weight:bold">if</span> (lborder <span style="color:#555">==</span> <span style="color:#366">NULL</span>) {
		errmsg <span style="color:#555">=</span> <span style="color:#c30">&#34;newwin failed&#34;</span>;
		<span style="color:#069;font-weight:bold">goto</span> out;
	}

	wbkgdset(lborder, COLOR_PAIR(<span style="color:#f60">2</span>));

	werase(lborder);

	mvwaddstr(lborder, <span style="color:#f60">0</span>, <span style="color:#f60">0</span>, <span style="color:#c30">&#34;A&#34;</span>);
	mvwaddstr(lborder, maxy<span style="color:#555">-</span> <span style="color:#f60">2</span>, <span style="color:#f60">0</span>, <span style="color:#c30">&#34;Z&#34;</span>);

	wnoutrefresh(stdscr);
	wnoutrefresh(lborder);
	doupdate();

	sleep(<span style="color:#f60">5</span>);
<span style="color:#99f">out</span>:
	endwin();

	<span style="color:#069;font-weight:bold">if</span> (err <span style="color:#555">!=</span> OK) {
		<span style="color:#069;font-weight:bold">if</span> (errmsg <span style="color:#555">==</span> <span style="color:#366">NULL</span>)
			errmsg <span style="color:#555">=</span> <span style="color:#c30">&#34;unknown error&#34;</span>;
		fprintf(stderr, <span style="color:#c30">&#34;%s</span><span style="color:#c30;font-weight:bold">\n</span><span style="color:#c30">&#34;</span>, errmsg);
		<span style="color:#069;font-weight:bold">return</span> EXIT_FAILURE;
	}

	<span style="color:#069;font-weight:bold">return</span> EXIT_SUCCESS;
}
</code></pre></div><p>He then noted that using <code>wbkgd</code> instead of <code>wbkgdset</code> makes it work.</p>
<p>Now, the difference between the two is that <code>wbkgd</code> forces new attributes on
the whole window background, whereas <code>wbkgdset</code> sets new attributes
<strong>for new actions on the window</strong>.
Keen observers will notice that the following function called is <code>werase</code>,
which does what it says on the tin and erases the window but also
<strong>resetting the attributes</strong> of the contents.
So, I looked at this function and noticed the attribute checking code was
faulty and a <a href="http://anonhg.netbsd.org/src/rev/068b7d4abae7">simple fix</a>
was enough to solve it!</p>
<p>Valery then pointed out that <code>wclrtoeol</code> probably needed fixing to and as it
turned out, <code>wclrtobot</code> likewise.
As it transpired, all 3 had different logic in working out when to erase
something!
We went through a few iterations of patches to harmonise the code and have
settled on a macro that all 3 now share, so hopefully no more erasing issues
in our curses.</p>
<p>As a follow on task, I should go through the NetBSD bug backlog and see
if this fixes any other reported issues.</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/code" term="code" label="code" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[terminfo numeric parameters promoted from short to int]]></title>
            <link href="https://roy.marples.name/blog/posts/terminfo_int_paramters/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/terminfo_int_paramters/</id>
            
            <published>2020-03-15T07:55:00+00:00</published>
            <updated>2020-03-15T07:55:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p><a href="https://pubs.opengroup.org/onlinepubs/007908799/xcurses/terminfo.html">POSIX mandates implementations must support upto a short but may exceed it</a>.
When NetBSD terminfo was implemented, no terminfo description used over
a short, but because ncurses has supported ints for some time, some now do.</p>
<p>Infact, such a terminfo description was imported where colour pairs for
screen-256color went up to 65536 which exposed a bug in the existing
implementation where it was set to zero. Because the number might mean
something more than a range, we need to be able to store it accurately.</p>
<p>This requires a version bump because whilst the API hasn&rsquo;t changed thanks
to <a href="https://www.geeksforgeeks.org/integer-promotions-in-c/">C int promotion</a>,
the ABI has. Also the underlying database structure
has changed as well- we now store the numeric parameter inside a uint32_t
field rather than a uint16_t one.
Whilst this change can still read the old style database, the old one
cannot read the new one and thus we now maintain the database as
terminfo2.cdb, leaving the old library and database alone so old programs
still work fine.</p>
<p>libcurses, libfrom, libmenu and libpanel have also been bumped to
accomoate this change.</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/code" term="code" label="code" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[NetBSD curses ripoffline improvements]]></title>
            <link href="https://roy.marples.name/blog/posts/netbsd_curses_ripoffline_improvements/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/netbsd_curses_ripoffline_improvements/</id>
            
            <published>2018-10-03T17:30:00+00:00</published>
            <updated>2018-10-03T17:30:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p>I implemented <a href="http://pubs.opengroup.org/onlinepubs/7908799/xcurses/ripoffline.html">ripoffline(3)</a> in NetBSD and it shipped in-8.
It now transpires there were a few problems with the implementation, mainly in regards to screen resizing, which is an extension to POSIX, but supported by <a href="https://invisible-island.net/ncurses/man/resizeterm.3x.html">ncurses</a> and <a href="https://github.com/wmcbrine/PDCurses">PDCurses</a>.</p>
<p>Many improvements have been made with regards to compability with NetBSD and the others, but there are the following caveats:</p>
<ul>
<li>NetBSD will only resize stdscr, curscr and virtscr windows (like PDCurses)</li>
<li>NetBSD clears the window when resized</li>
<li>NetBSD will re-size and re-position the ripped off lines (like ncurses)</li>
<li>NetBSD will not change LINES when ripoffline is called and may offset stdscr to it&rsquo;s relative position on the screen. This means that portable application should check <a href="http://pubs.opengroup.org/onlinepubs/7908799/xcurses/getbegyx.html">getbegyx and getmaxyx</a> for the size and location of stdscr.</li>
</ul>
<p>The expectation is that the client will re-draw all windows, including ripped off windows on a KEY_RESIZE event.
It&rsquo;s also expected that the client will re-size any other windows as it has a clearer idea of where things should be on the screen to it&rsquo;s proportion rather than curses guesstimating.</p>
<p>Now, the very colourful <a href="https://en.wikipedia.org/wiki/Roguelike">Roguelike</a> game <a href="https://github.com/jaldhar/AitDoB">Ascent into the Depths of Beyond</a> now works on NetBSD <a href="https://github.com/jaldhar/AitDoB/pull/1">with a minor patch</a></p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/curses" term="curses" label="curses" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/gaming" term="gaming" label="gaming" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[HTTP/2 enabled]]></title>
            <link href="https://roy.marples.name/blog/posts/http-2_enabled/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/http-2_enabled/</id>
            
            <published>2017-02-07T09:51:00+00:00</published>
            <updated>2017-02-07T09:51:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p>So finally I&rsquo;ve moved all services from my old server to my <a href="../the_christmas_xen_box">Christmas Xen box</a>!
This was not without problems due to the fact it had to run NetBSD-current</p>
<ul>
<li><a href="http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=51105">gcc toolchain is broken for some packages</a> which affected running any PHP build</li>
<li>clang toolchain was broken for my config <em>(USE_SSP= yes and CPUFLAGS+=-march=core2)</em></li>
<li>clang compiles as a whole were broken due to a recent efiboot import</li>
</ul>
<p>In hind-sight, I could have had the box up and running a lot sooner if I used NetBSD-7 guests (or maybe just a NetBSD-7 build box), but no, I just <strong>had</strong> to get-current running.
It offers more than-7 and prior exerience told me that tracking-7 was very problematic &hellip; but that could have been due to my settings and wanting to compile everything with clang.
I&rsquo;ve currently got 3-current images there now &hellip; the Xen DOM0, the actual server itself as Xen DomU (without any compiler or tools) and another Xen DomU which just builds stuff for other guests to use.</p>
<p>Anyway, the box itself is now up and running and all relevant services have been moved to it.
During this move, I decided to modernise things a little and setup <a href="https://en.wikipedia.org/wiki/HTTP/2">HTTP/2</a>. If you&rsquo;re reading this then it&rsquo;s working :)
As such, I&rsquo;ve re-directed all basic HTTP traffic to HTTPS and it does seem to load a lot faster.
One side effect of this is that I&rsquo;ve stoped using my own self signed certificates and I&rsquo;m now using the nice <a href="https://letsencrypt.org/">Let&rsquo;s Encrypt</a> service.
<a href="https://www.pkgsrc.org/">pkgsrc</a> users should use the <a href="http://pkgsrc.se/security/py-certbot">py-certbot</a> package and don&rsquo;t bother searching for any letsencrypt package as it&rsquo;s been renamed. I found this quite confusing as there was no reference to the rename in pkgsrc I could find and wasted a little time on it.</p>
<p>But now it&rsquo;s live I can finally look into bringing online some other development utilities to play around with as the server has a lot more room to grow :)</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/tech" term="tech" label="tech" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/site" term="site" label="site" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[Soft Label Keys]]></title>
            <link href="https://roy.marples.name/blog/posts/soft_label_keys/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/soft_label_keys/</id>
            
            <published>2017-01-24T20:36:00+00:00</published>
            <updated>2017-01-24T20:36:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p><a href="../2017_starts_with_some_cursing">After starting the year with curses work</a>, I decided to do some more!</p>
<p>Currently we lack <a href="http://pubs.opengroup.org/onlinepubs/7908799/xcurses/slk_init.html">Soft Label Key functions as specified by POSIX</a>. What are these?
Glad you asked! Soft Label Keys ripoff a line from the bottom of the screen and allow for up to 8 keys to be displayed there.
You can define labels for them, colours, etc.</p>
<p><em>&ldquo;BIG WHOOP!&quot;</em> I hear you say. <em>&ldquo;My app already does this, why should I care?&quot;</em></p>
<p>Because SLK also works with the <a href="http://pubs.opengroup.org/onlinepubs/7908799/xcurses/terminfo.html">terminfo database</a> to work out if the terminal natively supports labels <em>(via plab_norm, label_on, etc)</em>!
This means a line doesn&rsquo;t have to be ripped off from the screen so no real-estate is lost. Sadly, no terminal actually seems to support these markings. But if one is ever made, it should work fine.</p>
<p>Now, not many curses apps actually use the SLK functions, probably for this very reason. But some do, and it <strong>is</strong> a standard so I&rsquo;ve coded NetBSD to support this natively.</p>
<p>Sadly, this has uncovered a bug in the NetBSD curses library where cursor movement in a one line window at the bottom of the screen appears to push the window up.
This <strong>is very visible</strong> with SLK and will have to be fixed for any apps that actually use it, but the SLK implementation itself is sound as resizing the terminal forces a redraw and it looks fine.</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/tech" term="tech" label="tech" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/curses" term="curses" label="curses" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[2017 starts with some cursing!]]></title>
            <link href="https://roy.marples.name/blog/posts/2017_starts_with_some_cursing/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/2017_starts_with_some_cursing/</id>
            
            <published>2017-01-04T20:39:00+00:00</published>
            <updated>2017-01-04T20:39:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p>So over the holidays, I managed to get in some good quality family time and find some time to work on some Open Source stuff.
I meant to work mainly on <a href="/dhcpcd">dhcpcd</a>, but it turned out I spent most of my time working on <a href="https://wiki.netbsd.org/curses_in_netbsd/">NetBSD curses library</a> so that <a href="https://docs.python.org/3/howto/curses.html">Python Curses</a> now works with it.
Now, most people reading this blog may not care much for NetBSD or for curses, but it&rsquo;s important because <a href="https://www.gnu.org/software/ncurses/">ncurses</a> is used pretty much everywhere by default &hellip;.. aside from NetBSD. And most readers should know, I go out of my way to promote interoperable software even when it&rsquo;s at a detriment to my own projects. That&rsquo;s just how I roll.</p>
<p>There is a apparently a thing called <a href="https://github.com/wmcbrine/PDCurses">PD Curses</a> but I don&rsquo;t know anywhere that actually uses it by default.
If you know, please email me @ <a href="mailto:roy@marples.name">roy@marples.name</a> or <a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=@rsmarples PD Curses is used ...">tweet me</a>. I do know that the <a href="https://www.pkgsrc.org/">pkgsrc</a> <a href="http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/mk/curses.buildlink3.mk?rev=1.23&amp;content-type=text/x-cvsweb-markup&amp;only_with_tag=MAIN">curses framework</a> supports it.</p>
<p>And this is the thing I&rsquo;m currently doing. As NetBSD curses supports more POSIX functions (and a few ncurses extensions, sadly) more and more packages now work alongside NetBSD curses, so I&rsquo;m plowing through pkgsrc again moving things to the curses framework.
This is important, because there is logic in devel/ncurses to use NetBSD curses when passing certain criteria, but sadly this always brings ncurses as a possibility to be linked or it&rsquo;s header used, both of which are quite bad for NetBSD curses so there is a method to my madness.</p>
<p>One interesting thing though is that since I started comitting my curses patches, it turns out that <a href="http://sabotage.tech/">Sabotage Linux</a> is using NetBSD curses <a href="https://github.com/sabotage-linux/netbsd-curses">and made it portable</a>.
I&rsquo;m chatting with one of their devs and we&rsquo;re starting to merge of a few of their patches back into NetBSD.</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/tech" term="tech" label="tech" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/curses" term="curses" label="curses" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[Right after all these years]]></title>
            <link href="https://roy.marples.name/blog/posts/right_after_all_these_years/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/right_after_all_these_years/</id>
            
            <published>2014-01-15T10:51:00+00:00</published>
            <updated>2014-01-15T10:51:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p>So one of the main features of <a href="/projects/dhcpcd">dhcpcd</a> was the ability to add and remove addresses <em>and</em> subnets in accordance with interface preference and state.
This worked very well in Linux, both for IPv4 and IPv6.</p>
<p>When I discovered <a href="http://roy.marples.name/blog/archives/77-FreeBSD.html">FreeBSD</a> and then <a href="http://roy.marples.name/blog/archives/128-Finding-NetBSD.html">NetBSD</a> making dhcpcd work with the same features provided troublesome. For the IPv4 case, we needed to patch the kernel so that <a href="http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/netinet/in.c.diff?r1=1.129&amp;r2=1.130&amp;only_with_tag=MAIN&amp;f=h">IFA_ROUTE</a> <a href="http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/netinet/in.c.diff?r1=1.141&amp;r2=1.142&amp;only_with_tag=MAIN&amp;f=h">remained sane</a>.
For the IPv6 case it was a lot more complicated as parts of the IPv6 stack <strong>rely</strong> on the kernel processing Router Advertisements instead of a 3rd party tool. Working this out was a lot more time consuming and complicated, <a href="http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/netinet6/nd6_nbr.c.diff?r1=1.98&amp;r2=1.99&amp;only_with_tag=MAIN&amp;f=h">but we got there</a> <a href="http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/netinet6/nd6.c.diff?r1=1.146&amp;r2=1.147&amp;only_with_tag=MAIN&amp;f=h">with minimal fuss</a>!</p>
<p>So as of now, dhcpcd can fully replace the NetBSD and Linux in kernel Router Advertisement handling code.</p>
<p>But why was I right after all these years? Because quite a few knowledgeable NetBSD folk assured me that the kernel was fine and it was likely dhcpcd at fault. As it turned out, it really was the kernels fault.</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/dhcpcd" term="dhcpcd" label="dhcpcd" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/tech" term="tech" label="tech" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[Linking with style .... and speed]]></title>
            <link href="https://roy.marples.name/blog/posts/linking_with_style______and_speed/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/linking_with_style______and_speed/</id>
            
            <published>2010-02-27T08:16:00+00:00</published>
            <updated>2010-02-27T08:16:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p>So, I&rsquo;ve been slowing going back to using <a href="http://www.gnome.org/">GNOME</a> instead of  using <a href="http://www.kde.org/">KDE-4</a>. I do this flip flop every once in a while as I&rsquo;m never truely satisfied by either. Now, GNOME works quite happily on my <a href="http://www.gentoo.org/">Gentoo/Linux</a> machines, but this is not the case on my favoured <a href="http://www.netbsd.org/">NetBSD</a> ones. Or rather, parts of GNOME don&rsquo;t work as they should, like the <a href="http://projects.gnome.org/evolution/">Evolution</a> mail client.</p>
<p>Evolution suffers two problems on my NetBSD box. One, it takes over 5 minutes to load and two, once it has checked and downloaded mail from my server it closes without error. The 2nd problem is probably a programming error in Evolution or one of its many dependencies, but the first problem could be anywhere! Research led me to <a href="http://lists.freebsd.org/pipermail/freebsd-gnome/2008-March/019514.html">this possible soltuion</a>. If you look closely, you&rsquo;ll find an old post by me in that thread fixing it with ld&ndash;as-needed on Gentoo/FreeBSD, but that isn&rsquo;t a real solution for NetBSD / pkgsrc users. Anyway, at first glance the patch on that thread makes perfect sense. So I came up with better patches (one for glib, one for Evolution) and it now loaded in under 3 seconds! All was well :)</p>
<p>Well, not entirely. Other applications started to show isses as a result. So at least we know we&rsquo;re in the right area. I then spent a few hours wading through the Evolution build chain and came to the conclusion I still hate autotools as it obscures everything but was no better off fixing it. But I did come up with a test case that opened an evolution library and searched for a symbol that did not exist. This should 30 seconds, which is far too long and is also probably what the poster of the FreeBSD patch did in the mail thread.</p>
<p>Cutting to the chase, the <a href="http://en.wikipedia.org/wiki/Linker_(computing)">runtime linker</a> on NetBSD was checking the same library for the same symbol over and over again. Going back to the FreeBSD linker, they have a patch which implements a negative cache which should solve this. But it doesn&rsquo;t, as it doesn&rsquo;t cache missed weak symbols. Luckily this is easy to rectify and you can <a href="http://mail-index.netbsd.org/tech-userlevel/2010/02/24/msg003325.html">find my patch here</a> and an updated one after performance testing elsewhere <a href="http://mail-index.netbsd.org/tech-userlevel/2010/02/25/msg003331.html">here</a>. Now Evolution loads in under 3 seconds and crashes right away- but that&rsquo;s an issue to fix another day :)</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/gnome" term="gnome" label="GNOME" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/tech" term="tech" label="tech" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[terminfo merged into NetBSD]]></title>
            <link href="https://roy.marples.name/blog/posts/terminfo_merged_into_netbsd/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/terminfo_merged_into_netbsd/</id>
            
            <published>2010-02-04T00:20:00+00:00</published>
            <updated>2010-02-04T00:20:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p>It&rsquo;s taken some time, but my terminfo implementation is now <a href="http://mail-index.netbsd.org/source-changes/2010/02/03/msg006267.html">merged into NetBSD</a> :)</p>
<p>No doubt there will be some fallout and flames, but it&rsquo;s all about bringing some needed modernization into NetBSD!</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/tech" term="tech" label="tech" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[terminfo married to curses]]></title>
            <link href="https://roy.marples.name/blog/posts/terminfo_married_to_curses/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/terminfo_married_to_curses/</id>
            
            <published>2009-12-08T12:32:00+00:00</published>
            <updated>2009-12-08T12:32:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p>My prior <a href="blog:2009/09/25">terminfo</a> work has been completed and merged with curses. Userland applications have been re-worked where needed and everything is working just fine!</p>
<p>So NetBSD finally has an up to date replacement for the legacy termcap it currently uses. Well, it will have when merged - I&rsquo;ve only just <a href="http://mail-index.netbsd.org/tech-userlevel/2009/12/08/msg003017.html">asked for testing</a> so it might take some time before it hits-current.</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/curses" term="curses" label="curses" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/terminfo" term="terminfo" label="terminfo" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[openresolv imported into NetBSD]]></title>
            <link href="https://roy.marples.name/blog/posts/openresolv_imported_into_netbsd/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/openresolv_imported_into_netbsd/</id>
            
            <published>2009-11-21T08:09:00+00:00</published>
            <updated>2009-11-21T08:09:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p><a href="http://roy.marples.name/projects/openresolv">openresolv</a> has been imported into NetBSD, which allows more than one daemon to update /etc/resolv.conf sanely and configure local nameservers for enhanced DNS, especially if running on a VPN. <a href="http://roy.marples.name/projects/dhcpcd">dhcpcd</a> already uses resolvconf when available and dhclient in NetBSD has been patched to use it.</p>
<p>This is important for NetBSD, as many packages support resolvconf, but only when /sbin/resolvconf exists. This meant that a lot of packages that supported resolvconf, failed to work with any resolvconf implementation from pkgsrc.</p>
<p>PPP users who maintain their own scripts are encouraged to try it out :)</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/tech" term="tech" label="tech" />
                            
                        
                    
                
            
        </entry>
    
        
        <entry>
            <title type="html"><![CDATA[NetBSD get getdelim(3) and getline(3)]]></title>
            <link href="https://roy.marples.name/blog/posts/netbsd_get_getdelim_3__and_getline_3_/?utm_source=atom_feed" rel="alternate" type="text/html"  hreflang="en" />
            <id>https://roy.marples.name/blog/posts/netbsd_get_getdelim_3__and_getline_3_/</id>
            
            <published>2009-07-14T07:56:00+00:00</published>
            <updated>2009-07-14T07:56:00+00:00</updated>
            
            
            <content type="html"><![CDATA[<p>Last night I added <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/getline.html">getdelim(3) and getline(3)</a> to <a href="http://www.netbsd.org">NetBSD</a>.</p>
<p>A few programs in base system needed to be changed due to having their own getline function, most of which aren&rsquo;t anything like getline(3). Hopefully there won&rsquo;t be much fallout in <a href="http://www.pkgsrc.org">pkgsrc</a> as a result.</p>
<p>getline(3) is prefered over over functions such as fgetln(3) and fgets(3) because it&rsquo;s standards based and you get a dynamic buffer for really really long lines. However, POSIX did drop the ball on making it a standard from the GNU extension- it should return 0 on EOF and more importantly be called fgetline. Oh well.</p>
<p>I shall be rolling getline(3) support into <a href="http://roy.marples.name/projects/dhcpcd">dhcpcd</a> later, but I&rsquo;ll have to do a link test in the Makefile to see if we can use it. I&rsquo;m unsure if I want to have a mini configure for dhcpcd or to keep using just make extensions &hellip;.</p>
]]></content>
            
                 
                    
                         
                        
                            
                             
                                <category scheme="https://roy.marples.name/blog/tags/netbsd" term="netbsd" label="NetBSD" />
                             
                                <category scheme="https://roy.marples.name/blog/tags/tech" term="tech" label="tech" />
                            
                        
                    
                
            
        </entry>
    
</feed>
