Commit Graph

12515 Commits

Author SHA1 Message Date
ginsbach
0d03389c52 Treat input "0x" as invalid and return INADDR_NONE. Inspired by
FreeBSD-PR 92880.
2008-01-19 03:46:52 +00:00
martin
3049bc6660 Use the new information about per-cpu mappings. Gdb now can examine
the interrupt stack.
2008-01-18 16:26:09 +00:00
christos
4e783482fa Fix off-by-one buffer overflow. VU#203611, CVE-2008-0122 2008-01-18 16:20:57 +00:00
christos
00f5cbb6dc From Richard M Kreuter: GLOB_PERIOD fix for trailing ./ or ../ 2008-01-18 16:20:00 +00:00
pooka
c142350bc6 Fix fakecc case.
Noticed by Pavel Jirout on current-users
2008-01-17 17:43:14 +00:00
pooka
9f5abca72f Comment out the puffs_executor hacks for now, they have races.
The issue should be solved in another fashion anyway.
2008-01-16 23:17:43 +00:00
pooka
614c59fcb2 Cache a number of execution contexts instead of re-initializing
them every time.  Speeds up pure in-memory file systems such as
sysctlfs or dtfs quite a bit.  For actual I/O-workhorses the result
is of course less tasty.
2008-01-16 21:29:59 +00:00
ad
bbc79e58a6 Pull in my modules code for review/test/hacking. 2008-01-16 12:34:50 +00:00
pooka
3a433fe13b Use PROT_NONE page to protect bottom of stack from overrun 2008-01-16 00:29:42 +00:00
ad
eba222df68 ... and make kvm_dump_inval() work on the raw device. 2008-01-15 14:16:30 +00:00
ad
a7a2d171df Handle reading from raw disk devices. 2008-01-15 13:57:41 +00:00
rmind
5c71a4d49f Implementation of processor-sets, affinity and POSIX real-time extensions.
Add schedctl(8) - a program to control scheduling of processes and threads.

Notes:
- This is supported only by SCHED_M2;
- Migration of LWP mechanism will be revisited;

Proposed on: <tech-kern>. Reviewed by: <ad>.
2008-01-15 03:37:10 +00:00
pooka
86499e8154 Remove puffs_ops from fuse_operations, no reason for it to be there. 2008-01-14 20:46:11 +00:00
pooka
aa3b40df48 return -ret from statfs 2008-01-14 16:07:00 +00:00
pooka
d7412d56b1 Introduce PUFFS_STACKSIZE_MIN to avoid overloading 0 and getting
a warning from the library when really wanting to say "just the
minimum, please".
2008-01-14 13:57:26 +00:00
simonb
ccab3b34ce Remove support for NetBSD/pc532. 2008-01-10 13:40:36 +00:00
elad
e7f75b7de6 PR/35562: khorben at defora dot org: Potential denial of service when
listing files on an NFS share

Limit the number of retries as suggested in the PR.

Reviewed by and okay fvdl@.
2008-01-10 09:49:04 +00:00
martin
8f4340d1d4 Modify the high part of the fraction so that we recognize our __infinityl
value.
XXX - seems like we could share this with LE archs
2008-01-10 00:34:27 +00:00
simonb
d8de5b102b Remove support for NetBSD/pc532. 2008-01-09 11:25:58 +00:00
christos
c6409540ef add missing static decls. 2008-01-08 20:56:08 +00:00
christos
6c924f05f9 cast -1 to unsigned int. 2008-01-08 20:55:58 +00:00
christos
72f5cf0283 no semis after weak alias. 2008-01-08 20:55:25 +00:00
pooka
1309a27c5e liberate gas-huffin crack-puffin' assert 2008-01-08 00:22:31 +00:00
yamt
48a1e4cf46 pthread_curcpu_np: map LWPCTL_CPU_NONE to 0 so that this works in the case
of _lwp_ctl failure.
2008-01-07 11:51:43 +00:00
christos
5f01dfbd0d PR/37708: A.Leo.: getservbyname, segetaddrinfo sefgfaults when user has no
rights for reading ``/etc/services''
2008-01-06 16:34:18 +00:00
christos
9780e68402 warns=4 2008-01-05 20:00:49 +00:00
jld
1717a7fe75 Add address translation support for 4MB pages, which we use to map the
kernel text.
2008-01-05 06:54:12 +00:00
jld
324e44d74f The address translation routine needs to use the plN_pi macros (for
indexing into the PTP), not the plN_i ones (for indexing into the entire
linear page table); cf. the analogous code for amd64.  Fixes ~everything
to do with kernel core dumps on i386.
2008-01-05 06:22:55 +00:00
ad
b43749fde1 machine/lock.h, not sys/lock.h 2008-01-05 01:37:35 +00:00
christos
aa33183605 Simplify and check for snprintf() error. 2008-01-03 04:26:27 +00:00
pooka
cf16702d95 fix pasto 2008-01-02 18:11:01 +00:00
pooka
b181a1a237 Also pass fromname in the "distributed" case. 2008-01-02 17:57:51 +00:00
pooka
636e495315 Provide some transparent "support" for "distributed" file systems.
If the env variable PUFFS_COMFD is set, the descriptor value
contained in it is used for communication instead of opening
/dev/puffs and doing mount(2).

