Commit Graph

12100 Commits

Author SHA1 Message Date
dogcow
b8d6c11ba4 <machine/profile.h> needs <sys/types.h>; why crt0.c needs <machine/profile.h>
(and only on amd64) is another question altogether.
2007-09-27 10:51:18 +00:00
tnn
aa8a5e0d63 remove extraneous "has" 2007-09-25 09:42:51 +00:00
junyoung
8fa93f7dc6 Farewell to gccism. 2007-09-25 08:22:44 +00:00
junyoung
4271bf2ec5 Massive cosmetic changes, notably:
* ANSIfy
 * De-__P
 * u_intXX_t -> uintXX_t
 * Remove "extern" from function prototypes
2007-09-25 08:19:09 +00:00
junyoung
0e2bf8ef62 Remove trailing spaces. 2007-09-25 08:16:08 +00:00
lukem
e9aa053c09 Add raise_default_signal(3) -- raise the default signal handler.
Can be used by applications that have their own SIGINT (et al)
handlers and want to exit in a manner that correctly
signals to the parent that the process was terminated by a signal.
See http://www.cons.org/cracauer/sigint.html for more info.
Discussed on tech-userlevel@.
2007-09-25 01:13:54 +00:00
ad
af8ed8ad89 Kill PTHREAD_SPIN_DEBUG - it's not must use with 1:1. 2007-09-24 13:56:42 +00:00
skrll
d32ed98975 Resurrect the function pointers for lock operations and allow each
architecture to provide asm versions of the RAS operations.

We do this because relying on the compiler to get the RAS right is not
sensible. (It gets alpha wrong and hppa is suboptimal)

Provide asm RAS ops for hppa.

(A slightly different version) reviewed by Andrew Doran.
2007-09-24 12:19:39 +00:00
pooka
12e401bc1a Add refuse paper to SEE ALSO 2007-09-24 00:22:25 +00:00
ad
598943b712 Adjust previous for clarity. 2007-09-21 21:28:11 +00:00
ad
92f04f1f80 pthread__mutex_unlock_slow: always catch up with deferred wakeups, because
pthread_mutex_unlock clears the per-mutex indicator.
2007-09-21 21:09:25 +00:00
ad
cb10afa05c pthread_rwlock_unlock: return EPERM if the caller tries to release a
rwlock that is write held, but not by the caller.
2007-09-21 16:24:45 +00:00
ad
9212747aea pthread_rwlock_unlock
- Allow callers to try and release an unheld rwlock. Just return EPERM
  as mandated by IEEE Std 1003.1.
- Use pthread__atomic_swap_ptr() to set in the new lock value. At this
  point the lock word can't have changed.

pthread__rwlock_wrlock, pthread__rwlock_rdlock:

- Mask out the waiter bits in the lock word before checking to see if
  the current thread is about to lock against itself.
2007-09-21 16:21:54 +00:00
jdc
fe324c36e9 Set the column width when changing the background using wbkgd(), otherwise
we will see zero width characters in refresh.c:makech().
2007-09-19 22:13:14 +00:00
jdc
260ad27047 We don't need separate #ifdef's for __ALTCHARSET and WA_ALTCHARSET, as they
are defined to be the same in curses.h.
2007-09-19 22:00:43 +00:00
jdc
c172664803 Add debugging for the WCHAR cases. 2007-09-19 21:59:37 +00:00
mlelstv
6abb2a41f4 Implement OSS_SNDCTL_DSP_GETODELAY and provide a no-op function
for OSS_SNDCTL_DSP_PROFILE.
2007-09-18 22:57:31 +00:00
tnozaki
0941b12b16 lib/36938 mbtowc misbehaving after invalid char sequence
- make sure to initialize mbtowc's internal state.
 - add regression test.
2007-09-18 15:12:07 +00:00
skrll
f9577d3ada Mostly fix the restartable atomic sequences by reversing the sense of the
lock check and test for return value.

At least alpha looks broken me and some are sub-optimal.

