summaryrefslogtreecommitdiff
path: root/lib/libkvm
AgeCommit message (Collapse)Author
2015-09-08port the changes just made to kvm_getfiles in kvm_file2.c r1.47 toDavid Gwynne
kvm_getprocs. basically cope with the number of procs growing between when we get the size and when we get the list. ok guenther@
2015-09-04fix a race when fetching files from the kernel. the number of filesDavid Gwynne
might have increased between when we got the number of files and when we requested that number of files. now we allocate another 10ish percent on top of what the kernel says we need, and retry if that still isnt enough. while here use realloc instead of constantly going through free/malloc sequences. with input from claudio@ deraadt@ ok millert@ guenther@
2015-09-04add kvm_realloc() as a private function.David Gwynne
part of a larger diff ok millert@ guenther@
2015-08-28Rework the UNIX domain socket garbage collector, including ideas fromPhilip Guenther
{Free,Net}BSD - when a socket is closed with fds in its input, defer closing them to a task to avoid recursing. This eliminates the complicated extra reference taking which had a 37 line(!) comment explanation - move flags, counts, and links only needed for this from struct file to struct unpcb - document the flow of the mark/sweep collector much help from claudio@ who made me explain the GC to him until we trusted it ok claudio@ mpi@ deraadt@
2015-05-11When checking flags that will be passed to open(), test the O_ACCMODE portionPhilip Guenther
separately to avoid false negatives. ok miod@ millert@
2015-04-07Teach libkvm a bit about PAE, making it independent of the kernel definesPhilip Guenther
and doing runtime detection of what the target kernel is using. Getting this is now to avoid breakage when kernel bits come. ok deraadt@
2015-04-04The swapfile argument is also const char *.Jeremie Courreges-Anglas
Found a while ago when porting cpulimit. ok deraadt@
2015-03-30Do not include <machine/autoconf.h>, for it is a kernel-only header and libkvmMiod Vallat
doesn't need anything from it. While there, fix format strings and remove unused local variable declarations.
2015-03-28Replace the hand-crafted list of datagram unix domain sockets withAlexander Bluhm
a SLIST. OK mpi@ benno@
2015-03-18Rework the virtual memory layout on SRMMU systems (sun4d/sun4m) to use a muchMiod Vallat
lower VM_MIN_KERNEL_ADDRESS, since these systems are not crippled by the Sun-4 MMU hole and have the real 4GB of address space. Kernels running on Sun-4 MMU are not affected and will still be restricted to the existing 128MB of kernel space, with 1GB - 128MB of user space. Kernels running on SRMMU will now provide the low 3GB of address space to userland, and use the top 1GB for the kernel, except when compiled with option SMALL_KERNEL, in which case they will keep Sun-4 style the layout (this is temporary to allow for people to boot bsd.rd to upgrade even when not running 2.10 boot blocks, and will be removed eventually) A consequence of this is that the top of the userland stack is no longer at 0xf0000000. But since nothing in userland uses USRSTACK anymore, this should not be an issue. Tested on sun4c and various sun4m, with physical memory sizes ranging from 32 to 448MB.
2015-02-11Extend struct kinfo_file a bit for netstat (sync with the kernel).Claudio Jeker
Bump minor number because of this. OK guenther@
2015-02-11Prefer arg != 0 over arg for non-boolean. nitted kettenis@Philip Guenther
2015-02-11sysctl({CTL_KERN, KERN_FILE, KERN_FILE_BYFILE}) previously requiredPhilip Guenther
the extra argument to be zero; instead, make it filter on the file type (DTYPE_*) when non-zero to make claudio's netstat work easier. ok claudio@
2015-02-09typoMiod Vallat
2015-01-16Move to the <limits.h> universe.Theo de Raadt
review by millert, binary checking process with doug, concept with guenther
2015-01-09Cleanup some macros and #defines in i386 pmap. Previously committed andMike Larkin
backed out because of libkvm breakage, recommitting now with libkvm fix. ok deraadt@
2014-12-16include lock.h, needed for later headers but currently included by magicTed Unangst
ok millert
2014-11-19Nuke yet more obvious #include duplications.Kenneth R Westerback
ok deraadt@
2014-11-18Nuke some obvious #include duplications.Kenneth R Westerback
ok espie@ deraadt@ millert@ tedu@
2014-11-18udf needs siphash to build.David Gwynne
i dont know if this is the right fix, but the tree needs to build.
2014-11-03Put the socket splicing fields into a seperate struct sosplice thatAlexander Bluhm
gets only allocated when needed. This way struct socket shrinks from 472 to 392 bytes on amd64. When splicing gets active, another 88 bytes are allocated for struct sosplice. OK dlg@
2014-10-25Remove unnecessary netinet/in_systm.h include.Lawrence Teo
ok millert@
2014-10-22Don't leak the old data if _kvm_reallocarray() failsPhilip Guenther
ok millert@ doug@
2014-10-15Apply reallocarray() idiom.Theo de Raadt
ok guenther
2014-08-15Use O_CLOEXEC wherever we open a file and then call fcntl(F_SETFD, FD_CLOEXEC)Philip Guenther
on it, simplifying error checking, reducing system calls, and improving thread-safety for libraries. ok miod@
2014-07-11the one userland file which wants uvmexp snooped via kmem, gets to use theTheo de Raadt
special rule that sys/sysctl.h gets it. mips64 always wanted special treatment. found by todd
2014-07-08sys/user.h can now be substantially gutted.Theo de Raadt
ok guenther
2014-07-04Track whether a process is a zombie or not yet fully built via flagsPhilip Guenther
PS_{ZOMBIE,EMBRYO} on the process instead of peeking into the process's thread data. This eliminates the need for the thread-level SDEAD state. Change kvm_getprocs() (both the sysctl() and kvm backends) to report the "most active" scheduler state for the process's threads. tweaks kettenis@ feedback and ok matthew@
2014-05-25Get the vmspace pointer from the process, not the threadPhilip Guenther
2014-03-30Eliminates struct pcred by moving the real and saved ugids intoPhilip Guenther
struct ucred; struct process then directly links to the ucred Based on a discussion at c2k10 or so before noting that FreeBSD and NetBSD did this too. ok matthew@
2014-03-22Unbreak tree; p_sigacts moved from struct proc to struct processFlorian Obser
2014-03-18Retire hp300, mvme68k and mvme88k ports. These ports have no users, keepingMiod Vallat
this hardware alive is becoming increasingly difficult, and I should heed the message sent by the three disks which have died on me over the last few days. Noone sane will mourn these ports anyway. So long, and thanks for the fish.
2014-02-05More crash dump parsing fixes: correct paddr in process info and pidsPhilip Guenther
in file info. Drop some unnecessary casts and unused variables too. ok millert@
2014-01-21obvious .Pa fixes; found with mandocdb(8)Ingo Schwarze
2014-01-20Threads can't be zombies, only processes, so change zombproc to zombprocess,Philip Guenther
make it a list of processes, and change P_NOZOMBIE and P_STOPPED from thread flags to process flags. Add allprocess list for the code that just wants to see processes. ok tedu@
2014-01-20p_textvp moved from struct proc to struct processPhilip Guenther
2013-11-17Mark internal symbols as hidden. This removes symbols from the ABI,Philip Guenther
albeit ones no one should be using, so major bump the shlib. ok kettenis@ ports testing by landry@
2013-11-16_kvm_syserr() is printf-like tooPhilip Guenther
2013-11-16ANSIfy a declarationPhilip Guenther
2013-11-16Prep for hidden visibility: move the vnode/file related functionPhilip Guenther
declarations, including _kvm_getftype(), into a new header, kvm_file.h, so that we don't have to pull <sys/vnode.h> into all the .c files. No more extern function declaration in .c files. ok millert@
2013-11-12Apply format __attribute__ to _kvm_err() and fix the errors that it detects.Philip Guenther
Treat failure to KREAD teh pcredd or ucreds to be errors insteading of continuing with bogus data. ok deraadt@ millert@
2013-11-12a missing prototypesTheo de Raadt
and don't act like an unknown vnode type is "ok"
2013-11-01reduce use of <sys/user.h>Theo de Raadt
ok guenther millert
2013-10-22- add UNIX-domain socket info to struct kinfo_file2Philip Guenther
- convert netstat from kvm_getfiles() to kvm_getfile2() using that - delete kvm_getfiles() and KERN_FILE as no longer used (bump libkvm's major) - rename kvm_getfile2() to kvm_getfiles(), kinfo_file2 to kinfo_file and KERN_FILE2 to KERN_FILE. ok deraadt@, millert@ ports scan sthen@
2013-10-17Remove support for a.out and ecoff. We only do elf now.Theo de Raadt
ok miod
2013-08-14some Bx/Ox conversion;Jason McIntyre
From: Jan Stary
2013-08-13Switch time_t, ino_t, clock_t, and struct kevent's ident and dataPhilip Guenther
members to 64bit types. Assign new syscall numbers for (almost all) the syscalls that involve the affected types, including anything with time_t, timeval, itimerval, timespec, rusage, dirent, stat, or kevent arguments. Add a d_off member to struct dirent and replace getdirentries() with getdents(), thus immensely simplifying and accelerating telldir/seekdir. Build perl with -DBIG_TIME. Bump the major on every single base library: the compat bits included here are only good enough to make the transition; the T32 compat option will be burned as soon as we've reached the new world are are happy with the snapshots for all architectures. DANGER: ABI incompatibility. Updating to this kernel requires extra work or you won't be able to login: install a snapshot instead. Much assistance in fixing userland issues from deraadt@ and tedu@ and build assistance from todd@ and otto@
2013-08-03KERN_PROC_BYPID --> KERN_FILE_BYPIDPhilip Guenther
pointed out by Dominique Laigle (dlaigle (at) gmail.com)
2013-06-05use fancy .In macro for includes. from Jan Klemkow. ok jmc schwarzeTed Unangst
2013-03-28Avoid using PAGE_SHIFT, PAGE_SIZE, and PAGE_MASK defines, since we alreadyTheo de Raadt
know it from the machine. ok miod