This feature is obviously very undocumented and should not be used
without adult supervision.
2008-01-02 14:27:42 +00:00
christos
8bb176858f block signals before playing with files. From Anon Ymous 2008-01-01 21:22:55 +00:00
chris
cf792ccc84 Update libkvm to be able to deal with arm kernel core dumps.
These changes allow savecore to successfully save a kernel core dump.

Final part of fixing PR cats/18026
2008-01-01 14:10:37 +00:00
martin
e094ff6106 Add missing stubs for syscalls returning addresses.
We can now run on a kernel that does not copy the syscall return value
to register A0.
As discussed in PR port-m68k/37631.
2007-12-31 07:39:19 +00:00
martin
93310937f3 Avoid munmap(-1, ...) - doesn't make much sense. 2007-12-28 00:39:32 +00:00
pooka
38a05cc07d Flesh this out a bit more. Unfortunately it's still unfinished,
and I don't know when I'll get a chance to finish it.
2007-12-27 18:50:42 +00:00
pooka
cb36cc5493 Uncommit accidentally committed PUFFS_FLAG_OPDUMP.
overextensive library verbosity noticed by riz
2007-12-27 11:39:06 +00:00
pooka
c3b193c57f Add a public interface for setting a cookie mapper. 2007-12-25 20:38:01 +00:00
pooka
80ecfb9fc9 * dump r/w return resid
* fix RV dump order to be more logical
2007-12-25 20:36:53 +00:00
ad
622bbc505a - Use pthread__cancelled() in more places.
- pthread_join(): assert that pthread_cond_wait() returns zero.
2007-12-24 16:04:20 +00:00
ad
989565f81d - Fix pthread_rwlock_trywrlock() which was broken.
- Add new functions: pthread_mutex_held_np, mutex_owner_np, rwlock_held_np,
  rwlock_wrheld_np, rwlock_rdheld_np. These match the kernel's locking
  primitives and can be used when porting kernel code to userspace.

- Always create LWPs detached. Do join/exit sync mostly in userland. When
  looped on a dual core box this seems ~30% quicker than using lwp_wait().
  Reduce number of lock acquire/release ops during thread exit.
2007-12-24 14:46:28 +00:00
ad
8f05f9cc26 Update. 2007-12-24 14:30:09 +00:00
skrll
24ced765a1 Add a comment explaining stack layout and register contents. 2007-12-22 14:10:03 +00:00
yamt
392c2dc8c2 sync with kernel. 2007-12-22 01:22:03 +00:00
martin
53a105b083 Disable the umac-64 MAC for now, it needs to be rewritten from scractch.
Addresses PR bin/37562.
2007-12-20 14:14:04 +00:00
pooka
a8e13cb420 Add generic getattr routine. 2007-12-19 14:01:16 +00:00
christos
cd7947efb0 update to 4.7 2007-12-18 02:34:32 +00:00
pooka
08c7b6138e * nuke puffs_cc_get{specific,usermount} for good
* move prototypes for puffs_docc and puffs_dopufbuf into the
  public header, as they are should be exposed
