putchar_unlocked(), putc_unlocked(), feof_unlocked(), ferror_unlocked(),
clearerr_unlocked(), and fileno_unlocked(). The first four are required
by POSIX. The rest are provided for consistency.
because we have 2 stacks per thread: the regular downward
memory stack and the irregular upward register stack. This
implementation lets both stacks grow toward each other. An
alternative scheme is to have them grow away from each other.
The alternate scheme has the advantage that both stack grow
toward guard pages. Since libc_r is virtually dead and we
really want the *context stuff for thread switching, we don't
try to be perfect, just functional.
instead of unwinding the call stack. This makes them usable to switch
stacks, e.g. for libc_r.
Do not save the frame pointer in setjmp() and _setjmp(), it is not needed
any more.
Rename _longjmp() to ___longjmp(), with a weak alias to _longjmp(), like
the other architectures did.
o Call waitpid() if an error occurs after forking the child process
to avoid leaving zombies around.
o Handle the WRDE_DOOFS|WRDE_APPEND combination correctly
o Do not confuse $( substitution with $(( shell arithmetic
(noticed by wollman)
o Handle backslash escaping properly
o Allow $( and ${ to be quoted
As a side effect, it makes the code easier to read and requires less
pointer arithmetic.
Test by: strerror regression test
Submitted by: Tim Kientzle <kientzle@acm.org>
when the same pipe FILE is pclosed()'d in different threads, and to avoid
corrupting the linked list when adding or removing items. The symptoms of
the linked list getting corrupted were pclose() either not finding the pipe
on the list, or the list becoming circular and pclose() looping infinitely.
to Solaris, it is in /usr/libexec) to perform the handing over of tty nodes
to the user being granted the pty.
Submitted by: Ryan Younce <ryany@pobox.com>
Reviewed by: security-officer@, standards@, mike@
This situation most notably arises in chkprintcap, when a /etc/printcap
entry has an empty rp= attribute. In that case, cgetmatch would enter
an infinite loop if any entry in the file has multiple names.
This causes lpd to hang at boot time on 5.0-DP2 when both conditions
are met (:rp=: and multiple names -- not necessarily on the same entry).
Reviewed by: roberto
a pointer and lack a prototype will have the return value (assumed
to be an integer) zero-extended to a pointer. On ia64 this is
unconditionally fatal as it zeroes-out the region bits, forming an
invalid pointer. Fix the sigsegv by including <stdlib.h>.
Pointy hat: bbraun
the -fpcc-struct-return calling convention properly instead of
returning garbage. This may break backwards compatibility with some old
binaries that were compiled when -fno-pcc-struct-return was the default.
o Fix an English error (comma splice) and poorly worded sentence.
o Fix KNF ordering of variables (pointers come before arithmetic types).
o Restore hand-optimization of sizeof()-1, instead of strlen().
o Remove unneeded local variables in strerror_r().
Test by: strerror regression test
Requested by: bde
Reviewed by: bde
strerror_r(). Doing this allows us to ensure that strerror_r() always
fills the supplied buffer regardless of EINVAL or ERANGE errors.
strerror()'s semantics have changed slightly such that an argument of
0 is now considered invalid and errno is set to EINVAL.
Remove internal regression test for strerror() and strerror_r(). This
will be reincarnated in src/tools/regression/lib/libc/string.
In strerror(3), add a comment about strerror()'s bogus return type.
PR: 44356
Stop calling system calls "function calls".
Use "The .Fn system call" a-la "The .Nm utility".
When referring to a non-BSD implementation in
the HISTORY section, call syscall a function,
to be safe.
from "unix" back to "local". Add some compat stuff so both
ways work for some time.
Reviewed by: phk
Approved by: imp (UPDATING)
Requested by: iedowse, lukem@netbsd.org
to be cleaner. Also, when deleting a chunk, try to find the mother chunk
as a whole chunk by default if this isn't a BSD partition or a unused or
whole chunk. Before we just did this for FreeBSD and FAT slices, which
means that other chunk types such as EFI and mbr (mbr is used for slices
that don't have their own chunk type).
Submitted by: nyan (mostly)
Approved by: re
when trying to store the year in a signed int. The maximum time_t on ia64
is around 292 billion years in the future, but 'int' and struct tm.tm_year
can only represent then ext 2.1 billion years or so.
This solves the problem of mktime/localtime looping on ia64. Unfortunately,
the standards say that tm_year is an 'int', so we are still stuck with a
y2147483647 bug. bash2's configure script looks for bugs in mktime() and
fails on ia64 because of this. However, mktime() on FreeBSD fails the test
normally anyway so this is no big loss.
This change does not affect any other platforms besides ia64.
Approved by: re
since it has been MFC'ed. See the log message for the previous commit
for more details. The alignment bug in gcc-3 has not been fixed, but
it is not very serious and the previous commit just moved it (as intended).
Approved by: re (murray)
the old 8-bit fs_old_flags to the new location the first time that the
filesystem is mounted by a new kernel. One of the unused flags in
fs_old_flags is used to indicate that the flags have been moved.
Leave the fs_old_flags word intact so that it will work properly if
used on an old kernel.
Change the fs_sblockloc superblock location field to be in units
of bytes instead of in units of filesystem fragments. The old units
did not work properly when the fragment size exceeeded the superblock
size (8192). Update old fs_sblockloc values at the same time that
the flags are moved.
Suggested by: BOUWSMA Barry <freebsd-misuser@netscum.dyndns.dk>
Sponsored by: DARPA & NAI Labs.
In _thread_switch, set current thread pointer in kse mailbox
only after all registers copied out of thread mailbox, kernel will do
upcall at trap time, if set current thread pointer before loading all
registers from thread mailbox, at trap time, the thread mailbox data
will be overwritten by kernel, result is junk data is loaded into CPU.
been repo-copied from src/lib/libc/uuid to src/include. Update the
makefiles.
While in src/include/Makefile, reformat and resort INCS. Reverting
the functional change only involves removing uuid.h.
Pompted by: ru
I've no idea if this is the right behavior for the library, but this
at least fixes the build, and matches what seems to be alfred's intent
in the commit message for 1.19.
sysconf.c:
Use 'break' rather than 'goto yesno' in sysconf.c so that we report a '0'
return value from the kernel sysctl.
vfs_aio.c:
Make aio reset its configuration parameters to -1 after unloading
instead of 0.
posix4_mib.c:
Initialize the aio configuration parameters to -1
to indicate that it is not loaded.
Add a facility (p31b_iscfg()) to determine if a posix4 facility has been
initialized to avoid having to re-order the SYSINITs.
Use p31b_iscfg() to determine if aio has had a chance to run yet which
is likely if it is compiled into the kernel and avoid spamming its
values.
Introduce a macro P31B_VALID() instead of doing the same comparison over
and over.
posix4.h:
Prototype p31b_iscfg().
Both are atomic, but the cmpxchg has memory ordering hints. We
give this acquire semantics.
NOTE: The unlock in libc_r is implemented by a "normal" assign
statement. This is not correct on ia64 due to the memory ordering
characteristics of the architecture. We need release semantics
for an unlock.
libc. I want to keep these in some version for the thread
library/ies, but don't know whether to have them repo-copied
to libc_r or renamed and kept in libc.
Change the name of an alpha macro that was changed with the
system call commit.
subsystems capabilities:
_SC_AIO_LISTIO_MAX returns the default of _POSIX_AIO_LISTIO_MAX
_SC_AIO_MAX returns the default _POSIX_AIO_MAX
_SC_AIO_PRIO_DELTA_MAX returns the default of 0
Without these adjustments the values returned are -1 even when the
aio side of the kernel returns '0' for them which is incorrect.
Noticed by: Craig Rodrigues <rodrigc@attbi.com>
time_t. Deal with the possibility that time_t != int32_t. This boils
down to this sort of thing:
- time(&ut.ut_time);
+ ut.ut_time = time(NULL);
and similar for ctime(3) etc. I've kept it minimal for the stuff
that may need to be portable (or 3rd party code), but used Matt's time32
stuff for cases where that isn't as much of a concern.
Approved by: re (jhb)
descriptors that have the close-on-exec flag set, as that will have no
effect anyway and might screw something else up if the file descriptor
happens to be shared with another process.
PR: standards/43335
MFC after: 1 week
architecture, mainly to avoid getting a SIGFPE signal sent
when calling strtod(3) with certain input.
The SIGFPE has been sent because the code was not aware that
a Gradual Underflow is handled in software via traps on the
Alpha architecture, but is not implemented in our Alpha kernel
layer.
With `Sudden_Underflow' defined, strtod(3) should not depend
on Gradual Underflow and adjust its calculations accordingly,
which means that other, more subtle errors than the sending of
SIGFPE could be solved by this.
Discussed with: bde
PR: alpha/12623
PR: alpha/17032
PR: alpha/43567
MFC after: 7 days
caused by dynamic PAM modules that call openlog(3) and closelog(3),
e.g. ports/security/pam_pwdfile.
What happened here is that the module first registered its "ident"
with openlog(3), then PAM library unloaded module with dlclose(3),
and the next call to syslog(3) resulted in SIGSEGV.
MFC after: 3 days
o Remove the unwanted smartness in _longjmp() where it compares
the current ar.bspstore with the saved ar.bspstore and restores
ar.rnat based on it. This either avoids saving ar.rnat in the
jmp_buf or is the consequence of not saving ar.rnat. All this
complexity breaks libc_r where we use longjmp() to switch to
different threads and the current ar.bspstore has no relation
to the saved ar.bspstore. Thus: we save ar.rnat in setjmp()
and simply restore ar.bspstore and ar.rnat in longjmp().
This code needs a cleanup.
by filling in the jump table.
Convert uses of pthread routines within libc_r to use the internal
versions (_pthread_foo instead of pthread_foo).
Remove a couple of globals from application namespace.
entries in the table being stubs. While I'm here, add macros to
auto-generate the stubs. A conforming threads library can override
the stub routines by filling in the jump table.
Add some entries to namespace.h and sync un-namespace.h to it.
Also add a comment to remind folks to update un-namespace.h
when changing namespace.h.
PAM module state (created in pam_sm_authenticate and referenced later
in pam_sm_setcred and pam_sm_acct_mgmt). However, the krb5_ccache
structure shares some data members with the krb5_context structure
that was used in its creation. Since a new krb5_context is created
and destroyed at each PAM entry point, this inevitably caused the
krb5_ccache structure to reference free'd memory.
Now instead of storing a pointer to the krb5_ccache structure,
we store the name of the cache (e.g. `MEMORY:0x123CACHE') in
pam_sm_authenticate, and resolve the name in the other entry points.
This bug was uncovered by phkmalloc's free'd memory scrubbing.
Approved by: re (jhb)
e.g.
Unknown error: -1765328378
we get
Client not found in Kerberos database
Another way to accomplish this would have been to leave
`error_message' alone, but to explicitly load the Kerberos com_err
error tables. However, I don't really like the idea of a PAM module
dorking with global tables.
Approved by: re (jhb)
difference between the two from a low-level point of view is that
the partition type is different. This change adds EFI related cases
to existing switch statements with existing FAT related cases.
information, since we rely on the pwd entry to know what MAC labels
to set as part of the login process.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
Don't force 16-byte alignment at run-time. Do it at compile-time.
This saves us the pointer fiddling by the setjmp functions and
reduces complexity. While here, increase the jmp_buf by 16 bytes
to an even 512 bytes. Coincidentally, due to the way alignment
was handled prior to this change, the jmp_buf has not changed in
size, but only in how the space is used. Prior to this change
the 16 bytes were reserved for enforcing alignment; now they are
reserved by us for future extensions.
Therefore, this ABI breaker is relatively save: the failure is
always an alignment trap.
namely uuidgen(1), uuidgen(2) and uuid(3), the following division
has been choosen:
uuidgen(1) A description of the command line utility,
and other user oriented UUID information.
uuidgen(2) A mostly technical description of UUIDs.
uuid(3) A description of the functions and other
programmer oriented UUID information.
According to the division: add more technical contents.
Contributed by: Hiten Pandya <hiten@uk.FreeBSD.org>
Edited and enhanced: marcel
always to the first 16 sectors of the disk. The firmware reads the boot
code from a partition, defaulting to 'a' if none is specified, which only
corresponds to the first 16 sectors of the disk if 'a' is first. Solaris
often makes the swap partition first, instead of the root partition, and
users expect to be able to do the same with freebsd as well. This also
allows one to temporarily boot from another partition if the boot block
on the root partition gets scrambled somehow.
o Remove all code guarded by !defined(__ia64__). This file is
specifically written for ia64,
o Handle the case when read_block() or write_block() fails. We
don't want sysinstall(8) to signal a thumbs-up on error,
o Set the starting (cyl,hd,sect) triple to 0xFFFFFF when either
bios_hd or bios_sect is zero or the LBA us not representable
with the triple. In that case automaticly initialize the
ending triple with 0xFFFFFF as well,
o Reindent Write_Int32() as it was different than the rest of
the file,
o Remove some unused variables that appeared to be used but
were effectively useless.
o Plug a memory leak: The second timne we read the MBR, we write
out a modified block, but didn't free the memory after writing.
o Replace d1->sector_size with 512 when we read/write the MBR.
We ignore the sector size in cases we shouldn't but adhered to
it in cases it would be wrong if the sector_size wasn't 512.
This file should eventually be rewritten to write out a GPT. For
now, a MBR will do...