Commit Graph

12067 Commits

Author SHA1 Message Date
ad
81e619b9a4 Update for jemalloc. 2007-10-06 01:09:48 +00:00
ad
9b64888c5d Use jemalloc as the default allocator unless USE_JEMALLOC=no. 2007-10-06 01:09:07 +00:00
ad
e7a9e46b7e Port to NetBSD. Note: posix_memalign() is here, but it's not exported
via the headers yet.
2007-10-05 23:42:23 +00:00
ad
8a475bcba1 Pull in jemalloc from FreeBSD:
FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.147 2007/06/15 22:00:16 jasone Exp
2007-10-05 23:39:58 +00:00
pooka
c8c5d830fc SEE ALSO paper 2007-10-05 00:04:59 +00:00
ad
507f1ca139 Compile pthread_getspecific / pthread_setspecific with -fomit-frame-pointer
-falign-functions=32, since these two really get hammered on. To make them
faster needs a threadreg or TLS, unless there is a way to tell gcc that a
library-local (pthread__threadmask) variable does not need to be PIC.
2007-10-04 21:08:35 +00:00
ad
5059087834 Drop PTHREAD__NSPINS back from 1000 to 64. Setting the waiters bits and
preparing to sleep on a mutex are slow in relative terms, so this allows
us to recover from short lock holds without blocking, while not wasting
too much time on longer holds.
2007-10-04 21:04:32 +00:00
ad
a4b475cd22 Fix a thinko. 2007-10-04 01:46:49 +00:00
pooka
0e5d568d01 minor updates/clarifications 2007-10-02 13:41:44 +00:00
pooka
174fb761dd Pass reason string to pu_errnotify. Print it in the default
version before aborting.
2007-10-01 21:10:50 +00:00
pooka
930ce5ac9b support error notifications 2007-09-29 22:07:32 +00:00
tnozaki
fc34dcfbb7 s/__attribute__((__packed__))/__packed/g; 2007-09-29 08:10:17 +00:00
tnozaki
059d600590 1. add workaround for ctype.h is* funcs problem.
isspace((int)0xA0) should return false under LC_CTYPE=en_US.UTF-8,
   see: http://www.freebsd.org/cgi/query-pr.cgi?pr=116363&cat=gnu
2. change __runtable_to_netbsd_ctype() as reentrant.

patch ok'ed by tshiozak-san, thanks!
2007-09-29 07:55:45 +00:00
lukem
2aa3c760cc support nbtool_config.h. 2007-09-28 09:07:16 +00:00
pooka
6eff998647 silence lint. also noticed by xtraeme 2007-09-27 23:11:41 +00:00
pooka
aa533e99dd Add error notifications, which are used to deliver errors from the
kernel to the file server for silly things the file server did,
e.g. attempting to create a file with size VSIZENOTSET.  The file
server can handle these as it chooses, but the default action is
for it to throw its hands in the air and sing "goodbye, cruel world,
it's over, walk on by".
2007-09-27 21:14:49 +00:00
christos
f1f2d5a365 make this compilable from rtld. 2007-09-27 17:53:05 +00:00
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