For 64-bit architectures, the a.out header has the HDR_MAGIC flag set
in the magic and is expanded by 8 bytes containing the 64-bit virtual
address of the programs entry point. While Exec.entry contains physical
address for kernel images.
Our sysexec() would always use Exec.entry, even for 64-bit a.out binaries,
which worked because PADDR(entry) == entry for userspace pointers.
This change fixes it, having the kernel use the 64-bit entry point
and document the behaviour in the manpage.
games/dmid uses the same sample rate as the chip for music, but other
applications do not. opl3 and its older version opl2 (not in 9front)
read an input stream of commands in basically IMF format, something
used in other id Software games and some others, which assumes a
given input sampling rate: 700 Hz for Wolfenstein 3D music, 560 Hz
for Commander Keen, 60 Hz for Ultima 6, etc.
The opl3 emulation on the other hand is not really intended to run at
a sampling rate different that the chip's 49.716 kHz sampling rate.
Previously, we assumed it runs at 44.1 kHz and just used the input
rate as a divisor to get the number of samples per delay tic.
From what I understand, the correct way to use it for accurate
emulation is to run the opl chip emulator at its intended sampling
frequency, then downsample to 44.1 kHz. This means better output
but more code. The alternative is to basically do the same as
before rev 8433, except with no buffering, but at accuracy/quality
loss. This change implements the former and just forks pcmconv to
deal with resampling.
Now that we have these new functions,
we can also make them return an error
instead of calling sysfatal() like
postmountsrv().
Remove the confusing Srv.srvfd, as it
is only temporarily used and return
it from postsrv() instead.
To use srvrease()/srvaquire() we need to have a way to spawn
new processes to handle the service loop. This functionality
was provided by the internal _forker() function which was
eigther rfork or libthread based implementation depending on
if postmountsrv() or threadpostmountsrv() where called.
For servers who want to use srv() directly, _forker would not
be initialized so srvrelease() could not be used.
To untangle this, we get rid of the global _forker handler
and put the handler in the Srv structure. Which will get
initialized (when nil) to eigther srvforker() or threadsrvforker()
depending on if the thread or non-thread entry points where used.
For symmetry, we provde new threadsrv() and threadpostsrv()
functions which handle the default initialization of Srv.forker.
This also allows a user to provide his own forker function,
maybe to conserve stack space.
To avoid dead code, we put each of these function in their
own object file. Note, this also allows a user to define its
own srvforker() symbol.
this fixes real-time applications.
-n previously specified a rate divisor rather than the rate itself,
which was used for specific applications outside of 9front. instead,
just set the rate directly, more useful and straightforward.
This patch adds dirmodefmt from fcall.h to pretty-print file
permissions, similarly to ls -l. I didn't notice any performance
degradation.
I hope no-one relied on the old behaviour.
i have found one bug. when i put glenda in a position like this
i somehow win, but the glenda can escape from there.
in addition, i have changed the games manpage to include more info about glendy.
tftpd currently unconditionally sets its namespace via /lib/namespace
(newns("none", nil)), which stymied my attempts to pxe boot the
openbsd installer without creating a real /etc dir on 9front, which
would've been gross.
I tried working around this with -h (and -r for good measure), but
again hit issues because the namespace is rebuilt from scratch -- any
binds of /386, /amd64, /cfg/pxe, etc. into the tftp-specific directory
disappeared from tftpd's namespace and rendered my *9front* boxes
unable to boot. I could maintain copies of the needed files in the
tftp-specific directory, but that'd be kind of a drag.
The following patch adds a -n flag to allow the specification of a
namespace file in place of /lib/namespace; similar to ip/ftpd.
I thought about setting up a /lib/namespace.tftp to act as a default
rather than continuing to use /lib/namespace by default (which
security-wise is about the same as allowing 9p mounts by user none,
which I also have disabled), but I had trouble coming up with a sane
default. Maybe someone more experienced would like to try that out.
- sam-d
* Add the %ll length modifier,
* Convert nil to "<nil>" under %s (not in APE),
* Cast void* to uintptr under %p,
* Use "0x" hex prefix under %p,
* Fix manual page mentions of %P to %p,
* Fix empty result for fp conversions,
* Fix zero padding of left-aligned fp conversions,
* Remove deprecated #pragma ref uses.
Most of these were introduced in APE prior to 9front.
I've omitted the %z conversion specifier since Plan 9 code
rarely uses the usize type. This may need to be added later
for the benefit of native ports of alien code.
The old parser code was rubbish and only worked for trivial
expressions. The new code properly handles complex expressions,
including short circuit evaluation.
As such, the BUGS section has been removed from the test(1) man page.
The description of an unimplemented feature has also been removed.
When running a mail queue, it's useful to run it with limited
parallelism. This helps mailing lists process messages in a
reasonable time.
At the same time, we can remove the load balancing from runq,
since the kinds of systems that this matters on no longer
exist, and running multiple queues at once can be better
done through xargs.
Passwd used to produce a very confusing error
about DES not being enabled whenever the password
was mistyped. This happened because we attempted
to guess what authentication method to use, and
preseneted the error from the wrong one on failure.
This puts the legacy mode behind a flag, so that
we don't even try the old method unless it's
explicitly requested.
Tilting allows using left/right rotated or invetrted display orientation.
This can be changed at runtime such as: echo tilt right > /dev/vgactl
This removes the old panning and vga overlays as they are only implemented
with some ancient vga controllers.
The idea is to avoid the magic files that contain
per process information in devcons when possible.
It will make it easier to deprecate them in the future.
Provide a central function to change the user id
of the calling process.
This is mostly used by programs to become the none
user, followed by a call to newns().
hget supports adding custom headers with -r;
it makes sense for hpost to do the same, both
because custom headers are more likely necessary
with POSTs, and for consistency.
The initial protocol handling in exportfs for
cpu and import services is a huge mess.
Saparate the code out into its own program with
its own oexportfs(4) manpage.
The OCEXEC flag used to be maintained per channel,
making it shared between all the file desciptors.
This has a unexpected side effects with regard to
channel passing drivers such as devdup (/fd),
devsrv (/srv) and devshr (/shr).
For example, opening a /srv file with OCEXEC
makes it impossible to be remounted by exportfs
as it internally does a exec() to mount and
re-export it. There is no way to reset the flag.
This change makes the OCEXEC flag per file descriptor,
so a open with the OCEXEC flag only affects the fd
group of the calling process, and not the channel
itself.
On rfork(RFFDG), the per file descriptor flags get
copied.
On dup(), the per file descriptor flags are reset.
The second modification is that /fd, /srv and /shr
should reject the ORCLOSE flag, as the files that
are returned have already been opend.
The -v flag now does not create a new rio window,
while -w flag does (restores the old behaviour).
This allows vmx to run under vncs and is in general
mode aligned to other emulators and programs.
Initially the code tried to guess the date format. This
turned out to be a bit too magical, so the feature was
removed, but the manpage still documented the nonfeature.
Upas/marshal -F was broken with the '-8' command, and silly
without it: It used aliases passed on the command line, so
the destination address was ignored with -8 was passed.
In addition, it would create a new mailbox for any aliases
being sent to, instead of putting them all in one location.
The new -S option is similar to -F, but specifies where the
message should go.
Ignoring '?' when formatting date strings allows
the format strings to be reused for parsing. This
is convenient, since we don't need to duplicate
the format strings.
The format produced by `diff -u` is inferior to that
produced by `diff -c`, but it's what ape/patch and
unix patch expect, so it's useful to generate it.
This patch adds `diff -u`.
Following is a list of functional changes:
* The -o flag outputs the entire buffer to the length returned
by the syscall, or, in case of fd2path(2) and errstr(2), to '\0'.
* The -x flag is removed; the above makes it possible to pipe
into xd(1) to get the same result.
* The -s flag uses dirfmt(2) to format the stat message, instead
of trying to imitate ls(1).
* Stderr reports are normalized and made easier to parse.
The code also suffered a number of stylistic changes.
There were a number of ideas that were tried out as the tmdate
api evolved. As a result, there were some references in the
manpage to things that are no more.
Fix them.
Ctime is defined as printing a 3-character timezone
name. The timezone name is ambiguous. For example,
EST refers to both Australian and American eastern
time. On top of that, we don't want to make the
tzabbrev table exhaustive. So, we put in this hack:
Before we consult the well known table of timezones,
we check if the local time matches the timezone name.
On top of that, tm2sec
If you want unambiguous timezone parsing, use numeric
timezone offsets (Z, ZZ formats).
We almost always want to skip leading whitespace in time
formats, so make tmparse just do it. This fixes upas mbox
parsing, which leaves a leading whitespace at the start of
the date.
The current date and time APIs on Plan 9 are not good. They're
inflexible, non-threadsafe, and don't expose timezone information.
This commit adds new time APIs that allow parsing arbitrary
dates, work from multiple threads, and can handle timezones
effectively.
this breaks the sample from the seconds manpage, and overall
produces funky results. this needs alot more testing.
term% seconds '23 may 2011'
seconds: tmparse: invalid date 23 may 2011 near 'may 2011'
term% seconds '2019-01-01 00:00:00'
-118370073600
Redo date handling in libc almost entirely. This allows
handling dates and times from outside your timezones,
fixes timezone loading in multithreaded applications,
and allows parsing and formatting using custom format
strings.
As a test of the APIs, we replace the formatting code in
seconds(1), shrinking it massively.
The last commit missed a few removals, and made it
unnecessarily hard to do an update.
Redo date handling in libc almost entirely. This allows
handling dates and times from outside your timezones,
fixes timezone loading in multithreaded applications,
and allows parsing and formatting using custom format
strings.
As a test of the APIs, we replace the formatting code in
seconds(1), shrinking it massively.
Added a ver= field to the filter to distinguish the ip version.
By default, a filter is parsed as ipv6, and after parsing
proto, src and dst fields are converted to ipv4. When no
ver= field is specified, a ip version filter is implicitely
added and both protocols are parsed.
This change also gets rid of the fast compare types as the
filed might not be aligned correctly in the packet.
This also fixes the ifc= filter, as we have to check any
local address.
The new command marks the target window as a scratch window -- a window
whose state cannot be "dirtied" by changes made to its body, therefore
avoiding warnings about unsaved changes when deleting the window or
exiting acme.
Existing examples of scratch windows are error, directory, and guide
windows, whose scratchness is set internally.
With the new command users and programs alike can create their own
scratch windows. This is put to use in acme's own win(1).
This makes the flagfmt parser more robust and accepting
a looser input language — namely by allowing whitespace
around specifier fields and ignoring any empty fields.
Long flagfmts can thus be pleasingly displayed:
flagfmt='
a, b, c, C:cache,
m:mtpt mountpoint,
s:srvn srvname'
Fix inconsistencies between programs and their usage
messages, correct instances where information seems
to be missing or lost. This includes missing arguments,
making usage consistent with manuals, and so on.
with the latest changes to shr(3), we can use ORCLOSE on
the control file to get the mount in the share automatically
removed when the server exits or something goes wrong during
postsharesrv().
do not expose postfd() and sharefd() functions. they where
undocumented and leak the control file descriptors.
with the -s flag, we should read 9P messages from
standard *INPUT* (fd 0) and write responses to
standard *OUTPUT* (fd 1).
before these servers where reading from fd 1,
assuming they where both the same files.
it is unclear how Srv.nopipe flag should work inside
postmountserv(). if a server wants to serve on stdio
descriptors, he can just call srv() after initializing
Srv.infd and Srv.outfd.
The Srv.leavefdsopen hack can be removed now that acme
win has been fixed.
the console command runs a command or the system shell under
a new instance of kbdfs, optionally providing a serial console
when $console environment variable is set.
this is a reimplementation of infernos os(1) command, which
allows running commands in the underhying host operating
system when inferno runs in hosted mode (emu). but unlike
inferno, we want to use it to run commands on the client
side of a inferno or drawterm session from the plan9 cpu
server, so it defaults to /mnt/term/cmd for the mountpoint.
kvik writes:
I needed to convert the RSA private key that was laying around in
secstore into a format understood by UNIX® tools like SSH.
With asn12rsa(8) we can go from the ASN.1/DER to Plan 9 format, but not
back - so I wrote the libsec function asn1encodeRSApriv(2) and used it in
rsa2asn1(8) by adding the -a flag which causes the full private key to be
encoded and output.
C99 comments have been the default in compilers for something like 20 years
now. This means we don't need to remember to turn it on when porting software,
and gets rid of cryptic errors about unterminated character constants when
someone writes something like:
// Didn't need to...
We still accept the flag to avoid breaking mkfiles, but we do nothing with it.
This also removes the documentation, since the option does nothing now.