"Looks good to me" from ad.
2007-09-17 13:25:59 +00:00
ragge
592fd7eafc __FUNCTION__ -> __func__. 2007-09-15 14:30:56 +00:00
tnn
28d03ee594 sem_post(): pthread__self() is no longer used here. 2007-09-14 09:15:41 +00:00
ad
20e3392edc Add a per-mutex deferred wakeup flag so that threads doing something like
the following do not wake other threads early:

	pthread_mutex_lock(&mutex);
	pthread_cond_broadcast(&cond);
	foo = malloc(100);		/* takes libc mutexes */
	pthread_mutex_unlock(&mutex);
2007-09-13 23:51:47 +00:00
ad
b0efccf4cd Make the new mutexes faster:
- Eliminate mutexattr_private and just set a bit in ptm_owner if the mutex
  is recursive. This forces the slow path to be taken for recursive mutexes.
  Overload an unused field in pthread_mutex_t to record whether or not it's
  an errorcheck mutex.
- Streamline pthread_mutex_lock / pthread_mutex_unlock a bit more. As a
  side effect makes it possible to have assembly stubs for them.
2007-09-11 18:11:29 +00:00
ad
4042b7d22a Put new threads on the tail of pthread__allqueue, for the debugger. 2007-09-11 18:08:10 +00:00
ad
7db40473e2 Fix a dodgy bit of assembly. 2007-09-11 16:07:15 +00:00
ad
ee3459ca7b Fix broken pthread_mutex_trylock(). 2007-09-11 11:30:15 +00:00
ad
baebee83d5 Fix inverted test after merge of nick-csl-alignment. 2007-09-11 10:27:44 +00:00
skrll
9fdaf800d9 Merge nick-csl-alignment. 2007-09-10 11:34:05 +00:00
ad
e2c2fa5d09 Fix recursive mutexes to work again in non-threaded applications. 2007-09-09 20:13:23 +00:00
ad
debc2870e6 Update. 2007-09-08 23:00:31 +00:00
ad
f4fd6b797e - Get rid of self->pt_mutexhint and use pthread__mutex_owned() instead.
- Update some comments and fix minor bugs. Minor cosmetic changes.
- Replace some spinlocks with mutexes and rwlocks.
- Change the process private semaphores to use mutexes and condition
  variables instead of doing the synchronization directly. Spinlocks
  are no longer used by the semaphore code.
2007-09-08 22:49:50 +00:00
rmind
2cecf9bbe9 Implementation of POSIX message queues.
Reviewed by: <ad>, <tech-kern>
2007-09-07 18:56:02 +00:00
ad
8ccc6e060d - Don't take the mutex's spinlock (ptr_interlock) in pthread_cond_wait().
Instead, make the deferred wakeup list a per-thread array and pass down
  the lwpid_t's that way.

- In pthread_cond_wait(), take the mutex before dealing with early wakeup.
  In this way there should never be contention on the CV's spinlock if
  the app follows POSIX rules (there should only be contention on the
  user-provided mutex).

- Add a port of the kernel's rwlocks. The rwlock's spinlock is only taken if
  there is contention. This is enabled where atomic ops are available. Right
  now that is only i386 and amd64 because I don't have other hardware to
  test with. It's trivial to add stubs for other architectures as long as
  they have compare-and-swap. When we have proper atomic ops the old rwlock
  code can be removed.

- Add a new mutex implementation that's similar to the kernel's mutexes, but
  uses compare-and-swap to maintain the waiters list, so no spinlocks are
  involved. Same caveats apply as for the rwlocks.