2007-12-16 20:02:57 +00:00
pooka
369391b0a0 Clarify that link_target in node_symlink is null-terminated. 2007-12-16 19:10:58 +00:00
lukem
433c095cb8 Add references to various protocol pages that support setsockopt(2).
Makes it much easier to find them.
2007-12-16 09:49:28 +00:00
pooka
049d39b202 document puffs_dopufbuf 2007-12-15 20:11:38 +00:00
pooka
96294df307 update to match reality 2007-12-15 20:08:06 +00:00
perry
4d096031f0 replace instances of __attribute__((__packed__)) with __packed 2007-12-15 16:03:29 +00:00
yamt
5107db92df document following system calls.
_lwp_ctl
	_lwp_getname
	_lwp_setname
2007-12-14 21:52:17 +00:00
yamt
45cbede9e5 document following functions.
pthread_attr_getname_np
	pthread_attr_setname_np
	pthread_getname_np
	pthread_setname_np
2007-12-14 21:51:21 +00:00
yamt
b367d7f8b2 fix indentation. 2007-12-14 19:51:37 +00:00
xtraeme
5ee1eac43a Fix up a comment. 2007-12-14 17:32:47 +00:00
christos
6d28b23da6 - add dehumanize_number
- decls for humanize_number and dehumanize_number are in stdlib.h
2007-12-14 17:26:19 +00:00
christos
b31749e77b add fw decl. 2007-12-14 17:06:07 +00:00
christos
b76677eda5 fix obvious bogon [can't alias symbol to itself] 2007-12-14 17:04:28 +00:00
xtraeme
486b2ff085 The humanize_number(3) proto will be available in stdlib.h, after
christos moves it to the correct place.
2007-12-14 16:31:20 +00:00
macallan
f53566168d make this compile again 2007-12-12 17:56:10 +00:00
xtraeme
c747551b64 puffs_fuse_node_create: if create() is specified set S_IFREG explicitly
to avoid passing unspecified mode. Fixes latest ntfs-3g... patch
from pooka tested by myself.
2007-12-12 16:37:56 +00:00
pooka
d24dc71203 nuke #define whose purpose has ceased to be 2007-12-11 20:17:26 +00:00
ad
5a5d5865cd Remove test of pthread__osrev that is no longer needed. 2007-12-11 03:21:30 +00:00
adrianp
f5bbb7d634 Cosmetic path changes just clarifying where we actually get the contents
of these files from.
2007-12-09 22:44:12 +00:00
adrianp
d905c3e71c OpenSSL switched to using Makefile (as opposed to Makefile.ssl) a little
while ago now.
2007-12-09 21:57:35 +00:00
pooka
6617b3099a print newnode cookie value for operations which create nodes 2007-12-09 16:54:17 +00:00
agc
3cda7b4363 Use the portable md5 routines that have been added to the NetBSD iSCSI
distribution.
2007-12-09 09:23:58 +00:00
pooka
319ddafdc5 Now that "l" is gone both as an argument to operations and from
componentname, remove all vestiges of puffs_cid.
2007-12-08 19:57:02 +00:00
jdc
7cc6075b0e Keep pushed-back characters locally. Fixes problems where KEY_* symbols
are pushed back.  Should fix the arrow keys part of PR pkg/37173.

While we are here, make getch() and get_wch() check for resize immediately,
instead of reading a key, checking for resize and then having to push-back
the just read key.
2007-12-08 18:38:11 +00:00
he
c26a54ba24 Ensure that we pass -z initfirst to the linker. The mips gcc
was unhappy about the missing -Wl specification.
2007-12-08 18:34:51 +00:00
wiz
397b6da020 Fix typo, remove superfluous minus and describe "fd" as file descriptor
in two places.
2007-12-08 10:56:06 +00:00
ad
37132d5d2f Back out previous now that libc/libpthread are initialized first. 2007-12-07 20:36:52 +00:00
ad
558a5ffd0f rtld changes for PR bin/37347:
- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
  should be recording a dependency on libc, but it's too late to do that.

Ok christos@.
2007-12-07 20:34:04 +00:00
pooka
dc3259d60e puffs_cc_getusermount(), puffs_cc_getspecific() and puffs_docc() are dead. 2007-12-07 14:55:12 +00:00
simonb
179bda4711 Fix twalk()s 3rd argument name so that it matches rest of manpage and
the source code.
2007-12-07 07:33:13 +00:00
ad
a9718d7115 pthread__mutex_lock_slow: avoid entering the waiters list if a race to
acquire the mutex is lost. Removing the current thread from the waiters
list requires at least one syscall.
2007-12-07 01:38:38 +00:00
dyoung
eac83fd0cb Use __arraycount(). 2007-12-06 22:51:57 +00:00
seb
975a58878b Fix stresep(3) handling of consecutive quoted delimiter characters.
Approved by christos@
2007-12-06 22:07:07 +00:00
christos
14c8a52580 From Richard M Kreuter, add GLOB_PERIOD. 2007-12-05 20:25:54 +00:00
pooka
9bc20dea14 free flushbuffer after use 2007-12-05 18:55:19 +00:00
pooka
7d5d7f4ff9 Send a response message for flush operations from the kernel instead
of abusing the return value of write(2).
2007-12-05 12:11:56 +00:00
pooka
ca8fca7bb9 inverse inverse logic 2007-12-05 11:06:05 +00:00
pooka
8dad772fa4 apply previous in a more readable way 2007-12-05 10:13:37 +00:00
dogcow
96302ffc73 "fix" complaints about type-punned pointers with some icky casts. 2007-12-05 04:29:10 +00:00
mjf
d4a648c345 Implement a new magic string for magic symlinks, @ruid, which exapnds to the
real user id of the process and use this magic string for per-user tmp.
This should fix PR/35687

Kernel parts reviewed by wrstuden@
2007-12-04 22:09:01 +00:00
pooka
61113f40fd Part 3/n of extensive changes to message handling:
Get rid of the original puffs_req(3) framework and use puffs_framebuf(3)
instead for file system requests.  It has the advantage of being
suitable for transporting a distributed message passing protocol
and therefore us being able to run the file system server on any
host.

Ok, puffs is not quite here yet: libpuffs needs to grow request
routing support and the message contents need to be munged into a
host independent format.  Saying which format would be telling,
but it might begin with an X, end in an L and have the 13th character
in the middle.  Keep an eye out for the sequels: Parts 3+m/n.
2007-12-04 21:24:10 +00:00
pooka
cf878f1627 add flushops 2007-12-04 20:03:40 +00:00
pooka
661a5edd0a tyop: reserver -> reserve 2007-12-04 19:40:45 +00:00
christos
b831a8ada2 move decls for _malloc_{pre,post}fork() to extern.h 2007-12-04 17:45:07 +00:00
christos
86ef91b80e - use a non localized version of strerror_r.
- kill localized declarations and let namespace.h do its work.
2007-12-04 17:43:51 +00:00
pooka
2049bce7a5 realloc() len+incr, not offset+incr. Makes space reservation
actually work properly.
2007-12-04 17:21:24 +00:00
yamt
f078e05288 pthread__mutex_wakeup: ignore ESRCH from _lwp_unpark.
once we clear pt_sleeponq, the target thread can proceed further
and even do pthread_exit.
2007-12-04 16:56:11 +00:00
yamt
fc51c23a2d remove unnecessary assignments. 2007-12-04 16:08:28 +00:00
wiz
1746ee1de1 Add comma in enumeration. Punctuation nits. Fix a typo. 2007-12-02 22:05:51 +00:00
wiz
6db764bae5 Add comma in enumeration. 2007-12-02 19:43:10 +00:00
skrll
fd903b1729 Implement ptrace. 2007-12-02 15:48:47 +00:00
skrll
819071140e Fix include files and change use LEAF_ENTRY_NOPROFILE function to fix
the unwind entry.
2007-12-02 14:04:19 +00:00
skrll
587600728d Fix things so that crti.o doesn't contain a completely bogus unwind entry
that covers far too much and confuses gdb.

While here remove useless dave/restore of r4.
2007-12-02 13:55:38 +00:00
rillig
d59ceee59e ENOENT is also returned when the script interpreter does not exist. 2007-12-02 10:26:27 +00:00
ad
8b96cb8a97 Back out the per-cpu arena changes. With this, ld.so magically stops
loading libc/libpthread twice -- which does not make sense, because it
has its own private malloc().
2007-12-01 22:44:44 +00:00
wiz
9429ef03ff Fix another persistent spello. 2007-12-01 19:54:01 +00:00
wiz
0b6ffdfedb Fix a typo that has migrated across files. 2007-12-01 19:18:49 +00:00
wiz
a6e62b1ef7 Use more markup. New sentence, new line. 2007-12-01 19:03:26 +00:00
pooka
c8c3c477bb fix gotframe signature to match code 2007-12-01 18:59:36 +00:00
wiz
8498f992c4 Typo fixes. 2007-12-01 18:53:28 +00:00
wiz
46b4723955 eg -> e.g. 2007-12-01 18:33:11 +00:00
yamt
c2ad33834a CLEANFILES=${OBJS} 2007-12-01 11:06:36 +00:00
yamt
82f3754f04 ___start: remove a stale comment. 2007-12-01 10:16:06 +00:00
ad
64ebe1397e Hack around ld.so initializing pthread users before libpthread/libc. 2007-12-01 01:19:31 +00:00
ad
b565a56cfb - On 64-bit platforms 1/2 the default tsd values were garbage. Fix it.
- The lwpctl block is now needed on uniprocessors, for pthread_curcpu_np().
2007-12-01 01:07:34 +00:00
rillig
b54c9d13a0 typo 2007-11-30 23:01:03 +00:00
pooka
21913eabe5 Rototill.
Ok, ok, a few more words about it: stop holding puffs_cc as a holy
value and passing it around to almost every possible place (popquiz:
which kernel variable does this remind you of?).  Instead, pass
the natural choice, puffs_usermount, and fetch puffs_cc via
puffs_cc_getcc() only in routines which actually need it.  This
not only simplifies code, but (thanks to the introduction of
puffs_cc_getcc()) enables constructs which weren't previously sanely
possible, say layering as a curious example.

There's still a little to do on this front, but this was the major
fs interface blast.
2007-11-30 19:02:28 +00:00
dsl
b3dec55727 Fix the other half of the 'store int as a thread specific pointer'/ 2007-11-30 17:44:38 +00:00
christos
e09a2e99e8 converting a pointer to unsigned is bad; use uintptr_t. 2007-11-30 17:09:22 +00:00
ad
49dcd767c3 Make the allocation arenas per-CPU in the most optimistic case, but
continue to 'stripe' by thread in case of contention.
2007-11-29 18:46:13 +00:00
pooka
aadcb17f11 * allocate pcc as a slice from the stack instead of allocating it
separately
* provide puffs_cc_getcc()

This is in preparation for the removal of you-should-guess-what as
an argument to routines here and there and everywhere.
2007-11-29 17:47:54 +00:00
pooka
73a538eac2 print mode in open 2007-11-29 17:22:04 +00:00
christos
f6cecc05cf Sync phk malloc.c with the latest one from FreeBSD. This gives us the
same api as jemalloc by:

    - adding posix_memalign()
    - moving calloc in the same file
    - renaming malloc_options -> _malloc_options
2007-11-28 21:55:14 +00:00
christos
621fa4d8c6 Regen! 2007-11-27 22:19:11 +00:00
christos
5b5262a0af another minor fix from Anon Ymous 2007-11-27 22:16:03 +00:00
ad
ae87f94d1d Bump libc/libpthread minor for thr_curcpu()/pthread_curcpu_np(). 2007-11-27 21:06:41 +00:00
ad
4084ca7f3f Add thr_curcpu(), pthread_curcpu_np(). 2007-11-27 20:58:26 +00:00
ad
d5e9b90716 Fix a warning with _LP64. 2007-11-27 20:55:03 +00:00
pooka
6a3d9a187d Remove "puffs_cid" from the puffs interface following l-removal
from the kernel vfs interfaces.  puffs_cc_getcaller(pcc) can be
used now should the same information be desired.
2007-11-27 11:31:17 +00:00
tnozaki
7e1ba00ce8 more PR/36938, restore internal-state if mbtowc() throw EILSEQ.
patch provided by Shiozaki-san, thanks.
2007-11-26 15:31:30 +00:00
christos
1f07a76abf fix substitutions. From Anon Ymous 2007-11-26 15:12:06 +00:00
pooka
7568ff51e1 print more info when receiving an abort 2007-11-26 12:20:21 +00:00
dsl
d8e8042c1c Add a note about the difficulty of actually looking at the return value
of __syscall() caused by ABIs (eg sparc) that don't pass the low bits of
a 64 bit result in the same register as a 32 bit result.
2007-11-23 20:29:40 +00:00
uebayasi
2b37ebddcf KNF; no variable name in function prototype. 2007-11-23 12:39:15 +00:00
dsl
3ba44b945b Reorder the code for i386 and amd64 syscall stubs so that the 'jc' on error
is a forwards jump instead of a backwards jump that a P4 will mispredect (and
probably immediatly get a cache-line miss due to the way the code gets
aligned).
2007-11-23 07:36:05 +00:00
dsl
b0b7248d92 Change all the syscall C 'glue' functions (most of which just add in an
extra argument to ensure that 'off_t' parameters are even numbered
parameters for stack alignment reasons on 32 bit systems) to use a normal
'syscall' wrapper for __foo instead of using __syscall(SYS_foo, ... ).
This saves all the faffing needed to get a 32bit return value on sparc.
Auto-generate the extra syscall wrappers.
Move swapon.c into the correct list (swapon() uses swapctl()).
This probably means there are very few users of syscall() and __syscall() left.
2007-11-22 21:11:30 +00:00
tnozaki
fca38949e4 fix lib/37290
- don't call abort(3) when there's no suitable charset found.
- use iso-8859-1(or INIT1 if specified) for C1 control char.
2007-11-21 14:19:32 +00:00
rillig
55bf992f36 The e* functions don't call the error handler in every case, just in
case of an error.

Mentioned the error conditions for the various functions.
2007-11-21 09:17:24 +00:00
ad
a4c99db9fe Sync with reality, and note that programs must link against the dynamic
libpthread in order to remain compatible with future releases of NetBSD.
2007-11-19 15:53:20 +00:00
ad
8077340e63 Remove the debuglog stuff. ktrace is more useful now. 2007-11-19 15:14:11 +00:00
ad
a448c4f214 int -> ssize_t in a couple of places. 2007-11-19 15:12:18 +00:00
ad
95182011ed Enable posix_memalign(). 2007-11-19 14:48:41 +00:00
skrll
4f3467d61e Remove unused include.
Fix unwind info with S/ENTRY/LEAF_&/
2007-11-18 14:11:25 +00:00
skrll
8ed2bd6ec6 Generate correct unwind info for syscall stubs by using LEAF_ENTRY instead
of ENTRY(foo,0) so that gdb can backtrace through the stubs.
2007-11-18 13:25:39 +00:00
jdc
ca32a8e578 We don't need to call __init_getch here, as it is called from
screen.c:newterm().
2007-11-18 10:01:04 +00:00
pooka
dac2b0c689 fix request size 2007-11-17 17:12:11 +00:00
pooka
4b2334142b puffs_mount():
* initialize values better
* always go through "fail" to see if puffs_daemon() needs to be
  woken up
* open device r/w instead of r/o
2007-11-17 16:06:18 +00:00
plunky
06e82841a0 Fix problem with handling SDP contination state, from FreeBSD
(specifically, this manifested itself when reading a long HID
descriptor from a Microsoft Mouse.)
2007-11-16 19:35:08 +00:00
pooka
3537e99eb1 Introduce puffs_daemon(), which works like daemon(3) except that it
also synchronizes with puffs_mount() and does not return (exit) in the
parent process until the file system has been mounted.  This makes
it possible to reliably run e.g. mount_foo jippi /kai ; cd /kai/ee
2007-11-16 18:35:10 +00:00
pooka
154c2e54fb dump lookup return values 2007-11-16 14:59:14 +00:00
drochner
095b25e7dd Add pthread_equal() to libc stubs; this makes a lot of sense for
threadsafe libraries implementing own locking functions.
Ride on yesterday's minor version bumps.
2007-11-14 19:28:23 +00:00
ad
4be57c5368 Don't try to block if there are already waiters; it doesn't make sense. 2007-11-14 17:20:57 +00:00
ad
b919eb8116 Crank libpthread to 0.8. It now uses _lwp_ctl(), and it's handy to keep
0.7 hanging around for old kernels.
2007-11-13 17:22:51 +00:00
ad
66ac2ffaf2 Mutexes:
- Play scrooge again and chop more cycles off acquire/release.
- Spin while the lock holder is running on another CPU (adaptive mutexes).
- Do non-atomic release.

Threadreg:

- Add the necessary hooks to use a thread register.
- Add the code for i386, using %gs.
- Leave i386 code disabled until xen and COMPAT_NETBSD32 have the changes.
2007-11-13 17:20:08 +00:00
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