<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Y2k &#8211; Virtually Fun</title>
	<atom:link href="https://virtuallyfun.com/category/y2k/feed/" rel="self" type="application/rss+xml" />
	<link>https://virtuallyfun.com</link>
	<description>Fun with Virtualization</description>
	<lastBuildDate>Sun, 09 Feb 2025 15:12:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>
	<item>
		<title>Revisiting a UnixWare 7.1.1 install on Qemu/KVM</title>
		<link>https://virtuallyfun.com/2018/01/31/revisiting-a-unixware-7-1-1-install-on-qemu-kvm/</link>
					<comments>https://virtuallyfun.com/2018/01/31/revisiting-a-unixware-7-1-1-install-on-qemu-kvm/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Wed, 31 Jan 2018 09:07:31 +0000</pubDate>
				<category><![CDATA[KVM]]></category>
		<category><![CDATA[QEMU]]></category>
		<category><![CDATA[SYSV]]></category>
		<category><![CDATA[UnixWare]]></category>
		<category><![CDATA[Y2k]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=8087</guid>

					<description><![CDATA[So after nearly 8 years ago from messing around with UnixWare, I wanted to confirm something from a SYSV Unix that has a C compiler that isn&#8217;t GCC, and I remembered I have UnixWare 7.1.1 from a long time ago.  &#8230; <a href="https://virtuallyfun.com/2018/01/31/revisiting-a-unixware-7-1-1-install-on-qemu-kvm/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>So after nearly <a href="https://virtuallyfun.com/2010/08/24/unixware-7-1-1/">8 years ago from messing around with UnixWare</a>, I wanted to confirm something from a SYSV Unix that has a C compiler that isn&#8217;t GCC, and I remembered I have UnixWare 7.1.1 from a long time ago.  Anyways I have long since lost the virtual machine I had installed onto, but I still have media and of course the more important licenses.</p>
<div id="attachment_8088" style="width: 645px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2018/01/UnixWare-Business-Edition-cert.jpg"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-8088" class="wp-image-8088 size-full" src="https://virtuallyfun.com/wp-content/uploads/2018/01/UnixWare-Business-Edition-cert.jpg" alt="unixware certificate of license and authenticity" width="635" height="270" /></a><p id="caption-attachment-8088" class="wp-caption-text">UnixWare licenses. the dread of fixing things 20+ years later</p></div>
<p>Yep it&#8217;s the real thing.  So with my certs in hand I do an initial install in Qemu and on reboot the system basically has bricked itself.</p>
<p>WARNING: System is in an unreliable state.</p>
<p>And then looking at the licenses it turns out that my license has expired.  What?</p>
<p>Somehow I got lucky before, but it turns out that the installation process for ancient UnixWare is <strong>NOT Y2K compliant</strong>!  And this actually turned out to be a known issue.  I can&#8217;t find the original article, but a mirror is here: <a href="http://www.ischo.net/board_unixware/652">ischo.net</a></p>
<p>So basically install using an eval license, which will of course expire on install, and then use your actual license after the installation, remove the eval, reboot and all will be well.</p>
<p>License Number: UW711EVAL<br />
License Code: airhorpx<br />
License Data: d60;m7hjbtt</p>
<p>Now isn&#8217;t that great.</p>
<div id="attachment_8093" style="width: 812px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2018/01/Post-Install-Expired-Licenses.png"><img decoding="async" aria-describedby="caption-attachment-8093" class="size-full wp-image-8093" src="https://virtuallyfun.com/wp-content/uploads/2018/01/Post-Install-Expired-Licenses.png" alt="" width="802" height="601" /></a><p id="caption-attachment-8093" class="wp-caption-text">The OS install license immediately expires.</p></div>
<p>Although you can&#8217;t boot up in any real useful state, the networking will kick people off, and it&#8217;ll constantly complain that you are in license violation, you can at least bring up the SCO Admin tool, and add in your actual licenses, and then delete the evals.</p>
<div id="attachment_8092" style="width: 812px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2018/01/Licensed-with-my-certificates.png"><img decoding="async" aria-describedby="caption-attachment-8092" class="size-full wp-image-8092" src="https://virtuallyfun.com/wp-content/uploads/2018/01/Licensed-with-my-certificates.png" alt="" width="802" height="601" /></a><p id="caption-attachment-8092" class="wp-caption-text">And now we&#8217;re good!</p></div>
<p>Ok, now for the real fun part, flags and how to run with kvm/qemu.  Since I was loading this onto a server for remote access something like this works fine for me as I&#8217;m using the VNC remote console.</p>
<p>qemu-system-x86_64 -enable-kvm -m 1024 -smp 4 -hda UnixWare.vmdk -cpu pentium -net none -monitor telnet::444,server,nowait -curses -vnc 10.12.0.1:11 -cdrom iso/SCO_UnixWare711.iso</p>
<p>So the key things are to restrict the CPU level, and I&#8217;ve deferred the network configuration so I can update network drivers, and the OS.  I&#8217;ve found that by doing the networking during the install resulted in an OS that crashed with an integer divide by zero after installing the fixpack 5.</p>
<p><a href="https://virtuallyfun.com/wp-content/uploads/2018/01/installing-maintenance-pack-5.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-8090" src="https://virtuallyfun.com/wp-content/uploads/2018/01/installing-maintenance-pack-5.png" alt="" width="1804" height="1005" /></a></p>
<p>Once you have UnixWare 7.1.1 installed, be sure to install <a href="ftp://ftp.sco.com/pub/unixware7/uw711pk/">Maintenance Pack 5</a>, which is thankfully still online over at sco.com  I&#8217;d also recommend to do this in single user mode, you can enter single user mode by hitting a key during the boot logo and typing in:</p>
<p>INITSTATE=S<br />
boot</p>
<p>And you&#8217;ll boot in single user mode, and can install the Maintenance pack with ease.  Until the maintenance pack is installed, expect poor stability, and the system won&#8217;t actually listen to the real time clock device, and it&#8217;ll accelerate the clock like crazy where I was passing an hour every minute or two.</p>
<div id="attachment_8094" style="width: 812px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2018/01/Adding-the-AMD-PCnet-on-UnixWare.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8094" class="size-full wp-image-8094" src="https://virtuallyfun.com/wp-content/uploads/2018/01/Adding-the-AMD-PCnet-on-UnixWare.png" alt="" width="802" height="601" /></a><p id="caption-attachment-8094" class="wp-caption-text">Adding the AMD PCnet on UnixWare</p></div>
<p>Once the install and update is done, I just added a PCI network card (So older versions of Qemu work well with the ne2k_isa, but newer work much better with the AMD PCNet card.), which is a popular choice for both machines and VM&#8217;s of the era.  Although you can use SLiRP the built in NAT for Qemu/KVM alternatively you can also use tun/tap.  I tried to enable SMP, however it has issues binding to the other processors, although it does see them.  And this is better to give full access to the network stack for fun things like FTP, NFS and whatnot.</p>
<p>qemu-system-x86_64 -enable-kvm -m 1024 -smp 4 -hda UnixWare.vmdk -cpu pentium -monitor telnet::444,server,nowait -curses -vnc 10.12.0.1:11 -device pcnet,netdev=net0 -netdev tap,id=net0,ifname=tap10,script=/etc/qemu-ifup</p>
<div id="attachment_8095" style="width: 671px" class="wp-caption aligncenter"><a href="https://virtuallyfun.com/wp-content/uploads/2018/01/UnixWare-Telnet.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8095" class="size-full wp-image-8095" src="https://virtuallyfun.com/wp-content/uploads/2018/01/UnixWare-Telnet.png" alt="" width="661" height="418" /></a><p id="caption-attachment-8095" class="wp-caption-text">Telnet access</p></div>
<p>And just like that I can now access the VM.</p>
<p>And for fun&#8230;</p>
<p># uname -a<br />
UnixWare kvm711 5 7.1.1 i386 x86at SCO UNIX_SVR5<br />
# uname -f<br />
architecture=IA32<br />
bus_types=PCI2.10,ISA,PnP1.0<br />
hostname=kvm711.joes.local<br />
hw_provider=Generic AT<br />
hw_serial=DEM076116<br />
kernel_stamp=04/11/11<br />
machine=Pentium<br />
num_cg=1<br />
num_cpu=1<br />
os_base=UNIX_SVR5<br />
os_provider=SCO<br />
release=5<br />
srpc_domain=<br />
sysname=UnixWare<br />
user_limit=5<br />
version=7.1.1</p>
<p>Oh yeah so I don&#8217;t forget years from now I&#8217;m using the following OS &amp; Qemu version:</p>
<p style="padding-left: 30px;"># qemu-system-x86_64 -version<br />
QEMU emulator version 2.8.1(Debian 1:2.8+dfsg-6+deb9u3)</p>
<p style="padding-left: 30px;"># cat /etc/issue<br />
Debian GNU/Linux 9 \n \l</p>
<p>Also I found an eval serial for SMP, but it doesn&#8217;t recognize the second processor after the boot.</p>
<p># psrinfo -v<br />
Status of processor 0 as of 01/31/18 16:40:07<br />
Processor has been on-line since 01/31/18 16:13:57.<br />
The Pentium processor has a i387 floating point processor.<br />
The following conditions exist:<br />
Device drivers are bound to this processor.</p>
<p>I&#8217;ll try apparently this as for some reason it doesn&#8217;t detect the MP in Qemu/KVM so it never installed the osmp driver.</p>
<p>pkgadd -d cdrom1 osmp</p>
<p>Add the following line to the file /stand/boot:<br />
ACPI=Y</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2018/01/31/revisiting-a-unixware-7-1-1-install-on-qemu-kvm/feed/</wfw:commentRss>
			<slash:comments>8</slash:comments>
		
		
			</item>
		<item>
		<title>Date and Time on UNIX V7</title>
		<link>https://virtuallyfun.com/2018/01/28/date-and-time-on-unix-v7/</link>
					<comments>https://virtuallyfun.com/2018/01/28/date-and-time-on-unix-v7/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sun, 28 Jan 2018 01:01:38 +0000</pubDate>
				<category><![CDATA[2038]]></category>
		<category><![CDATA[AT&T Unix]]></category>
		<category><![CDATA[guest post]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[Y2k]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=8085</guid>

					<description><![CDATA[(This is a guest post by xorhash.) Introduction I&#8217;ve recently defeated one of my bigger inconveniences, broken DEL as backspace on the UNIXÂ®â€  operating system, Seventh Edition (commonly known as UNIX V7 or just V7). However, I&#8217;ve had another pet &#8230; <a href="https://virtuallyfun.com/2018/01/28/date-and-time-on-unix-v7/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><em>(This is a guest post by <a href="https://twitter.com/xorhash">xorhash</a>.)</em></p>
<h1>Introduction</h1>
<p>I&#8217;ve recently defeated <a href="https://virtuallyfun.com/2018/01/17/teaching_an_almost_40-year_old_unix_about_backspace/">one of my bigger inconveniences, broken DEL as backspace</a> on the UNIXÂ®â€  operating system, Seventh Edition (commonly known as UNIX V7 or just V7). However, I&#8217;ve had another pet peeve for a while: How much manual labor is involved in booting the system. Reader DOS <a href="https://virtuallyfun.com/2018/01/17/teaching_an_almost_40-year_old_unix_about_backspace/comment-page-1/#comment-190861">found out</a> that SIMH recently added support for <code>SEND</code>/<code>EXPECT</code> pairs to react to output from the simulator. Think of them like UUCP chat scripts, effectively. This can be used to automate the bootup procedure.</p>
<p>Yet DOS&#8217;s script skips over a part of the bootup procedure that can be fully automated with some additional tooling. Namely, setting the date/time to the current time as defined by the host system. As per <a href="https://man.openbsd.org/UNIX-7/boot.8">boot(8)</a>, the operator is meant to set the date/time every time the system is brought up. This should be possible to automate, right?</p>
<h1>Setting the Date Automatically</h1>
<p>date(1) itself does not support setting years past 2000, so we need custom code in any case. SIMH, fortunately, also provides a way to get the current timestamp in the form of %UTIME%, which is interpreted in any argument to any command. I&#8217;ve thus written a utility called <strong>tsdate</strong> that takes a timestamp as argument and sets the current time to be that timestamp. I put the executable in <code>/etc/tsdate</code>, but there&#8217;s really no reason to do so other than not wanting to accidentally call it. Once tsdate is in place, changing <a href="https://virtuallyfun.com/2018/01/17/teaching_an_almost_40-year_old_unix_about_backspace/comment-page-1/#comment-190861">DOS&#8217;s script</a> slightly will already do the trick:</p>
<p><code>expect "\n\r# " send "/etc/tsdate %UTIME%\r\004"; c</code></p>
<p>This approach already has a minor amount of time drift ab initio, namely the difference between the actual time on the host system and the UNIX timestamp. In the worst case, this may be very close to 1. If for some reason you need higher accuracy than this, you&#8217;ll probably have a fairly hard time. I could imagine some kind of NTP-over-serial, but you&#8217;d need support for chat scripts to get past the authentication due to getty(8) spawning login(1).</p>
<p>The system is <em>not</em> suitable for usage past the year 2038. However, you can at least push it back until around 2100 by changing the internal representation of time to be an <code>unsigned long</code> instead of simply a <code>long</code>. <code>time_t</code> was not used systematically. Instead, everything assumed <code>long</code> as the type for times. This assumption is in a lot of places in userspace and even the man pages use <code>long</code> instead of <code>time_t</code>.</p>
<p>If you overflow tsdate&#8217;s timestamp, you&#8217;ll just get whatever happens when atol(3) overflows. There&#8217;s nothing in the standard library for parsing strings into <code>unsigned long</code> and the year 2038 is far enough away that I didn&#8217;t want to bother. stime(2) would presumably also need to be adjusted.</p>
<h1>Year 2000 Compatibility in the System</h1>
<p>V7 is surprisingly good at handling years past 2000. Most utilities can print years up to and including 2099 properly. Macros for nroff(1)/troff(1), however, are blissfully unaware that years past 1999 may exist. This causes man pages to be supposedly printed in the year 19118. The root cause for this is that the number register <code>yr</code> only holds the current year minus 1900. Patches to the <code>-ms</code> and <code>-man</code> macros are required. Similarly, refer(1) only considers years until 2000 to be actual years, though I did not bother patching that since it should only affect keyword matching.</p>
<p>Leap year handling is broken in two different places due to wrong <a href="https://en.wikipedia.org/wiki/Leap_year">leap year</a> handling: at(1) and the undocumented dysize() function, used by date(1) as well as inside <code>/usr/src/libc/gen/ctime.c</code> for various purposes. This affects the standard library, so recompiling the entire userland is recommended. Because the calculation is just a naÃ¯ve division by four, it actually works on the year 2000 itself. A year is a leap year, i.e. has February 29, if a year is:</p>
<ol>
<li>a multiple of 4, and</li>
<li>
<ol>
<li>not a multiple of 100, or</li>
<li>a multiple of 400.</li>
</ol>
</li>
</ol>
<p><a href="https://en.wikipedia.org/wiki/Leap_second">Leap seconds</a> are also not accounted for, but that comes to nobody&#8217;s surprise. Leap seconds just add a second 60 to the usual 00-59, so they don&#8217;t hurt doing date calculations on timestamps unless precisely on a leap second. For my purposes, they can be ignored.</p>
<p>Note that I haven&#8217;t gone through the system with a fine-toothed comb. There can always be more subtle time/date issues remaining in the system. For my purposes, this works well enough. If other things crop up, you&#8217;re welcome to put them in the comments for future generations.</p>
<h1>The Good Stuff</h1>
<p>There&#8217;s really not much to it. Applying diff and recompilation of the affected parts is left as an exercise for the reader.</p>
<p>Files:</p>
<ol>
<li><a href="https://virtuallyfun.com/xorhash/tsdate.c">tsdate.c</a></li>
<li><a href="https://virtuallyfun.com/xorhash/tsdate.1m">tsdate.1m</a></li>
<li><a href="https://virtuallyfun.com/xorhash/y2kpatches.diff">y2kpatches.diff</a></li>
</ol>
<p style="font-size: smaller;">â€ Â UNIX is a trademark of The Open Group.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2018/01/28/date-and-time-on-unix-v7/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>OpenBSD 5.5 released!</title>
		<link>https://virtuallyfun.com/2014/05/02/openbsd-5-5-released/</link>
					<comments>https://virtuallyfun.com/2014/05/02/openbsd-5-5-released/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Fri, 02 May 2014 05:20:22 +0000</pubDate>
				<category><![CDATA[2038]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[Y2k]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=4049</guid>

					<description><![CDATA[OpenBSD 5.5 was just released! And in case you don&#8217;t get the DeLoreanÂ reference, this release focuses on fixing the 2038 issue! From the change list: time_t is now 64 bits on all platforms. From OpenBSD 5.5 onwards, OpenBSD is year &#8230; <a href="https://virtuallyfun.com/2014/05/02/openbsd-5-5-released/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<div id="attachment_4050" style="width: 237px" class="wp-caption alignleft"><a href="https://virtuallyfun.com/wp-content/uploads/2014/05/McFishy.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4050" class="size-full wp-image-4050" src="https://virtuallyfun.com/wp-content/uploads/2014/05/McFishy.jpg" alt="McFishy" width="227" height="343" /></a><p id="caption-attachment-4050" class="wp-caption-text">McFishy</p></div>
<p>OpenBSD 5.5 was just released! And in case you don&#8217;t get the <a href="http://en.wikipedia.org/wiki/DeLorean_DMC-12">DeLorean</a>Â reference, this release focuses on fixing <a href="https://virtuallyfun.com/?p=188">the 2038 issue</a>!</p>
<p>From <a href="http://www.openbsd.org/55.html">the change list</a>:</p>
<ul style="color: #000000;">
<li>time_t is now 64 bits on all platforms.
<ul>
<li>From OpenBSD 5.5 onwards, OpenBSD is year 2038 ready and will run well beyond Tue Jan 19 03:14:07 2038 UTC.</li>
<li>The entire source tree (kernel, libraries, and userland programs) has been carefully and comprehensively audited to support 64-bit time_t.</li>
<li>Userland programs that were changed includeÂ <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=arp&amp;sektion=8">arp(8)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=bgpd&amp;sektion=8">bgpd(8)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=calendar&amp;sektion=8">calendar(8)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=cron&amp;sektion=8">cron(8)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=find&amp;sektion=1">find(1)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=fsck_ffs&amp;sektion=8">fsck_ffs(8)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ifconfig&amp;sektion=8">ifconfig(8)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ksh&amp;sektion=1">ksh(1)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ld&amp;sektion=1">ld(1)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ld.so&amp;sektion=1">ld.so(1)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=netstat&amp;sektion=1">netstat(1)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pfctl&amp;sektion=8">pfctl(8)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ping&amp;sektion=8">ping(8)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=rtadvd&amp;sektion=8">rtadvd(8)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ssh&amp;sektion=1">ssh(1)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=tar&amp;sektion=1">tar(1)</a>,<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=tmux&amp;sektion=1">tmux(1)</a>,Â <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=top&amp;sektion=1">top(1)</a>, and many others, including games!</li>
<li>Removed time_t from network, on-disk, and database formats.</li>
<li>Removed as many (time_t) casts as possible.</li>
<li>Format strings were converted to use %lld and (long long) casts.</li>
<li>Uses of timeval were converted to timespec where possible.</li>
<li>Parts of the system that could not use 64-bit time_t were converted to use unsigned 32-bit instead, so they are good till the year 2106.</li>
<li>Numerous ports throughout the ports tree received time_t fixes.</li>
</ul>
</li>
</ul>
<p>Wow, that&#8217;s pretty cool!</p>
<p>And of course for VMware users:</p>
<ul style="color: #000000;">
<li>NewÂ <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=vmx&amp;sektion=4">vmx(4)</a>Â driver for VMware VMXNET3 Virtual Interface Controller devices.</li>
<li>NewÂ <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=vmwpvs&amp;sektion=4">vmwpvs(4)</a>Â driver for VMware Paravirtual SCSI.</li>
<li>NewÂ <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=vioscsi&amp;sektion=4">vioscsi(4)</a>Â driver for VirtIO SCSI adapters.</li>
<li>NewÂ <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=viornd&amp;sektion=4">viornd(4)</a>Â driver for VirtIO random number devices.</li>
</ul>
<p>In addition the new <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=vxlan&amp;sektion=4">vxlan</a> driver looks pretty interesting too!</p>
<p>As always get your copy from one of the many <a href="http://www.openbsd.org/ftp.html#http">HTTP mirrors</a>, and why not support the project with the <a href="http://www.openbsd.org/orders.html">purchase of a CD or poster</a>?</p>
<div id="attachment_4051" style="width: 609px" class="wp-caption aligncenter"><a href="http://www.openbsd.org/"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4051" class="wp-image-4051 size-full" src="https://virtuallyfun.com/wp-content/uploads/2014/05/puffy55.gif" alt="free. functional and secure..." width="599" height="199" /></a><p id="caption-attachment-4051" class="wp-caption-text">free. functional and secure&#8230;</p></div>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2014/05/02/openbsd-5-5-released/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>The 2038 &#8216;problem&#8217;.</title>
		<link>https://virtuallyfun.com/2010/01/02/the-2038-problem/</link>
					<comments>https://virtuallyfun.com/2010/01/02/the-2038-problem/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sat, 02 Jan 2010 05:29:00 +0000</pubDate>
				<category><![CDATA[2038]]></category>
		<category><![CDATA[4.3 BSD]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[Y2k]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=188</guid>

					<description><![CDATA[Eventually you will start to hear about the 2038 problem regarding UNIX, and the C language. Looking at the 4.3 BSD source, the problem is pretty simple. The time_t value holds the number of &#8216;ticks&#8217; since new years, 1970. It&#8217;s &#8230; <a href="https://virtuallyfun.com/2010/01/02/the-2038-problem/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>Eventually you will start to hear about the 2038 problem regarding UNIX, and the C language.  Looking at the 4.3 BSD source, the problem is pretty simple.</p>
<p>The time_t value holds the number of &#8216;ticks&#8217; since new years, 1970.  It&#8217;s a signed long, that can hold a maximum value of 2147483648.  This will set you into the year 2038.  There is some great detail on the site <a href="http://www.2038bug.com/">2038bug.com</a> .  Naturally the easiest option here, is to simply change it from a signed long to an unsigned long.  This will let us use a maximum value of 4294967296, which translates to the date Sun Feb  6 06:28:15 2106.</p>
<p>While this is not a &#8220;perfect&#8221; solution for some people, this works great on platforms that are not built with compilers that can understand 64bit &#8220;long longs&#8221;.  Not to mention that constantly updating a pseudo long long could have negative implications in the kernel&#8230;.</p>
<p>The bottom line is that eventually we need to move away from 32bit platforms, and with some programs that try to look 30+ years into the future, the time is NOW.  But just because you are on a 64bit UNIX doesn&#8217;t mean the date isn&#8217;t being kept in a 32bit signed value for &#8216;compatibility&#8217;&#8230;</p>
<p>To test the idea, I&#8217;ve taken the 4.3 UWisc BSD from my project <a href="http://sourceforge.net/projects/bsd42/">here</a>, and gone about making some changes.</p>
<p>Starting with the file /usr/sys/h/types.h</p>
<blockquote><p>myname# diff -r types.h x<br />47c47<br />< typedef       long    time_t;<br />&#8212;<br />> typedef       unsigned long   time_t;</p></blockquote>
<p>Very simple, right?  The kernel has it&#8217;s own version of this file, /usr/sys/h/types.h , and will require the same fix.</p>
<p></p>
<blockquote><p>myname# diff -r types.h x<br />47c47<br />< typedef       long    time_t;<br />&#8212;<br />> typedef       unsigned long   time_t;</p></blockquote>
<p>Now with that out of the way, the next thing to do is patch some of the functions in libc.</p>
<p>/usr/src/lib/libc/gen/time.c</p>
<blockquote><p>myname# diff time.c /time.c<br />25c25<br />< long<br />&#8212;<br />> unsigned long</p></blockquote>
<p>/usr/src/lib/libc/gen/ctime.c</p>
<blockquote><p>myname# diff ctime.c /ctime.c<br />248c248<br /><       long hms, day;<br />&#8212;<br />>       unsigned long hms, day;</p></blockquote>
<p>Ok, that&#8217;s the bulk of the changes.  Really.</p>
<p>Rebuild the kernel &#038; libc, and install them.</p>
<blockquote><p>cd /usr/sys/GENERIC<br />make clean<br />make<br />cp vmunix /</p>
<p>cd /usr/src/lib/libc<br />make<br />cp libc.a /lib<br />cp libc_p.a /usr/lib<br />ranlib /lib/libc.a<br />ranlib /usr/lib/libc_p.a</p></blockquote>
<p>Now with that out of the way, reboot the VM.</p>
<p>So far everything should behave normally.  But it&#8217;s time for some fun!</p>
<p>First, let&#8217;s make sure we can use dates beyond the 2038 bug date.  This program comes from the aforementioned <a href="http://www.2038bug.com/">2038bug.com</a> site.  I&#8217;ve just added one header needed by 4.3 BSD to get the time_t structure called in correctly.</p>
<blockquote><p>#include &lt;stdlib.h><br />#include &lt;stdio.h><br />#include &lt;unistd.h><br />#include &lt;time.h><br />#include &lt;sys/types.h></p>
<p>int main (int argc, char **argv)<br />{<br />    time_t t;<br />    t = (time_t) 1000000000;<br />    printf (&#8220;%d, %s&#8221;, (int) t, asctime (gmtime (&#038;t)));<br />    t = (time_t) (0x7FFFFFFF);<br />    printf (&#8220;%d, %s&#8221;, (int) t, asctime (gmtime (&#038;t)));<br />    t++;<br />    printf (&#8220;%u, %s&#8221;, (unsigned int) t, asctime (gmtime (&#038;t)));<br />    return 0;<br />}</p></blockquote>
<p>Now when I run it I get this:</p>
<blockquote><p>myname# gcc 2038.c;./2038<br />1000000000, Sun Sep  9 01:46:40 2001<br />2147483647, Tue Jan 19 03:14:07 2038<br />2147483648, Tue Jan 19 03:14:08 2038</p></blockquote>
<p>Notice that it works!</p>
<p>Unfortunately the date command in BSD (well just any 32v derived UNIX) is set to handle two digit years.  So what I&#8217;ve done is to &#8216;fix&#8217; date to handle four digit years.  So here is the diff:</p>
<blockquote><p>myname# diff date.c date4year.c<br />94c94<br />< long  time();<br />&#8212;<br />> unsigned long time();<br />160c160<br /><               tv.tv_sec += (long)tz.tz_minuteswest*60;<br />&#8212;<br />>               tv.tv_sec += (unsigned long)tz.tz_minuteswest*60;<br />167c167<br /><<br />&#8212;<br />>               /*printf(&#8220;setting time&#8230;.&#8221;);*/<br />228c228,229<br /><       year = gp(L->tm_year);<br />&#8212;<br />>       year = gp2(L->tm_year);<br />>       /*printf(&#8220;gtime year %d\n&#8221;,year);*/<br />243c244,246<br /><       year += 1900;<br />&#8212;<br />>       /*year += 1900;<br />>       no more 2 year dates!<br />>       */<br />270a274,292<br />> gp2(dfault)<br />> {<br />>     int c, d,e,f;<br />><br />>       if (*sp == 0)<br />>               return (dfault);<br />>       c = (*sp++) &#8211; &#8216;0&#8217;;<br />>       d = (*sp ? (*sp++) &#8211; &#8216;0&#8217; : 0);<br />>       e = (*sp ? (*sp++) &#8211; &#8216;0&#8217; : 0);<br />>       f = (*sp ? (*sp++) &#8211; &#8216;0&#8217; : 0);<br />>       /*printf(&#8220;c %d d %d e %d f %d\n&#8221;,c,d,e,f);*/<br />><br />>       if (c &lt; 0 || c > 9 || d &lt; 0 || d > 9)<br />>               return (-1);<br />>       if (e &lt; 0 || e > 9 || f &lt; 0 || f > 9)<br />>               return (-1);<br />>       return ((f*1000)+(e*100)+(d*10)+c);<br />> }<br />><br />293c315<br /><       long waittime;<br />&#8212;<br />>       unsigned long waittime;</p></blockquote>
<p>Now I can set the time like this:</p>
<blockquote><p>myname# ./date 201001021208<br />Sat Jan  2 12:08:00 PST 2010<br />myname# ./date<br />Sat Jan  2 12:08:01 PST 2010</p></blockquote>
<p>And all is well.</p>
<p>So let&#8217;s take it to 2040!</p>
<blockquote><p>myname# ./date 204001011433<br />Sun Jan  1 14:33:00 PST 2040<br />myname# ./date<br />Sun Jan  1 14:33:02 PST 2040</p></blockquote>
<p>And there we have it!</p>
<p>The old date command would return Thu Nov 26 08:04:46 PST 1903, which is slightly wrong!</p>
<p>Naturally EVERY program that calls time/date stuff will have to be checked to be fully 2038 vetted, but you get the idea.  The major offender in the date command is the idea of adding 1900 to the date, which is not needed when you specify the full year.</p>
<p>While this 2038 solution is simple, it still requires people to start to take action.  It seems the industry is not moving yet, but it&#8217;ll certainly require source code access to make it quick &#038; easy&#8230;  But I&#8217;m sure like the Y2k issue, people will wait until 2036, and by then there&#8217;ll be good money in programs that can decompile various UNIX binaries, and change that signed long value&#8230; The &#8216;issue&#8217; is the other fallout like the slight change I had to make to the 2038 test program&#8230;.</p>
<p>Always remember to keep your source SAFE!</p>
<p>Oh, and happy new years!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2010/01/02/the-2038-problem/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