2007-09-07 14:09:27 +00:00
ad
a6ed47a549 Add: pthread__atomic_cas_ptr, pthread__atomic_swap_ptr, pthread__membar_full
This is a stopgap until the thorpej-atomic branch is complete.
2007-09-07 00:24:56 +00:00
ad
c67dc640cd If a libpthread internal spinlock is held, nanosleep() for a tick instead of
yielding. This is a nasty band-aid but with many threads, looping over
sched_yield() wastes a huge amount of CPU time. It would be nice to have a
way to temporarily disable preemption, but it turns out that's yet another
no-brain concept that has been patented and the patent holder seems to be
suing people lately. Another alternative is probably to have kernel-assisted
spinlocks.
2007-09-07 00:07:54 +00:00
pooka
3875108e18 document puffs_framev_framebuf_ccpromote() 2007-09-06 18:01:34 +00:00
pooka
56b35d3b97 Give cmpframe() the ability to shortcircuit the comparison loop by
signalling back that the buffer under examination is not a response
at all.
2007-09-06 16:08:55 +00:00
jnemeth
8e9c7dbf0c PR/36933 - Robert Elz -- ARPA IPv6 -> IPv6 2007-09-06 09:32:52 +00:00
drochner
dce09ea075 clean up some definitions around rune_t which are not needed anymore 2007-09-03 20:31:56 +00:00
pooka
91872d550d xref refuse, don't bump date 2007-09-03 12:34:21 +00:00
pooka
dc9a91060d Add gotframe callback, which is called if an incoming frame matches
no outstanding request.
2007-09-01 16:42:42 +00:00
blymn
2b4f2c9caf Fix a crash caused by having a single NULL character as a string capability.
This fix is about the best we can do given the current interfaces. We
could extend the cgetcap(3) interfaces with a function that would return
a character count and handle this in libterm which would provide a more
complete fix and allow a NULL character in a string capability.
2007-08-28 12:28:18 +00:00
jdc
34bea28655 Fix resizing bug where the values of LINES and/or COLS changed while we
were resizing windows, leading to inconsistencies between the sizes of
stdscr and curscr.

