summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Adaptive mutexes should have the same deadlock detection properties thatkris2007-10-301-0/+1
| | | | | | default (errorcheck) mutexes do. Noticed by: davidxu
* Add my recent work of adaptive spin mutex code. Use two environments variabledavidxu2007-10-303-47/+50
| | | | | | | | | | | | | | | | | | | | | | | | | to tune pthread mutex performance: 1. LIBPTHREAD_SPINLOOPS If a pthread mutex is being locked by another thread, this environment variable sets total number of spin loops before the current thread sleeps in kernel, this saves a syscall overhead if the mutex will be unlocked very soon (well written application code). 2. LIBPTHREAD_YIELDLOOPS If a pthread mutex is being locked by other threads, this environment variable sets total number of sched_yield() loops before the currrent thread sleeps in kernel. if a pthread mutex is locked, the current thread gives up cpu, but will not sleep in kernel, this means, current thread does not set contention bit in mutex, but let lock owner to run again if the owner is on kernel's run queue, and when lock owner unlocks the mutex, it does not need to enter kernel and do lots of work to resume mutex waiters, in some cases, this saves lots of syscall overheads for mutex owner. In my practice, sometimes LIBPTHREAD_YIELDLOOPS can massively improve performance than LIBPTHREAD_SPINLOOPS, this depends on application. These two environments are global to all pthread mutex, there is no interface to set them for each pthread mutex, the default values are zero, this means spinning is turned off by default.
* Add a new "non-portable" mutex type, PTHREAD_MUTEX_ADAPTIVE_NP. Thiskris2007-10-292-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | is also implemented in glibc and is used by a number of existing applications (mysql, firefox, etc). This mutex type is a default mutex with the additional property that it spins briefly when attempting to acquire a contested lock, doing trylock operations in userland before entering the kernel to block if eventually unsuccessful. The expectation is that applications requesting this mutex type know that the mutex is likely to be only held for very brief periods, so it is faster to spin in userland and probably succeed in acquiring the mutex, than to enter the kernel and sleep, only to be woken up almost immediately. This can help significantly in certain cases when pthread mutexes are heavily contended and held for brief durations (such as mysql). Spin up to 200 times before entering the kernel, which represents only a few us on modern CPUs. No performance degradation was observed with this value and it is sufficient to avoid a large performance drop in mysql performance in the heavily contended pthread mutex case. The libkse implementation is a NOP. Reviewed by: jeff MFC after: 3 days
* When skipping input data, don't overflow a 32-bit size_t.kientzle2007-10-271-1/+1
| | | | | | | | | | | | | | This can only happen on 32-bit systems when you're reading an uncompressed archive and the skip request is an exact multiple of 4G (e.g., skipping a tar entry with an 8G body). The symptom is that the read_ahead() ends up returning zero bytes, and the extraction stops with a premature end-of-file. Using '1' here is more correct anyway, as it allows read_ahead() to function opportunistically and minimize copying. MFC after: 5 days
* Aparrently MACXOCOMLEN exisrts only on my machinejulian2007-10-261-1/+1
|
* Add a period for yar@.ru2007-10-261-1/+1
|
* Introduce a way to make pure kernal threads.julian2007-10-261-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | kthread_add() takes the same parameters as the old kthread_create() plus a pointer to a process structure, and adds a kernel thread to that process. kproc_kthread_add() takes the parameters for kthread_add, plus a process name and a pointer to a pointer to a process instead of just a pointer, and if the proc * is NULL, it creates the process to the specifications required, before adding the thread to it. All other old kthread_xxx() calls return, but act on (struct thread *) instead of (struct proc *). One reason to change the name is so that any old kernel modules that are lying around and expect kthread_create() to make a process will not just accidentally link. fix top to show kernel threads by their thread name in -SH mode add a tdnam formatting option to ps to show thread names. make all idle threads actual kthreads and put them into their own idled process. make all interrupt threads kthreads and put them in an interd process (mainly for aesthetic and accounting reasons) rename proc 0 to be 'kernel' and it's swapper thread is now 'swapper' man page fixes to follow.
* Correct documentation of ~/.opiealwaysdes2007-10-261-3/+5
| | | | | | PR: 117512 Submitted by: Jeremy C. Reed <reed@reedmedia.net> MFC after: 1 week
* First cut at support for booting a GPT labeled disk via the BIOS bootstrapjhb2007-10-241-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on i386 and amd64 machines. The overall process is that /boot/pmbr lives in the PMBR (similar to /boot/mbr for MBR disks) and is responsible for locating and loading /boot/gptboot. /boot/gptboot is similar to /boot/boot except that it groks GPT rather than MBR + bsdlabel. Unlike /boot/boot, /boot/gptboot lives in its own dedicated GPT partition with a new "FreeBSD boot" type. This partition does not have a fixed size in that /boot/pmbr will load the entire partition into the lower 640k. However, it is limited in that it can only be 545k. That's still a lot better than the current 7.5k limit for boot2 on MBR. gptboot mostly acts just like boot2 in that it reads /boot.config and loads up /boot/loader. Some more details: - Include uuid_equal() and uuid_is_nil() in libstand. - Add a new 'boot' command to gpt(8) which makes a GPT disk bootable using /boot/pmbr and /boot/gptboot. Note that the disk must have some free space for the boot partition. - This required exposing the backend of the 'add' function as a gpt_add_part() function to the rest of gpt(8). 'boot' uses this to create a boot partition if needed. - Don't cripple cgbase() in the UFS boot code for /boot/gptboot so that it can handle a filesystem > 1.5 TB. - /boot/gptboot has a simple loader (gptldr) that doesn't do any I/O unlike boot1 since /boot/pmbr loads all of gptboot up front. The C portion of gptboot (gptboot.c) has been repocopied from boot2.c. The primary changes are to parse the GPT to find a root filesystem and to use 64-bit disk addresses. Currently gptboot assumes that the first UFS partition on the disk is the / filesystem, but this algorithm will likely be improved in the future. - Teach the biosdisk driver in /boot/loader to understand GPT tables. GPT partitions are identified as 'disk0pX:' (e.g. disk0p2:) which is similar to the /dev names the kernel uses (e.g. /dev/ad0p2). - Add a new "freebsd-boot" alias to g_part() for the new boot UUID. MFC after: 1 month Discussed with: marcel (some things might still change, but am committing what I have so far)
* Fix reading of files that use pax 'size' attribute to store size.kientzle2007-10-241-7/+21
| | | | | | | In particular, bsdtar uses the pax 'size' attribute for any file over 8G. MFC after: 3 days
* Back out 2nd part of wrong iswascii() change in prev. commit.ache2007-10-231-1/+1
|
* Add a BUGS section to note that mount/chroot changes sincejb2007-10-221-0/+4
| | | | | | | | | a module was loaded might make the pathname inaccurate. I wonder if an inode reference should be stored with the pathname to allow a validity check? Suggested by: rwatson@
* - Stop calling libthr alternative as it's now the defaultru2007-10-221-15/+7
| | | | | | | | | | | | | | threading library. - Now that libpthread is a symlink, it's no longer possible to link applications with libpthread and have libmap.conf(5) select the desired threading library; applications will be linked to the default threading library, libkse or libthr. Remove an obsolete paragraph. - Mention that improvements can be seen compared to libkse. Reviewed by: deischen, davidxu
* Add the full module path name to the kld_file_stat structurejb2007-10-221-0/+5
| | | | | | | | | | | | | | for kldstat(2). This allows libdtrace to determine the exact file from which a kernel module was loaded without having to guess. The kldstat(2) API is versioned with the size of the kld_file_stat structure, so this change creates version 2. Add the pathname to the verbose output of kldstat(8) too. MFC: 3 days
* Consistently use the word 'flag' to refer to ELF_F_* constants.jkoshy2007-10-225-19/+19
| | | | MFC after: 1 day
* - Given that we tell the compiler that struct ip is packed and 32-bitmarius2007-10-211-4/+4
| | | | | | | | | | | | | | | | | aligned, GCC 4.2.1 also generates code for sendudp() that assumes this alignment. GCC 4.2.1 however doesn't 32-bit align wbuf, causing the loader to crash due to an unaligned access of wbuf in sendudp() when netbooting sparc64. Solve this by specifying wbuf as packed and 32-bit aligned, too. As for lastdata and readudp() this currently is no issue when compiled with GCC 4.2.1, though give lastdata the same treatment as wbuf for consistency and possibility of being affected in the future. [1] - Sprinkle const on a lookup table. Reported by: marcel [1] Submitted by: yongari [1] Reviewed by: marcel [1] MFC after: 5 days
* Remove references to the 'e_phnum' field of the ELF header. Instead,jkoshy2007-10-212-14/+9
| | | | | | point the reader to the elf_getphnum() function. MFC after: 1 day
* Refer the reader to the elf_update(3) manual page for more informationjkoshy2007-10-211-2/+5
| | | | | | on application control of ELF object layout. MFC after: 1 day
* - Convert NO_INSTALLLIB option to a new syntax: makefiles shouldru2007-10-202-1/+2
| | | | | | | | | | | test MK_INSTALLLIB, users can set WITHOUT_INSTALLLIB. The old NO_INSTALLLIB is still supported as several makefiles set it. - While here, fix an install when instructed not to install libs (usr.bin/lex/lib/Makefile). PR: bin/114200 Submitted by: Henrik Brix Andersen
* Install getaudit_addr(2) and setaudit_addr(2) links to getaudit(2) andrwatson2007-10-191-1/+3
| | | | | | | | setaudit(2). MFC after: 3 days Submitted by: csjp Obtained from: TrustedBSD Project
* Remove out of date notes, the atoi code is thread-safe and async-canceldavidxu2007-10-191-4/+0
| | | | | | safe. Discussed with: desichen
* Unbreak arm build by removing duplicate symbols.cognet2007-10-181-8/+0
|
* The fork symbols aren't MD, they already live in sys/.yar2007-10-181-3/+0
| | | | | Found by: version_gen.awk Tested by: md5(1) (libc.so hasn't changed at all)
* Fix build from errors exposed with recent version_gen.awk commit.grehan2007-10-181-2/+1
| | | | | Not quite sure if this is 100% correct: awaiting review. But quieten tinderbox in the meantime.
* - Correctly define CACHED_SOCKET_PATH as /var/run/nscd after cached totmclaugh2007-10-171-1/+1
| | | | | | nscd renaming. Approved by: mux
* VM_METER is long deprecated.ru2007-10-161-2/+2
|
* Rescue parts of the sensorsd commit that are still relevant:ru2007-10-161-6/+9
| | | | | | - HW_FLOATINGPOINT renamed to HW_FLOATINGPT. - Documented HW_REALMEM. - Sorted as per <sys/sysctl.h>.
* Use macro THR_CLEANUP_PUSH/POP, they are cheaper than pthread_cleanup_push/pop.davidxu2007-10-161-2/+4
|
* Reverse the logic of UP and SMP.davidxu2007-10-161-1/+1
| | | | Submitted by: jasone
* Update for libpcap 0.9.8 importmlaier2007-10-162-3/+28
|
* Backout sensors framework.netchild2007-10-151-36/+6
| | | | | Requested by: phk Discussed on: cvs-all
* Optimize for size on pc98. It enables to boot a kernel again.nyan2007-10-151-0/+3
| | | | | | | | I don't know what's wrong (loader, boot2 or others), but this change is effective. Tested by: NAKAJI Hiroyuki MFC after: 3 days
* Add comment explaining __mb_sb_limit trick here.ache2007-10-151-0/+5
|
* Fix mdoc in last commit.ru2007-10-141-13/+15
|
* Import OpenBSD's sysctl hardware sensors framework.netchild2007-10-141-6/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit includes the following core components: * sample configuration file for sensorsd * rc(8) script and glue code for sensorsd(8) * sysctl(3) doc fixes for CTL_HW tree * sysctl(3) documentation for hardware sensors * sysctl(8) documentation for hardware sensors * support for the sensor structure for sysctl(8) * rc.conf(5) documentation for starting sensorsd(8) * sensor_attach(9) et al documentation * /sys/kern/kern_sensors.c o sensor_attach(9) API for drivers to register ksensors o sensor_task_register(9) API for the update task o sysctl(3) glue code o hw.sensors shadow tree for sysctl(8) internal magic * <sys/sensors.h> * HW_SENSORS definition for <sys/sysctl.h> * sensors display for systat(1), including documentation * sensorsd(8) and all applicable documentation The userland part of the framework is entirely source-code compatible with OpenBSD 4.1, 4.2 and -current as of today. All sensor readings can be viewed with `sysctl hw.sensors`, monitored in semi-realtime with `systat -sensors` and also logged with `sensorsd`. Submitted by: Constantine A. Murenin <cnst@FreeBSD.org> Sponsored by: Google Summer of Code 2007 (GSoC2007/cnst-sensors) Mentored by: syrinx Tested by: many OKed by: kensmith Obtained from: OpenBSD (parts)
* The problem is: currently our single byte ctype(3) functions are brokenache2007-10-1312-21/+57
| | | | | | | | | | | | | | | | | | | | | | | | | for wide characters locales in the argument range >= 0x80 - they may return false positives. Example 1: for UTF-8 locale we currently have: iswspace(0xA0)==1 and isspace(0xA0)==1 (because iswspace() and isspace() are the same code) but must have iswspace(0xA0)==1 and isspace(0xA0)==0 (because there is no such character and all others in the range 0x80..0xff for the UTF-8 locale, it keeps ASCII only in the single byte range because our internal wchar_t representation for UTF-8 is UCS-4). Example 2: for all wide character locales isalpha(arg) when arg > 0xFF may return false positives (must be 0). (because iswalpha() and isalpha() are the same code) This change address this issue separating single byte and wide ctype and also fix iswascii() (currently iswascii() is broken for arguments > 0xFF). This change is 100% binary compatible with old binaries. Reviewied by: i18n@
* Remove symbols that should not be exported.deischen2007-10-131-29/+0
| | | | | Submitted by: das MFC after re@ approval
* MFKernel: do not use __XSCALE__ to detect if clz/pld/ldrd/strd arecognet2007-10-133-9/+9
| | | | | | available, use _ARM_ARCH_5/_ARM_ARCH_5E instead. MFC After: 3 days
* Minor mdoc cleanup: Every sentence should start on its own line.simon2007-10-131-1/+2
|
* When pidfile is already locked and has zero length, do not returnkib2007-10-122-1/+19
| | | | | | | | | | | | | | success and zero pid from pidfile_read(). Return EAGAIN instead. Sleep up to three times for 5 ms while waiting for pidfile to be written. mount(8) does the kill(mountpid, SIGHUP). If mountd pidfile is truncated, that would result in the SIGHUP delivered to the mount' process group instead of the mountd. Found and analyzed by: Peter Holm Tested by: Peter Holm, kris Reviewed by: pjd MFC after: 1 week
* Correct the cpio writers to not accept data for non-regular files.kientzle2007-10-123-3/+41
| | | | | | | | | In particular, the previous code led to archives that had non-empty bodies following directory entries. Not a fatal problem, as bsdtar and GNU cpio are both happy to just skip this bogus data, but it still shouldn't be there. MFC after: 3 days
* Correct the return values of the final zero-length block at EOF.kientzle2007-10-121-0/+7
| | | | | | | | Return EOF immediately if an entry in a ZIP archive has no body. In particular, the latter issue was causing bsdtar to emit spurious warnings when extracting directory entries from ZIP archives. MFC after: 3 days
* For 7.0 make the shared lib "version" '3'.obrien2007-10-101-1/+1
| | | | Approved by: re(kensmith)
* Tweak the handling of "WITHOUT_LIBPTHREAD". Also remove the accidentalobrien2007-10-092-4/+2
| | | | | | | treatment of 'LIBKSE' as an "old style" knob. Submitted by: ru Approved by: re(kensmith)
* Repo copy libpthreads to libkse.obrien2007-10-09177-26833/+0
| | | | | | This introduces the WITHOUT_LIBKSE nob, and changes WITHOUT_LIBPTHREADS to mean with neither threading libs. Approved by: re(kensmith)
* Repo copy libpthreads to libkse.obrien2007-10-0911-71/+18
| | | | | | This introduces the WITHOUT_LIBKSE nob, and changes WITHOUT_LIBPTHREADS to mean with neither threading libs. Approved by: re(kensmith)
* Always install libpthread.* symlinks if at least one ofru2007-10-011-2/+3
| | | | | | | | | | | | the threading libraries is built. This simplifies the logic in makefiles that need to check if the pthreads support is present. It also fixes a bug where we would build a threading library that we shouldn't have built: for example, building with WITHOUT_LIBTHR and the default value of DEFAULT_THREADING_LIB (libthr) would mistakenly build the libthr library, but not install it. Approved by: re (kensmith)
* Always install libpthread.* symlinks if at least one ofru2007-10-012-4/+6
| | | | | | | | | | | | the threading libraries is built. This simplifies the logic in makefiles that need to check if the pthreads support is present. It also fixes a bug where we would build a threading library that we shouldn't have built: for example, building with WITHOUT_LIBTHR and the default value of DEFAULT_THREADING_LIB (libthr) would mistakenly build the libthr library, but not install it. Approved by: re (kensmith)
* Fixed "make checkdpadd" (missing library dependencies).ru2007-10-011-0/+1
| | | | Approved by: re (kensmith)
* Adjust history.obrien2007-09-284-4/+11
| | | | Approved by: re(ken)
OpenPOWER on IntegriCloud