Commit Graph

12212 Commits

Author SHA1 Message Date
ad
3c776c8aa6 Bump libc minor for _lwp_ctl, libpthread constructor changes. 2007-11-13 17:13:14 +00:00
ad
15e9cec117 For PR bin/37347:
- Override __libc_thr_init() instead of using our own constructor.
- Add pthread__getenv() and use instead of getenv(). This is used before
  we are up and running and unfortunatley getenv() takes locks.

Other changes:

- Cache the spinlock vectors in pthread__st. Internal spinlock operations
  now take 1 function call instead of 3 (i386).
- Use pthread__self() internally, not pthread_self().
- Use __attribute__ ((visibility("hidden"))) in some places.
- Kill PTHREAD_MAIN_DEBUG.
2007-11-13 15:57:10 +00:00
ad
46f5cd4fb9 - Make it pass lint.
- Add RCSID.
2007-11-13 15:33:55 +00:00
ad
ec4d182d4a - stack_protector.c doesn't really belong under sys/. Add a new directory
for misc support routines and put it there.
- Add a libc constructor. Use this to initialize threading and the
  stack protector stuff. libpthread cannot be initialized safely using
  its own constructor because libc and libpthread are deeply intertwined.
  PR bin/37347
2007-11-13 15:21:19 +00:00
he
4869f8a215 Need to point to sys/ for includes to pick up <sys/lwpctl.h> for
the lint stubs.
2007-11-13 10:22:15 +00:00
he
3b9b3c5341 We now need <sys/lwpctl.h> included in order to lint LintSysNormal.c. 2007-11-13 09:07:33 +00:00
skrll
6e57c35ead Remove an include that's not required. 2007-11-13 08:41:50 +00:00
ad
9202b10ca9 Cosmetic change. 2007-11-13 01:21:32 +00:00
ad
b668a9a05f Add _lwp_ctl() system call: provides a bidirectional, per-LWP communication
area between processes and the kernel.
2007-11-12 23:11:58 +00:00
ad
51a2159851 Don't unconditionally clear the direction flag. The ABI says it must always
be clear when making a function call, and 'cld' takes about 50 clock cyles
on the P4.
2007-11-12 18:41:59 +00:00
pooka
805571cfce remove header that was never committed 2007-11-12 17:35:32 +00:00
pooka
9ac65ee1fe * split the putter header into a kernel version and a userland version
+ install latter to /usr/include/dev/putter
* remove last dependencies to puffs from putter, it's completely
  independent now
2007-11-12 16:39:32 +00:00
jmmv
096ebe7672 Add the libatf library
This adds reachover Makefiles to build the libatf library and enables it in
the parent Makefile.

Things to review in this change:

* Add proper version numbers in the shlib_version files.

* Is libatf properly listed in lib/Makefile?  It theoretically needs
  libstdc++, but the resulting binary library is not linked against it.
2007-11-12 14:56:24 +00:00
christos
0405bf4cb9 always compile getopt_long. some ifdef reduction. more to come. 2007-11-09 03:29:20 +00:00
joerg
b9d83a2411 Fix a typo in the last change that broke a comparision. 2007-11-08 21:58:26 +00:00
martin
4cdfe9d3ee When creating unsigned int results, do not distinguish positive versus
negative overflow.
2007-11-08 21:31:04 +00:00
joerg
6475789b74 Add kvm_dump_header and implement kvm_dump_wrtheader on top of it.
This function allows the caller finer control of how the writes happen
and doesn't force stdio as interface. Optimise clear_gap a bit to not
fill the gap byte-wise. Bump minor version of libkvm.
2007-11-08 20:48:04 +00:00
drochner
754fc2622c Set the number of record and play channels individually -- currently
we try to set both in one ioctl, to the same value, which fails if not
both record and play direction support that many channels. (Having
more play than record channels is common these days.)
This does likely address part of the problem described in PR pkg/35444
by Mihai Chelaru, and it helped Matthew R. Green about half a year
ago -- see the thread in tech-misc in April.
2007-11-08 20:27:25 +00:00
joerg
4267598f61 ANSIfy. 2007-11-08 17:32:30 +00:00
pooka
6b61e56541 I've written more than a fair share of this to see my name up in
lights.  Wine & women, come to me now!
2007-11-08 17:08:46 +00:00
martin
5265977a9e When converting long double values to integer types, explicitly use the
"round to zero" variants of the softfloat conversion functions.
Add a variant to convert long double to unsigned long - the "to long"
variant checked for overflows that do not apply to unsigned results.
This fixes the regress/lib/libc/convfp tests for sparc64.
2007-11-08 15:50:19 +00:00
jdc
194f45e187 Fix the handling for added carriage return characters.
Should fix the "staircase effect" part of PR 36560.
2007-11-08 06:42:22 +00:00
jdc
55f0d59917 Make sure we copy the relevant cell (and not the first cell) for
each line that we copy.