Should fix the curses part of PR lib/36702.
2007-08-27 19:54:29 +00:00
pooka
8ffb2866a1 * clarify error behaviour for getmntopts()
* invert getmnt_silent description (a.k.a. "fix it")
2007-08-26 22:53:01 +00:00
pooka
5cf35d2a60 Emulate behaviour described in man page and return NULL if an error occurs. 2007-08-26 22:46:15 +00:00
pooka
ec5345d9bc Now that we don't dump operations by default, might as well detach
from the console by default also.  (but still would be nice if someone
provided options to toggle these using the fuse options framework)
2007-08-25 12:03:59 +00:00
pooka
b017aa6055 Pass usermount to errnotify, it might not be available there through
other structures.  CID 4496
2007-08-25 09:30:41 +00:00
ad
342557fb0f Update. 2007-08-23 19:21:40 +00:00
ad
0225b043d2 Acquire the correct lock in pthread_detach(). Spotted by Jan Kryl. 2007-08-23 19:13:23 +00:00
pooka
083b854262 Dump lookup/componentname specific info in opdump.
(sigh, I guess I guess I'll never do opdump properly at this rate)
2007-08-22 17:57:48 +00:00
pooka
e6d6dce9bf Mimic namei structure changes for puffs. bump both kernel & lib version. 2007-08-22 17:54:30 +00:00
drochner
a82b6826f5 replace the last cast through void* by the SET_FLOAT_WORD macro, inspired
by a similar change in FreeBSD
2007-08-21 20:12:27 +00:00
drochner
58960d86a5 Adopt an (older) fix from FreeBSD: using ceil() on values in (0,0.5]
leads to loss of precision, leading to rounding into the wrong direction
for the case 0.5-epsilon. use floor() instead.
This also fixes a wrong sign of zero returned with non-default rounding
directions.
2007-08-21 20:10:27 +00:00
perry
e34be9798b Never use "utilize". It means exactly the same thing as "use", but it
is longer and more cumbersome. It can always be replaced with "use"
without any change in meaning.
2007-08-20 16:07:05 +00:00
drochner
9d8b5fa74e Add C99 complex support, for double and float.
Most complex function implementations are from the "c9x-complex" library,
originating from the "cephes" math library, see
http://www.netlib.org/cephes/, from Stephen L. Moshier, incorporated and
redistributed with the NetBSD license by permission of the author.

Error behaviour and other boundary conditions (branch cuts)
need to be looked at.

For namespace sanity, I've done the rename/weak alias procedure to
most of the exported functions which are also used internally.
Didn't do so for sin/cos(f) yet because assembler implementations use
them directly, and renaming functions shared between the main libm
and the machine specific "overlay" might raise binary compatibility
issues.
2007-08-20 16:01:28 +00:00
pooka
f9009a84a6 puffs_cc_create/destroy aren't supposed to be exported to the user 2007-08-18 10:26:05 +00:00
pooka
4385b647e7 Add accessors for struct puffs_node to prepare for removal from
exported headers.
2007-08-17 17:25:31 +00:00
ad
40724da2ba pthread_suspend_np, pthread_resume_np, pthread_detach: return correct code
on error.
2007-08-17 14:28:31 +00:00
ad
cc383c5771 Minor correction for debug code and a cosmetic change. 2007-08-16 23:37:08 +00:00
ad
2639b90e3b One more micro-optimization.. 2007-08-16 14:53:45 +00:00
ad
d9adedd764 Trim fat off libpthread internal spinlock operations. Makes a mesurable
improvement across the board.
2007-08-16 13:54:16 +00:00
ad
b8833ff53f - Reinitialize the absolute minimum when recycling user thread state.
Chops another ~10% off create/join in a loop on i386.
- Disable low level debugging as this is stable. Improves benchmarks
  across the board by a small percentage. Uncontested mutex acquire
  and release in a loop becomes about 8% quicker.
- Minor cleanup.
2007-08-16 12:01:49 +00:00
ad
71197327ee Catch up with libpthread changes. 2007-08-16 01:09:50 +00:00
ad
9e28719960 Remove PT_FIXEDSTACKSIZE_LG. 2007-08-16 01:09:34 +00:00
ad
ed964af19e Cache thread context for creation instead of setting it up every time.
Speeds create/join loop by about 10-15% on i386.
2007-08-16 00:41:23 +00:00
ad
c94f5a91bc Simplify pthread_join(). Knocks about 5% off pthread_create/join in a loop. 2007-08-15 22:48:52 +00:00
pooka
25a346d4fb Nuke PUFFSLOOKUP_FOO and move to NAMEI_FOO 2007-08-15 14:19:19 +00:00
pooka
306d09812c In case a file system doesn't provide st_blksize, default to DEV_BSIZE. 2007-08-12 15:32:39 +00:00
christos
5f3802ca6e patches from Axel Thimm 2007-08-12 07:41:51 +00:00
pooka
ea9b8a0046 run realpath() on the mountpath 2007-08-11 18:04:50 +00:00
drochner
b36bcf93ef make the hypot/atan2 functions weak aliases, because they are used
internally by the historical cabs(), and the future c99 cabs/carg
2007-08-10 21:20:35 +00:00
he
fd961c4429 Add a new socket option for unix domain sockets: LOCAL_PEEREID, to make
it possible to get the pid, euid and egid of the process at the remote
end at the time it did bind() or connect().

Add a new libc function, getpeereid() to easily get at the euid and egid.
As a consequence, bump libc's minor number.

Document the LOCAL_PEEREID socket option in unix(4).

Based on contribution by Arne H. Juul, minor modifications by myself.
2007-08-09 15:23:01 +00:00
kristerw
3a6ef3e3c1 Keep track of atexit functions that are added while processing
atexit functions, to ensure that the new functions will be called.
2007-08-08 01:05:34 +00:00
kristerw
af220472c9 Ensure that the struct atexit_handler has been removed from the list
of pending atexit handlers before the structure is reused.  This prevents
__cxa_finalize from going into an infinite loop when an atexit handler
register a new atexit handler as in:

   #include <stdlib.h>

   void two(void) {
   }

   void one(void) {
           atexit(two);
   }

   int main(void) {
           atexit(one);
           return 0;
   }
2007-08-08 00:51:18 +00:00
wiz
90a93c1dcd Various improvements: sort errors; use more
markup; fixes for HTML and PostScript output.
2007-08-07 20:45:03 +00:00
ad
1d42dbd29a Missed variable rename.. 2007-08-07 19:58:30 +00:00
ad
c3f8e2ee55 Change the signature of _lwp_park() to accept an lwpid_t and second
hint pointer, but do so in a way that remains compatible with older
pthread libraries. This can be used to wake another thread before the
calling thread goes asleep, saving at least one syscall + involuntary
context switch. This turns out to be a fairly large win on the condvar
benchmarks that I have tried.
2007-08-07 19:04:21 +00:00
pooka
a213499d32 dump further info for read/write 2007-08-07 13:44:27 +00:00
joerg
b4d8fb4e3e Update to libarchive-2.2.6. 2007-08-06 12:31:16 +00:00
kristerw
d0d36b6101 Update includes so that this builds for USE_FORT=no too. 2007-08-04 19:37:52 +00:00
ad
7bf06aa722 Make libpthread_dbg build again. 2007-08-04 18:54:12 +00:00
ad
15c28fd2d8 Update. 2007-08-04 13:46:04 +00:00
ad
a014cf23cb Fix error in previous. 2007-08-04 13:43:46 +00:00
ad
50fa8db4e4 Some significant performance improvements, and a fix for a race with pthread
detach/join.

- Make mutex acquire spin for a short time, as done with spinlocks.
- Make the number of spins controllable with the env var PTHREAD_NSPINS.
- Reduce the amount of time that libpthread internal spinlocks are held.
- Rely more on the barrier effects of park/unpark to avoid taking spinlocks.
- Simplify the locking around pthreads and the global queues.
- Align per-thread sync data on a 128 byte boundary.
- Offset thread stacks by a small amount to try and reduce cache thrash.
2007-08-04 13:37:48 +00:00
jdc
a39089a88a Add KEY_RESIZE.
Fix use after free().
2007-08-04 08:36:49 +00:00
wiz
5ad579abd9 Explicitly talk about file pointers (to avoid confusion with general C pointers).
Suggested by joerg.
Bump date.
2007-08-02 23:46:39 +00:00
wiz
e3d3393d01 Add xref to shquote(3), suggested by joerg. Bump date. 2007-08-02 23:45:10 +00:00
ad
2813873c47 Remove unused counters. 2007-08-01 21:48:19 +00:00
pooka
78302eef99 Per rumble's lead in vnodeops, clarify the bit about readdir cookies. 2007-07-31 21:48:18 +00:00
ginsbach
f5f9bb5739 Make sure that %r honors the LC_TIME t_fmt_ampm. This restores
functionality lost at revision 1.12!
2007-07-31 20:19:16 +00:00
joerg
577a8c7029 Add build glue for libarchive and update the various sets. 2007-07-29 17:06:00 +00:00
pooka
8631cf4e2b mmap fflags -> prot 2007-07-27 08:28:16 +00:00
pooka
b2a631b1fe * add missing credential handle to fsync args
* and now with more cosmetic attack
2007-07-25 09:10:26 +00:00
pooka
9825955cc2 pure cosmetics: minor facelift 2007-07-25 08:31:19 +00:00
dyoung
bfa27930cb In sockaddr_snprintf(sbuf, len, fmt, sa), do not write the terminating
null character outside of the byte region [sbuf, sbuf + len).

1) If the length of the buffer is 0, do not write a null character
   at all.  Previously, sockaddr_snprintf() may have been able to
   overwrite sbuf[-1] if len was 0.

2) If the length of the buffer, len, is greater than 0, then write
   the null at sbuf[len - 1].  Previously, sockaddr_snprintf()
   wrote the null at buf[len - 1], where `buf' was a "cursor" that
   did not necessarily equal `sbuf', the start of the buffer.  Now,
   sockaddr_snprintf() always writes the null at sbuf[len - 1].
2007-07-24 08:45:45 +00:00
blymn
f8e74d7a72 Redraw an item when the value is changed as the mark/unmark status (if
applicable) may have changed.
2007-07-23 12:12:19 +00:00
pooka
b0e54182a4 document puffs_framev_enqueue_waitevent 2007-07-21 09:36:49 +00:00
pooka
e30ed21300 Return -1 and errno from puffs_framev_enqueue_waitevent instead of
a direct error value.
2007-07-21 09:29:07 +00:00
pooka
e2dc8334cf simplify send loop 2007-07-20 14:55:42 +00:00
pooka
343e8df31e Add puffs_framev_enqueue_waitevent, which waits for read/write/error
events from an i/o descriptor.  It yields until an event happens
and continues execution when the event loop notices the event has
happened.
2007-07-20 13:14:55 +00:00