It doesn't work. It's undefined behaviour. On NetBSD, it will fail
with EBADF, if fd 0 isn't open for write, or if fd 0 is open for
write, it will write heap garbage to fd 0.
If stream points to an output stream or an update stream in which
the most recent operation was not input, the fflush function causes
any unwritten data for that stream to be delivered to the host
environment to be written to the file; otherwise, the behavior is
undefined.
(ISO C11 and ISO C17, Sec. 7.21.5.2 `The fflush function')
PR lib/58206
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114879
Rather than play games with adding .DOTLAST and then having to
exclude that from .SYSPATH, just have Dir_FindFile check if
path is sysIncPath or defSysIncPath and behave as if .DOTLAST seen
and also skip the final search of .CURDIR.
Fix Dir_SetSYSPATH to use defSysIncPath if sysIncPath is empty.
- include now properly updated cd9660_extern.h for function prototypes
and remove them from local installboot.h
- use ISO_MAXNAMLEN rather than (BSD specific and incorrect) MAXNAMLEN
- use proper names for the secondary boot file
- appease several pointer signedness warnings (not fatal on HOST tools)
Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.
HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.
Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.
On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.
Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.
a little:
- Define _UC_MD_BIT* constants for the available machine-dependent bits,
and use those constants to define the machine-dependent bits as well
as the machine-independent bits that have machine-dependent values.
- Explicitly generate an error if _UC_TLSBASE, _UC_SETSTACK, or
_UC_CLRSTACK are not defined by <machine/mcontext.h>.
newterm() argument is const in the spec, so this fixes our
conformance.
setterm() is not in the spec, but it's natural and in ncurses its
argument is const too, so follow suit.
Doesn't change the ABI, so no bump required.
ok blymn@