We also need to touch the destination window here.

Fixes display bug in atc(6).  Bug reported by and fix tested by
David Holland.
2007-11-08 06:39:31 +00:00
jdc
52cd399dde Make sure we don't shrink windows or sub-windows so that they end up
with zero length or height.
2007-11-08 06:34:34 +00:00
ad
f63239c2a0 Use _lwp_setname() to pass thread names to the kernel. 2007-11-07 00:55:22 +00:00
ad
bdd61de26b Add _lwp_setname/_lwp_getname to libc. 2007-11-07 00:52:25 +00:00
christos
b3b90d7485 Revert previous. This mess of ifdefs needs to be killed. 2007-11-06 22:08:51 +00:00
martin
c607cb216f Mark the characters between 0x80 and 0xff as 1 cell wide, if compiled
with ALL_80_TO_FF_SW1 defined. This is not correct in the general case,
but helps in certain restricted environments where nothing but the
default locale is available and we know what we do(tm).
2007-11-06 19:24:19 +00:00
christos
9df03145fa move the test to replace getopt higher up, before we need to include anything. 2007-11-06 19:13:16 +00:00
pooka
a02fe51bef Open the kernel descriptor as part of mount(), not init(). Then
it doesn't matter if someone fork()s or does other tricks between
init() and mount() (and besides, now it's where it logically should be).
2007-11-06 15:09:07 +00:00
ad
8fd9a85c2a Catch up with scheduling changes in the kernel. 2007-11-06 01:46:08 +00:00
dsl
bd8185f2eb syscall() has to be implemented in the kernel - so is a normal system call here.This has always been broken, so I suspect everything is using __syscall(). 2007-11-05 20:30:07 +00:00
pooka
e5a1d7804c remember to bump version for puffs_mainloop() change 2007-11-05 17:55:23 +00:00
pooka
4b0f2948e2 Pull the daemonizing code out of the library mainloop into the file
servers.  Calling daemon() (i.e. fork()ing) inside a library can
cause nice surprises for e.g. threaded programs.  As discussed with
Greg Oster & others.
2007-11-05 17:48:17 +00:00
pooka
bcc59b911e Call puffs_genfs_reclaim directly instead of through an extra jumpgate. 2007-11-05 16:53:00 +00:00
pooka
02a45a4a7c Header cleanup: don't need defs.h to do a few includes for us. Also,
use #include <> for global headers instead of #include "".
2007-11-05 13:41:52 +00:00
pooka
8f078f842e * Fix pthread key creation to depend on if it hasn't been created before
instead of depending if a lock was succesfully acquired.  Also, add
  a comment explaining why it is such complex (for all I could guess).
* replace err()'s with abort()
* replace some abort()'s by returning failure
2007-11-05 13:38:27 +00:00
tls
6c2ee7b76e Describe libpthread dependency correctly and put bind libs in list of
dependent libs after .WAIT barrier in lib/Makefile.  Fixed build lossage
pointed out by smb.
2007-11-05 04:58:52 +00:00
martin
36097b1de9 Use the new sparc64 kcore cpu segment extensions to properly map VA/PAs
on kernels with more then 4 MB text/rodata segment.
2007-11-05 00:46:23 +00:00
tls
b21c402a7b Remove MKPRIVATELIB from BIND libraries; move library reachover
directories and Makefiles from src/usr.sbin/bind to src/lib; make
BIND libraries build shared.  Saves about 1MB-1.5MB per installed
executable, about 5MB for a base+etc minimal installation of NetBSD.
2007-11-04 23:28:16 +00:00
pooka
2592930cfe remember to bump date 2007-11-04 21:36:59 +00:00
pooka
057838d510 libc errlist uses "Block device required" for ENOTBLK, so display
that also here.
2007-11-04 21:35:48 +00:00
pooka
baea362887 Fix a few bugs and memleaks with the threading code. 2007-10-31 16:09:09 +00:00
skrll
29353f93e2 Build a local copy of exit that doesn't call __cxa_finalize. It's not
needed and drags in a lot of libc via free.
2007-10-30 17:19:59 +00:00
pooka
f7de032584 lock massage, although I don't think there's a happy ending here 2007-10-29 17:47:33 +00:00
pooka
40ffc8b91f Sprinkle some hackish locks here and there, just enough to allow
libp2k & rump to run multithreaded.
2007-10-29 15:52:44 +00:00
pooka
9038ffc17c Use puffs prepost ops for setting pid/lwpid instead of separate
calls in all methods.
2007-10-28 18:41:54 +00:00
pooka
b40b63f077 Add possibility to set pre- and post callbacks which will be called
for all operations before or after executing the specific callback
(the api is not be final yet, though).
2007-10-28 18:40:30 +00:00
skrll
f1273d89a6 Set up the tail of the instruction address queue so that
we don't have to rely on luck for swapcontext(3) to work.

This fixes a problem pointed out to me by Chuck Silvers.
2007-10-28 09:38:06 +00:00
christos
7d0c83db72 make _FORTIFY_SOURCE play nicely with lint 2007-10-26 19:48:14 +00:00
agc
a1b018359f -D_FILE_OFFSET_BITS=64 is not needed on NetBSD 2007-10-26 19:03:17 +00:00
pooka
edb40ac9bf Add some very initial support for a threading worker model as an
alternative to the (vastly superior ;) continuation model.  This
is very preliminary stuff and not compiled by default (which it
even won't do without some other patches I cannot commit yet).

The raison d'commit of the patch is a snippet which ensures proper
in-order dispatching of all operations, including those which don't
require a response.  Previously many of them would be dispatched
simultaneosly, e.g. fsync and reclaim on the same node, which
obviously isn't all that nice for correct operation.
2007-10-26 17:35:01 +00:00
pooka
944ce6a1a8 dump pid/lwp of caller 2007-10-26 17:24:45 +00:00
pooka
cb50a739c3 mmap stacks, makes it possible to align them 2007-10-26 13:51:14 +00:00
jdc
c4eef94666 Only resize curscr, __virtscr and stdscr when the screen is resized.
Note the behaviour of sub-windows when the parent window is resized.

Fixes PR pkg/37129.
2007-10-25 20:42:07 +00:00
jdc
542a57c041 Return "-1" for unknown keys and only return NULL for errors.
Make the key name string a static buffer.  The specification allows this,
so the previous behaviour would leak a small amount of memory, as the
application wouldn't free the returned string.

Fixes one part of PR pkg/37062.
2007-10-25 20:32:40 +00:00
pooka
5643bf6454 Make pu_haskq a flag instead of its own variable. 2007-10-25 10:59:45 +00:00
reed
b72da12b34 Add HISTORY: The strtof() and strtold() functions appeared in NetBSD
4.0.
2007-10-24 13:42:10 +00:00
pooka
e955e253d7 revert 1.77, MULTITHREADED_REFUSE has problems 2007-10-23 17:19:19 +00:00
tnozaki
561e0bd51b remove invalid range check. 2007-10-23 15:28:25 +00:00
simonb
e19457f411 Add a reference to RFC 2783. Requested by joerg@ 2007-10-22 05:35:37 +00:00
simonb
46de085339 Revert the CSE parts of the previous change. "run" is calculated with
a different value for "pageind" each time through the loop, so we can't
precalculate it.

Fixes awk core dump issues on powerpc 405.
2007-10-22 04:16:48 +00:00
pooka
753b7cae6e Add puffs_cc_schedule() which marks a pcc runnable and will pass
execution to it when in the main loop the next time.
2007-10-21 19:25:58 +00:00
pooka
c683f6f6b5 Get rid of MULTITHREADED_REFUSE for context queries. We can simply
use the pthread codepaths always.
2007-10-21 16:46:52 +00:00
he
71a133879f To work around lint problems, add a LINTED comment on pooka's request. 2007-10-21 16:29:40 +00:00
pooka
a3e1355fe5 Use new puffs features to provide correct caller info instead of
sometimes returning stale data.
2007-10-21 14:36:35 +00:00
pooka
be98071c8c Always provide caller information from the kernel based on curlwp.
(but don't deprecate the old puffs_cid interface just yet)
2007-10-21 14:28:05 +00:00
pooka
cc72c593dd typo in comment 2007-10-21 14:26:15 +00:00
christos
8de47c09e3 - do some CSE.
- pass lint
2007-10-19 19:28:57 +00:00
pooka
cf6e3aa4f9 When doing a read operation, don't copy the whole kernel buffer to
userspace, since it doesn't contain any information yet.  I should
still rework this more so this is just a quickie to get the read/write
style interface more up to speed with the ioctl version.
2007-10-19 14:38:45 +00:00
yamt
21ac91dd00 sync with kernel after the merge of yamt-x86pmap branch. 2007-10-18 15:30:43 +00:00
pooka
ce87c49167 * Change type of boolean functions to, well, boolean instead of int.
* add puffs_cid_isequal() which can be used to test if the two caller
  id's refer to the same process/lwp.
2007-10-18 13:48:04 +00:00
ad
84a6749ef2 Note that libpthread_dbg needs to be checked after making changes to
libpthread.
2007-10-16 15:21:54 +00:00
yamt
b79fded28d use mremap for huge -> huge realloc.
fix PR/31425 (Nicolas Joly) and possibly PR/36175 (Brian de Alwis).
2007-10-16 15:12:16 +00:00
ad
bc9419f99a Crank libpthread_dbg major. 2007-10-16 15:11:27 +00:00
ad
f1b2c1c4c9 ... but preserve the linked list, for the debugger only. 2007-10-16 15:07:02 +00:00
ad
9472415c5e Remove stuff that is no longer useful. 2007-10-16 15:06:11 +00:00
ad
9583eeb248 Replace the global thread list with a red-black tree. From joerg@. 2007-10-16 13:41:18 +00:00
ad
9c3109d6c5 Add _SC_NPROCESSORS_ONLN and _SC_NPROCESSORS_CONF for sysconf(). These
are extensions but are provided by many Unix systems.
2007-10-15 14:12:54 +00:00
yamt
89aa62f9b2 we don't have reallocf. 2007-10-15 11:18:44 +00:00
yamt
687cd24ebe make lint happy. 2007-10-15 10:30:56 +00:00
yamt
1277f9b0a0 malloc_print_stats: print huge_allocated correctly. it's already in bytes. 2007-10-15 10:28:10 +00:00
yamt
14bfffc9db use MAP_ALIGNED. 2007-10-15 00:05:00 +00:00
jnemeth
66687b0cb5 SSP doesn't like alloca... 2007-10-13 20:36:43 +00:00
pooka
33c91738e5 Part 1/n of some pretty extensive changes to how the kernel module
interacts with the userspace file server:

  * since the kernel-user communication is not purely request-response
    anymore (hasn't been since 2006), try to rename some "request" to
    "message".  more similar mangling will take place in the future.

  * completely rework how messages are allocated.  previously most of
    them were borrowed from the stack (originally *all* of them),
    but now always allocate dynamically.  this makes the structure
    of the code much cleaner.  also makes it possible to fix a
    locking order violation.  it enables plenty of future enhancements.

  * start generalizing the transport interface to be independent of puffs

  * move transport interface to read/write instead of ioctl.  the
    old one had legacy design problems, and besides, ioctl's suck.
    implement a very generic version for now; this will be
    worked on later hopefully some day reaching "highly optimized".

  * implement libpuffs support behind existing library request
    interfaces.  this will change eventually (I hate those interfaces)
2007-10-11 19:41:13 +00:00
pooka
bf2346742b g/c #if 0'd code which isn't likely to get used any time soon 2007-10-09 21:04:55 +00:00
rmind
25e540085b Add cancellation stubs in libpthread for POSIX messages queues and
asynchronous I/O.

OK by <ad>.
2007-10-09 18:18:33 +00:00
ad
3465d8db6f Add defs for hppa. From he@. 2007-10-09 00:59:52 +00:00
skrll
c6deb42c81 Provide PTHREAD__ASM_RASOPS for alpha.
The gcc generated lock try RAS is broken as the store needs to be the last
instruction.
2007-10-08 16:04:43 +00:00
uwe
a34b3f871d In handwritten asm use -fPIC code instead of -fpic, our libc has grown
large enough for GOT to be larger than 8k.

While here kill redundant PIC ifdefs in setjmp.S - sparc "call"
instruction is piccy by itself.

Tested by martin@
2007-10-08 13:06:00 +00:00
he
7ed9cc8edd On sparc64, both __sparc__ and __sparc64__ is defined. Avoid redefinition
of size constants for sparc64.

This code still produces many, many lint warnings due to "may loose accuracy"
when mixing long/int, and also warnings related to <<.
2007-10-07 21:45:18 +00:00
christos
b093a7796c split LOGIN_SETGROUP -> LOGIN_SETGID|LOGIN_SETGROUPS 2007-10-06 21:51:21 +00:00
martin
167a3a9d68 Make it build without HAVE_WCHAR 2007-10-06 20:14:41 +00:00
martin
b3fd7f365b Make the non-WCHAR variant compilable. 2007-10-06 18:31:33 +00:00
xtraeme
8b2678bd7e Use a two clause license for all the code I contributed.
The envsys code will be changed later.
2007-10-06 07:21:02 +00:00
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