summaryrefslogtreecommitdiffstats
path: root/lib/libkvm/kvm_proc.c
Commit message (Collapse)AuthorAgeFilesLines
* Much closer approximation of the kernel's calculation of this value.sbruno2010-06-181-1/+6
| | | | | Reviewed by: alc Obtained from: Yahoo Inc.
* Add a missing else that negated the truncation of ki_ngroups tobrooks2009-12-101-1/+1
| | | | | | NGROUPS. Submitted by: Dmitry Pryanishnikov <lynx dot ripe at gmail dot com>
* cr_groups is no longer embedded in struct ucred and is instead storedbrooks2009-09-081-1/+1
| | | | | | | | | | | in a seperate array. As such we need to use kvm_read rather than bcopy to populate the ki_groups field. This fixes a crash when running ps -ax on a coredump. Reported by: brucec Tested by: brucec MFC after: 3 days
* Revert the changes to struct kinfo_proc in r194498. Instead, fillbrooks2009-07-241-2/+8
| | | | | | | | | | in up to 16 (KI_NGROUPS) values and steal a bit from ki_cr_flags (all bits currently unused) to indicate overflow with the new flag KI_CRF_GRP_OVERFLOW. This fixes procstat -s. Approved by: re (kib)
* Rework the credential code to support larger values of NGROUPS andbrooks2009-06-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NGROUPS_MAX, eliminate ABI dependencies on them, and raise the to 1024 and 1023 respectively. (Previously they were equal, but under a close reading of POSIX, NGROUPS_MAX was defined to be too large by 1 since it is the number of supplemental groups, not total number of groups.) The bulk of the change consists of converting the struct ucred member cr_groups from a static array to a pointer. Do the equivalent in kinfo_proc. Introduce new interfaces crcopysafe() and crsetgroups() for duplicating a process credential before modifying it and for setting group lists respectively. Both interfaces take care for the details of allocating groups array. crsetgroups() takes care of truncating the group list to the current maximum (NGROUPS) if necessary. In the future, crsetgroups() may be responsible for insuring invariants such as sorting the supplemental groups to allow groupmember() to be implemented as a binary search. Because we can not change struct xucred without breaking application ABIs, we leave it alone and introduce a new XU_NGROUPS value which is always 16 and is to be used or NGRPS as appropriate for things such as NFS which need to use no more than 16 groups. When feasible, truncate the group list rather than generating an error. Minor changes: - Reduce the number of hand rolled versions of groupmember(). - Do not assign to both cr_gid and cr_groups[0]. - Modify ipfw to cache ucreds instead of part of their contents since they are immutable once referenced by more than one entity. Submitted by: Isilon Systems (initial implementation) X-MFC after: never PR: bin/113398 kern/133867
* MFp4:bz2008-11-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bring in updated jail support from bz_jail branch. This enhances the current jail implementation to permit multiple addresses per jail. In addtion to IPv4, IPv6 is supported as well. Due to updated checks it is even possible to have jails without an IP address at all, which basically gives one a chroot with restricted process view, no networking,.. SCTP support was updated and supports IPv6 in jails as well. Cpuset support permits jails to be bound to specific processor sets after creation. Jails can have an unrestricted (no duplicate protection, etc.) name in addition to the hostname. The jail name cannot be changed from within a jail and is considered to be used for management purposes or as audit-token in the future. DDB 'show jails' command was added to aid debugging. Proper compat support permits 32bit jail binaries to be used on 64bit systems to manage jails. Also backward compatibility was preserved where possible: for jail v1 syscalls, as well as with user space management utilities. Both jail as well as prison version were updated for the new features. A gap was intentionally left as the intermediate versions had been used by various patches floating around the last years. Bump __FreeBSD_version for the afore mentioned and in kernel changes. Special thanks to: - Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches and Olivier Houchard (cognet) for initial single-IPv6 patches. - Jeff Roberson (jeff) and Randall Stewart (rrs) for their help, ideas and review on cpuset and SCTP support. - Robert Watson (rwatson) for lots and lots of help, discussions, suggestions and review of most of the patch at various stages. - John Baldwin (jhb) for his help. - Simon L. Nielsen (simon) as early adopter testing changes on cluster machines as well as all the testers and people who provided feedback the last months on freebsd-jail and other channels. - My employer, CK Software GmbH, for the support so I could work on this. Reviewed by: (see above) MFC after: 3 months (this is just so that I get the mail) X-MFC Before: 7.2-RELEASE if possible
* - Don't inspect the P_SA flag. It's being removed.jeff2008-03-121-7/+2
|
* Aparrently MACXOCOMLEN exisrts only on my machinejulian2007-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.
* - When using kvm use the new conversion method to derive swtime.jeff2007-09-211-3/+16
| | | | Approved by: re
* - Move all of the PS_ flags into either p_flag or td_flags.jeff2007-09-171-2/+2
| | | | | | | | | | | | | | - p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or previously the sched_lock. These bugs have existed for some time. - Allow swapout to try each thread in a process individually and then swapin the whole process if any of these fail. This allows us to move most scheduler related swap flags into td_flags. - Keep ki_sflag for backwards compat but change all in source tools to use the new and more correct location of P_INMEM. Reported by: pho Reviewed by: attilio, kib Approved by: re (kensmith)
* - Work-around the already partially broken rusage support in kvm byjeff2007-06-011-0/+2
| | | | | | completely disabling it until a full solution is agreed upon. Pointy hat to: me
* Remove the advertising clause. UCB did this some time ago, but theseimp2007-01-081-4/+0
| | | | | | files were never updated to reflect that. MFC After: 2 days
* remove already commented out codejulian2006-12-061-33/+0
|
* Make KSE a kernel option, turned on by default in all GENERICjb2006-10-261-4/+4
| | | | | | | kernel configs except sun4v (which doesn't process signals properly with KSE). Reviewed by: davidxu@
* Rev. 1.44 of this file didn't introduce a right solution,yar2006-07-251-0/+7
| | | | | | | but we don't seem to have one yet, so just add an XXX comment on passing rux_runtime to bintime2timeval() wrongly. Spotted by: gcc(1) (warning)
* Set ki_tdev to NODEV rather than NULL.peter2005-06-241-1/+1
| | | | Approved by: re
* Make kvm(3) aware of ki_jid field.pjd2005-03-201-1/+17
| | | | | Reviewed by: gad MFC after: 3 days
* Dike out unwarranted reference to si_udev.phk2005-03-151-0/+4
|
* In preparation to remove U areas, don't refer to p_uarea in libkvm.das2004-11-201-1/+1
| | | | Reviewed by: arch@
* Remove un-needed call to close(2). The fd that close is beingcsjp2004-11-131-1/+0
| | | | | | called on is invalid and has no use. Reviewed by: smkelly
* Belatedly catch up with the dev_t/cdev changes from a few months back.peter2004-10-111-1/+11
| | | | | | | Extract the struct cdev pointer and the tty device from inside rather than incorrectly casting the 'struct cdev *' pointer to a 'dev_t' int. Not that this was particularly important since it was only used for reading vmcore files.
* - Fix the compile to chase the p_rux changes.jhb2004-10-061-1/+7
| | | | | | | - Add a comment noting that the ru_[us]times values being read aren't actually valid and need to be computed from the raw values. Submitted by: many (1)
* Refactor a bunch of scheduler code to give basically the same behaviourjulian2004-09-051-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | but with slightly cleaned up interfaces. The KSE structure has become the same as the "per thread scheduler private data" structure. In order to not make the diffs too great one is #defined as the other at this time. The KSE (or td_sched) structure is now allocated per thread and has no allocation code of its own. Concurrency for a KSEGRP is now kept track of via a simple pair of counters rather than using KSE structures as tokens. Since the KSE structure is different in each scheduler, kern_switch.c is now included at the end of each scheduler. Nothing outside the scheduler knows the contents of the KSE (aka td_sched) structure. The fields in the ksegrp structure that are to do with the scheduler's queueing mechanisms are now moved to the kg_sched structure. (per ksegrp scheduler private data structure). In other words how the scheduler queues and keeps track of threads is no-one's business except the scheduler's. This should allow people to write experimental schedulers with completely different internal structuring. A scheduler call sched_set_concurrency(kg, N) has been added that notifies teh scheduler that no more than N threads from that ksegrp should be allowed to be on concurrently scheduled. This is also used to enforce 'fainess' at this time so that a ksegrp with 10000 threads can not swamp a the run queue and force out a process with 1 thread, since the current code will not set the concurrency above NCPU, and both schedulers will not allow more than that many onto the system run queue at a time. Each scheduler should eventualy develop their own methods to do this now that they are effectively separated. Rejig libthr's kernel interface to follow the same code paths as linkse for scope system threads. This has slightly hurt libthr's performance but I will work to recover as much of it as I can. Thread exit code has been cleaned up greatly. exit and exec code now transitions a process back to 'standard non-threaded mode' before taking the next step. Reviewed by: scottl, peter MFC after: 1 week
* Remove stale code protected by #ifdef sparc. GCC 3.4.x adds sparc tokan2004-07-281-9/+0
| | | | predefined symbols on all SPARC platforms and FreeBSD follows the crowd.
* Fix a test of bit-flag "P_SA" by adding parenthesis around the expression.gad2004-06-231-1/+1
| | | | Submitted by: Cyrille Lefevre
* Replace a call to strncpy() with a call to strlcpy()gad2004-06-231-4/+2
| | | | Submitted by: Cyrille Lefevre
* Fill in the some new fields 'struct kinfo_proc', namely ki_childstime,gad2004-06-191-5/+29
| | | | | | | | | | | | | ki_childutime, and ki_emul. Also uses the timeradd() macro to correct the calculation of ki_childtime. That will correct the value returned when ki_childtime.tv_usec > 1,000,000. This also implements a new KERN_PROC_GID option for kvm_getprocs(). It also implements the KERN_PROC_RGID and KERN_PROC_SESSION options which were added to sys/kern/kern_proc.c revision 1.203. PR: bin/65803 (a very tiny piece of the PR) Submitted by: Cyrille Lefevre
* Second half of the dev_t cleanup.phk2004-06-171-1/+1
| | | | | | | | | | | The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc.
* This library has to change whenever the kernel process structure changes.julian2004-06-161-1/+1
|
* Fix a warning: compare u_long ps_strings to 0 instead of NULL.schweikh2004-03-281-1/+1
|
* Teach kvm_getprocs() to recognize a sysctl flag for including threads.deischen2004-02-221-5/+8
|
* Use the 3-component version of the KERN_PROC_PROC sysctl.tjr2003-09-271-2/+4
|
* Remove unnecssary <vm/swap_pager.h> includes.phk2003-07-311-1/+0
| | | | | These were probably not cleaned up back in whatever murky past these files were split into separate files.
* P_THREADED was renamed to P_SA, follow up.davidxu2003-06-151-2/+2
|
* s/procsig/sigacts/ to catch up to procsig and sigacts changes in the kernel.jhb2003-05-141-10/+6
| | | | Approved by: re (scottl)
* Bandaid for world. jhb gets the pointy hat here and he needs to look atpeter2003-05-141-0/+4
| | | | | | this. Approved by: re (scottl)
* Catch up with the kernel. Move the current cpu indicator to the thread.julian2003-04-101-3/+1
|
* - Spell SIGSETOR correctly.jeff2003-04-011-1/+1
|
* - Catch up with kernel signal changes.jeff2003-03-311-1/+2
|
* Catch up to p_tracep -> p_tracevp rename to unbreak world.jhb2003-03-131-1/+1
| | | | Pointy hat to: jhb
* Change the process flags P_KSES to be P_THREADED.julian2003-02-271-2/+2
| | | | This is just a cosmetic change but I've been meaning to do it for about a year.
* Catch up to SMTX -> SLOCK changes.jhb2002-10-021-7/+7
|
* Ressurect libkvm use of the bitmasked signal list in the kernel, now thatjmallett2002-10-011-7/+1
| | | | reliable signal queues are gone.
* Fix typo, should zero the kinfo_proc's siglist, not the real one's - the realjmallett2002-10-011-1/+1
| | | | | | | one doesn't have one. Submitted by: jake, scottl Big pointed hat that lands one in the badcommitters box to: jmallett
* The list of queued signals is not, can not, and will not be exported to thejmallett2002-09-301-1/+7
| | | | | | userland. If someone wants to implement a backup p_siglist in the kernel for compatability and to export one could. For now, just tell KVM to hand an empty signal set off to the userland.
* Fixed messes involving $FreeBSD$ starting with one left in the copyrightbde2002-09-161-21/+5
| | | | | | | | after adding __FBSDID(). Garbage-collected kvm_readswap(). This was once used by kvm_uread(), but kvm_uread() now just reads /proc/<pid>/mem and procfs hopefully handles swapped out pages.
* Allocate KSEs and KSEGRPs separatly and remove them from the proc structure.julian2002-09-151-12/+45
| | | | | | | | | next step is to allow > 1 to be allocated per process. This would give multi-processor threads. (when the rest of the infrastructure is in place) While doing this I noticed libkvm and sys/kern/kern_proc.c:fill_kinfo_proc are diverging more than they should.. corrective action needed soon.
* Completely redo thread states.julian2002-09-111-21/+24
| | | | Reviewed by: davidxu@freebsd.org
* Hopefully unbreak world. ke_slptime is gone. It should really have beenpeter2002-08-301-1/+1
| | | | looking at p_ksegrp.kg_slptime anyway.
OpenPOWER on IntegriCloud