cperciva [Fri, 6 May 2005 02:50:00 +0000 (02:50 +0000)]
If we are going to
1. Copy a NULL-terminated string into a fixed-length buffer, and
2. copyout that buffer to userland,
we really ought to
0. Zero the entire buffer
first.
robert [Fri, 6 May 2005 00:06:06 +0000 (00:06 +0000)]
Fix our NTFS readdir function.
To check a directory's in-use bitmap bit by bit, we use
a pointer to an 8 bit wide unsigned value.
The index used to dereference this pointer is calculated
by shifting the bit index right 3 bits. Then we do a
logical AND with the bit# represented by the lower 3
bits of the bit index.
This is an idiomatic way of iterating through a bit map
with simple bitwise operations.
This commit fixes the bug that we only checked bits
3:0 of each 8 bit chunk, because we only used bits 1:0
of the bit index for the bit# in the current 8 bit value.
This resulted in files not being returned by getdirentries(2).
Change the type of the bit map pointer from `char *' to
`u_int8_t *'.
wpaul [Thu, 5 May 2005 22:33:06 +0000 (22:33 +0000)]
Cast 64 bit quantity to uintmax_t to print it with %jx. This is
technically a no-op since uintmax_t is uint64_t on all currently
supported architectures, but we should use an explicit cast instead
of depending on this obscure coincidence.
glebius [Thu, 5 May 2005 21:05:38 +0000 (21:05 +0000)]
Things required to build libalias as kernel module:
- kernel module declarations and handler.
- macros to map malloc(3) calls to malloc(9) ones.
- malloc(9) declarations.
- call finishoff() from module handler MOD_UNLOAD case
instead of atexit(3).
- use panic(9) instead of abort(3)
- take time from time_second instead of gettimeofday(2)
- define INADDR_NONE
peter [Thu, 5 May 2005 18:26:45 +0000 (18:26 +0000)]
Move the pcb variable initialization earlier. This is cosmetic here, but
in as-yet uncommitted code for 32 bit binary compatability on 64 bit
kernels, some of the 32 bit registers come from the pcb. Moving the
initialization here means fill_regs32() etc are laid out the same.
wpaul [Thu, 5 May 2005 06:14:59 +0000 (06:14 +0000)]
Avoid sleeping with mutex held in kern_ndis.c.
Remove unused fields from ndis_miniport_block.
Fix a bug in KeFlushQueuedDpcs() (we weren't calculating the kq pointer
correctly).
In if_ndis.c, clear the IFF_RUNNING flag before calling ndis_halt_nic().
Add some guards in kern_ndis.c to avoid letting anyone invoke ndis_get_info()
or ndis_set_info() if the NIC isn't fully initialized. Apparently, mdnsd
will sometimes try to invoke the ndis_ioctl() routine at exactly the
wrong moment (to futz with its multicast filters) when the interface
comes up, and can trigger a crash unless we guard against it.
wpaul [Thu, 5 May 2005 04:16:13 +0000 (04:16 +0000)]
Remove extranaous free() of ASCII filename from NdisOpenFile().
Oh, one additional change I forgot to mention in the last commit:
NdisOpenFile() was broken in the case for firmware files that were
pre-loaded as modules. When searching for the module in NdisOpenFile(),
we would match against a symbol name, which would contain the string
we were looking for, then save a pointer to the linker file handle.
Later, in NdisMapFile(), we would refer to the filename hung off
this handle when trying to find the starting address symbol. Only
problem is, this filename is different from the embedded symbol
name we're searching for, so the mapping would fail. I found this
problem while testing the AirGo driver, which requires a small
firmware file.
wpaul [Thu, 5 May 2005 03:56:09 +0000 (03:56 +0000)]
This commit makes a bunch of changes, some big, some not so big.
- Remove the old task threads from kern_ndis.c and reimplement them in
subr_ntoskrnl.c, in order to more properly emulate the Windows DPC
API. Each CPU gets its own DPC queue/thread, and each queue can
have low, medium and high importance DPCs. New APIs implemented:
KeSetTargetProcessorDpc(), KeSetImportanceDpc() and KeFlushQueuedDpcs().
(This is the biggest change.)
- Fix a bug in NdisMInitializeTimer(): the k_dpc pointer in the
nmt_timer embedded in the ndis_miniport_timer struct must be set
to point to the DPC, also embedded in the struct. Failing to do
this breaks dequeueing of DPCs submitted via timers, and in turn
breaks cancelling timers.
- Fix a bug in KeCancelTimer(): if the timer is interted in the timer
queue (i.e. the timeout callback is still pending), we have to both
untimeout() the timer _and_ call KeRemoveQueueDpc() to nuke the DPC
that might be pending. Failing to do this breaks cancellation of
periodic timers, which always appear to be inserted in the timer queue.
- Make use of the nmt_nexttimer field in ndis_miniport_timer: keep a
queue of pending timers and cancel them all in ndis_halt_nic(), prior
to calling MiniportHalt(). Also call KeFlushQueuedDpcs() to make sure
any DPCs queued by the timers have expired.
- Modify NdisMAllocateSharedMemory() and NdisMFreeSharedMemory() to keep
track of both the virtual and physical addresses of the shared memory
buffers that get handed out. The AirGo MIMO driver appears to have a bug
in it: for one of the segments is allocates, it returns the wrong
virtual address. This would confuse NdisMFreeSharedMemory() and cause
a crash. Why it doesn't crash Windows too I have no idea (from reading
the documentation for NdisMFreeSharedMemory(), it appears to be a violation
of the API).
- Implement strstr(), strchr() and MmIsAddressValid().
- Implement IoAllocateWorkItem(), IoFreeWorkItem(), IoQueueWorkItem() and
ExQueueWorkItem(). (This is the second biggest change.)
- Make NdisScheduleWorkItem() call ExQueueWorkItem(). (Note that the
ExQueueWorkItem() API is deprecated by Microsoft, but NDIS still uses
it, since NdisScheduleWorkItem() is incompatible with the IoXXXWorkItem()
API.)
- Change if_ndis.c to use the NdisScheduleWorkItem() interface for scheduling
tasks.
With all these changes and fixes, the AirGo MIMO driver for the Belkin F5D8010 Pre-N card now works. Special thanks to Paul Robinson
(paul dawt robinson at pwermedia dawt net) for the loan of a card
for testing.
Define HAVE_STRUCT_UTMP_UT_HOST in order for the REMOTEHOST environment
variable to show up correctly.
Note: This is really a bug with the stock tcsh configure.in script not
including <sys/types.h> before <utmp.h>. But, since config.h is maintained
separate from the contrib sources, this is the correct fix.
emax [Wed, 4 May 2005 18:55:03 +0000 (18:55 +0000)]
Change m_uiotombuf so it will accept offset at which data should be copied
to the mbuf. Offset cannot exceed MHLEN bytes. This is currently used to
fix Ethernet header alignment problem on alpha and sparc64. Also change all
users of m_uiotombuf to pass proper offset.
Reviewed by: jmg, sam
Tested by: Sten Spans "sten AT blinkenlights DOT nl"
MFC after: 1 week
andre [Wed, 4 May 2005 13:48:44 +0000 (13:48 +0000)]
If we don't get a suggested MTU during path MTU discovery
look up the packet size of the packet that generated the
response, step down the MTU by one step through ip_next_mtu()
and try again.
ume [Wed, 4 May 2005 12:02:10 +0000 (12:02 +0000)]
- add $FreeBSD$.
- do service lookup.
- add options to use gethostbyname(3) or getipnodebyname(3) instead
of getaddrinfo(3).
- add option to do reverse lookup.
keramida [Wed, 4 May 2005 11:09:26 +0000 (11:09 +0000)]
Document the fact that accept(2) may return EINVAL when addrlen is
negative (in addition to returning EINVAL when called on a descriptor
that is not a socket).
Submitted by: Arne H Juul <arnej@europe.yahoo-inc.com>
PR: docs/80587
rwatson [Wed, 4 May 2005 10:39:15 +0000 (10:39 +0000)]
Introduce MAC Framework and MAC Policy entry points to label and control
access to POSIX Semaphores:
mac_init_posix_sem() Initialize label for POSIX semaphore
mac_create_posix_sem() Create POSIX semaphore
mac_destroy_posix_sem() Destroy POSIX semaphore
mac_check_posix_sem_destroy() Check whether semaphore may be destroyed
mac_check_posix_sem_getvalue() Check whether semaphore may be queried
mac_check_possix_sem_open() Check whether semaphore may be opened
mac_check_posix_sem_post() Check whether semaphore may be posted to
mac_check_posix_sem_unlink() Check whether semaphore may be unlinked
mac_check_posix_sem_wait() Check whether may wait on semaphore
Update Biba, MLS, Stub, and Test policies to implement these entry points.
For information flow policies, most semaphore operations are effectively
read/write.
des [Wed, 4 May 2005 08:12:44 +0000 (08:12 +0000)]
The correct description for mode "w" is
(((truncate to zero length) or (create)) (text file)) (for writing)
and not
((truncate file to zero length) or (create text file)) (for writing)
rwatson [Tue, 3 May 2005 20:21:24 +0000 (20:21 +0000)]
Move definitions of 'struct kuser' and 'struct ksem' from uipc_sem.c
to ksem.h so that they are accessible from the MAC Framework for the
purposes of labeling and enforcing additional protections. #error
if these are included without _KERNEL, since they are not intended
(nor installed) for user application use.
delphij [Tue, 3 May 2005 16:20:03 +0000 (16:20 +0000)]
Cleanup for getgrouplist(3):
- Use /*- instead of /* for copyright section
- Include unistd.h for prototype of it
- Sort and separate includes as described in style(9)
- ANSIfy the function defination
- Use const for the traversing iterator
grehan [Tue, 3 May 2005 11:56:05 +0000 (11:56 +0000)]
- move to SCHED_4BSD per jeffr's comments on SCHED_ULE's state
- enable MSDOSFS
- ehci is stable on the powerbook
- modules have been working for a long time.
jeff [Tue, 3 May 2005 11:11:26 +0000 (11:11 +0000)]
- Add a new object flag "OBJ_NEEDSGIANT". We set this flag if the
underlying vnode requires Giant.
- In vm_fault only acquire Giant if the underlying object has NEEDSGIANT
set.
- In vm_object_shadow inherit the NEEDSGIANT flag from the backing object.
jeff [Tue, 3 May 2005 11:05:33 +0000 (11:05 +0000)]
- Set the v_object pointer after a successful VOP_OPEN(). This isn't a
perfect solution as the lower vm object can change at unpredictable times
if our lower vp happens to be on another unionfs, etc.
jeff [Tue, 3 May 2005 11:03:29 +0000 (11:03 +0000)]
- Don't restrict the softdep stats to DEBUG kernels, they cost nothing to
export. This was happening anyway since this file manually sets DEBUG.
- Add a sysctl for the number of items on the worklist.
- Use a more canonical loop restart in softdep_fsync_mountdev, it saves
some code at the expense of a goto and makes me worry less about
modifying a variable that should be private to the TAILQ_FOREACH_SAFE
macro.
jeff [Tue, 3 May 2005 10:58:05 +0000 (10:58 +0000)]
- Remove two mtx_asserts that can incorrectly trigger if
devstat_end_transaction is called from a fast interrupt. Presently
there is no way for mtx_assert to determine that we're not executing
in a real thread context.
jeff [Tue, 3 May 2005 10:56:00 +0000 (10:56 +0000)]
- A vnode may have made its way onto the free list while it was being
vgone'd. We must remove it from the freelist before returning in
vtryrecycle() or we may get a duplicate free.
jeff [Tue, 3 May 2005 10:55:05 +0000 (10:55 +0000)]
- Use namei to acquire Giant for VFS if it is necessary. Drop the explicit
Giant acquisition.
- Remove GIANT_REQUIRED in the few remaining cases; the vm and vfs have
both been locked.
sos [Tue, 3 May 2005 07:55:07 +0000 (07:55 +0000)]
Reshape the dma code to be a bit more flexible so it can cope with
new HW that has new and different demands.
Fix a few nits in former commit in this cleanup crusade.
scottl [Tue, 3 May 2005 07:11:19 +0000 (07:11 +0000)]
Properly mask off the status bits when checking to see if the ccb is still
valid to process. This was causing deferred commands to be rejected due
to their extra status flag.
scottl [Tue, 3 May 2005 05:44:42 +0000 (05:44 +0000)]
The driver looks like it can create valid 64-bit scatter-gather lists, so
don't restrict it to a 32-bit address space. Also use the correct busdma
flags for the SRB memory area.
marcel [Tue, 3 May 2005 04:19:07 +0000 (04:19 +0000)]
Remove only the packages sub-directory before recreating it. Do not
remove the whole disc treei structure. This allows one to specify the
disc trees created by a prior release build (under R/cdrom) as the
destination without destroying the contents. This better integrates
with release building and makes further automation easier.
marcel [Tue, 3 May 2005 04:11:56 +0000 (04:11 +0000)]
Allow specifying which INDEX file to use by setting PKG_INDEX. By default
the INDEX file is taken from the package source tree as defined by the
PKG_TREE variable. This change allows using the (possibly incomplete)
packages on pointyhat.