on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
-
+
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
Once the apply merge is done you need to run 'make menuconfig',
choose Package Selection for the target --->, [*] Show packages that
-are also provided by busybox && System tools ---> [*] procps-ng.
+are also provided by busybox && System tools ---> [*] procps-ng.
If you do not want to configure anything else save, exit and make.
Notice that you almost certainly want to PROCPS_NG_VERSION
+
+$(eval $(call AUTOTARGETS))
+$(eval $(call AUTOTARGETS,host))
---
+--
1.7.10
}
else
{
- /*
+ /*
* Check out the next process
* If we can't open it, use info from this process,
* so we have to check out cmdline first.
if (idle >= (60 * 60 * 48)) /* more than two days */
sprintf (give, "%2ludays", idle / (60 * 60 * 24));
else
- sprintf (give, " %2lu:%02u", idle / (60 * 60),
+ sprintf (give, " %2lu:%02u", idle / (60 * 60),
(unsigned) ((idle / 60) % 60));
}
else
/*
* utmp.c - utmp printing command
* Copyright (C) Albert Cahalan
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
exit(1);
}
-
+
if (list) {
ut = fopen(UTMP_FILE, "r");
while (fread(&uts, sizeof(uts), 1, ut))
if (fix) {
ut = fopen(UTMP_FILE, "r");
- while (fread(&uts, sizeof(uts), 1, ut))
+ while (fread(&uts, sizeof(uts), 1, ut))
if (((uts.ut_type == USER_PROCESS) && (uts.ut_name[0] != '\000'))
|| print_all) {
/* Display entry in utmp */
printf("ut_user: %s\n", user);
printf("ut_host: %s\n", host);
printf("ut_addr: %d\n\n", uts.ut_addr);
-
+
printf("Modify this record? (y/N): "); fflush(stdout);
/* Ask if to delete or no */
if ((ch = getchar()) == 'y' || ch == 'Y') {
.BR top "(1),
.BR vmstat (8).
.SH AUTHORS
-Written by Brian Edmonds.
+Written by Brian Edmonds.
.SH "REPORTING BUGS"
Please send bug reports to
.UR procps@freelists.org
-/*
+/*
* This header was copied from util-linux at fall 2011.
*/
-/*
+/*
* This header was copied from util-linux at fall 2011.
*/
-/*
+/*
* This header was copied from util-linux at fall 2011.
*/
-/*
+/*
* strutils.c - various string routines shared by commands
* This file was copied from util-linux at fall 2011.
*
\fB\-c\fR, \fB\-\-count\fR
Suppress normal output; instead print a count of matching processes. When
count does not match anything, e.g. returns zero, the command will return
-non-zero value.
+non-zero value.
.TP
\fB\-d\fR, \fB\-\-delimiter\fR \fIdelimiter\fP
Sets the string used to delimit each process ID in the output (by default a
symbolical value may be used.
.TP
\fB\-v\fR, \fB\-\-inverse\fR\fR
-Negates the matching. This option is usually used in
-.BR pgrep 's
+Negates the matching. This option is usually used in
+.BR pgrep 's
context. In
.BR pkill 's
context the short option is disabled to avoid accidental usage of the option.
xerrx(EXIT_FAILURE, _("internal error"));
}
}
-
+
memset (&task, 0, sizeof (task));
}
closeproc (ptp);
/* These options are for pgrep only */
strcat (opts, "lad:v");
}
-
+
strcat (opts, "LF:cfnoxP:g:s:u:U:G:t:?Vh");
while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != -1) {
continue;
xwarn(_("killing pid %ld failed"), procs[i].num);
}
- if (opt_count)
+ if (opt_count)
fprintf(stdout, "%d\n", num);
} else {
if (opt_count) {
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
-
+
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
+ */
#include <stdio.h>
#include <stdlib.h>
int my_cells = 0;
int my_bytes = 0;
mbstate_t s;
-
+
memset(&s, 0, sizeof (s));
-
+
for(;;) {
wchar_t wc;
int len = 0;
-
- if(my_cells >= *maxcells || my_bytes+1 >= bufsize)
+
+ if(my_cells >= *maxcells || my_bytes+1 >= bufsize)
break;
-
+
if (!(len = mbrtowc (&wc, src, MB_CUR_MAX, &s)))
/* 'str' contains \0 */
break;
-
+
if (len < 0) {
/* invalid multibyte sequence -- zeroize state */
memset (&s, 0, sizeof (s));
*(dst++) = '?';
src++;
- my_cells++;
+ my_cells++;
my_bytes++;
} else if (!iswprint(wc)) {
*(dst++) = '?';
src+=len;
my_cells++;
- my_bytes++;
-
+ my_bytes++;
+
} else {
- /* multibyte - printable */
+ /* multibyte - printable */
int wlen = wcwidth(wc);
if (wlen==0) {
- // invisible multibyte -- we don't ignore it, because some terminal
+ // invisible multibyte -- we don't ignore it, because some terminal
// interpret it wrong and more safe is replace it with '?'
*(dst++) = '?';
src+=len;
*dst = '\0';
// fprintf(stderr, "maxcells: %d, my_cells; %d\n", *maxcells, my_cells);
-
+
*maxcells -= my_cells;
return my_bytes; // bytes of text, excluding the NUL
}
"????????????????????????????????"
"????????????????????????????????"
"????????????????????????????????";
-
+
#if (__GNU_LIBRARY__ >= 6) && (!defined(__UCLIBC__) || defined(__UCLIBC_HAS_WCHAR__))
static int utf_init=0;
-
+
if(utf_init==0){
/* first call -- check if UTF stuff is usable */
char *enc = nl_langinfo(CODESET);
return escape_str_utf8(dst, src, bufsize, maxcells);
}
#endif
-
+
if(bufsize > *maxcells+1) bufsize=*maxcells+1; // FIXME: assumes 8-bit locale
for(;;){
- if(my_cells >= *maxcells || my_bytes+1 >= bufsize)
+ if(my_cells >= *maxcells || my_bytes+1 >= bufsize)
break;
c = (unsigned char) *(src++);
if(!c) break;
*(dst++) = c;
}
*dst = '\0';
-
+
*maxcells -= my_cells;
return my_bytes; // bytes of text, excluding the NUL
}
continue;
}
if(done>0 && done<(ssize_t)room-total-1){
- total += done;
+ total += done;
continue; /* OK, we read some. Go do more. */
}
fprintf(stderr,"%ld can't happen\n", (long)done);
-/*
+/*
* slab.c - slab related functions for libproc
*
* Chris Rivera <cmrivera@ufl.edu>
/*
* slab_badname_detect - return true if current slab was declared with
- * whitespaces for instance
+ * whitespaces for instance
* FIXME :Other cases ?
*/
while (*buffer){
if((*buffer)==' ')
numberarea=1;
- if(isalpha(*buffer)&&numberarea)
+ if(isalpha(*buffer)&&numberarea)
return 1;
- buffer++;
+ buffer++;
}
return 0;
}
}
// parse_slabinfo20 - actual parse routine for slabinfo 2.x (2.6 kernels)
-// Note: difference between 2.0 and 2.1 is in the ": globalstat" part where version 2.1
+// Note: difference between 2.0 and 2.1 is in the ": globalstat" part where version 2.1
// has extra column <nodeallocs>. We don't use ": globalstat" part in both versions.
//
// Formats (we don't use "statistics" extensions)
// : slabdata <active_slabs> <num_slabs> <sharedavail> \
// : globalstat <listallocs> <maxobjs> <grown> <reaped> <error> <maxfreeable> <freelimit> <nodeallocs> \
// : cpustat <allochit> <allocmiss> <freehit> <freemiss>
-//
+//
// slabinfo - version: 2.0
// # name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> \
// : tunables <batchcount> <limit> <sharedfactor> \
assigned = sscanf(buffer, "%" STRINGIFY(SLAB_INFO_NAME_LEN)
"s %d %d %d %d %d : tunables %*d %*d %*d : \
- slabdata %d %d %*d", curr->name,
- &curr->nr_active_objs, &curr->nr_objs,
+ slabdata %d %d %*d", curr->name,
+ &curr->nr_active_objs, &curr->nr_objs,
&curr->obj_size, &curr->objs_per_slab,
&curr->pages_per_slab, &curr->nr_active_slabs,
&curr->nr_slabs);
if (assigned < 6) {
fprintf(stderr, "unrecognizable data in your slabinfo version 1.1\n\r");
if(slab_badname_detect(buffer))
- fprintf(stderr, "Found an error in cache name at line %s\n", buffer);
+ fprintf(stderr, "Found an error in cache name at line %s\n", buffer);
curr = NULL;
break;
}
if (curr->obj_size)
curr->objs_per_slab = curr->pages_per_slab *
- page_size / curr->obj_size;
+ page_size / curr->obj_size;
stats->nr_objs += curr->nr_objs;
stats->nr_active_objs += curr->nr_active_objs;
cpuinfo();
#ifdef __linux__
- if(linux_version_code > LINUX_VERSION(2, 4, 0)){
+ if(linux_version_code > LINUX_VERSION(2, 4, 0)){
Hertz = find_elf_note(AT_CLKTCK);
if(Hertz!=NOTE_NOT_FOUND) return;
fputs("2.4+ kernel w/o ELF notes? -- report this\n", stderr);
void loadavg(double *restrict av1, double *restrict av5, double *restrict av15) {
double avg_1=0, avg_5=0, avg_15=0;
char *savelocale;
-
+
FILE_TO_BUF(LOADAVG_FILE,loadavg_fd);
savelocale = strdup(setlocale(LC_NUMERIC, NULL));
setlocale(LC_NUMERIC, "C");
if(fd == -1) crash("/proc/stat");
}
read(fd,buff,BUFFSIZE-1);
- *intr = 0;
+ *intr = 0;
*ciow = 0; /* not separated out until the 2.5.41 kernel */
*cxxx = 0; /* not separated out until the 2.6.0-test4 kernel */
*cyyy = 0; /* not separated out until the 2.6.0-test4 kernel */
unsigned long vm_allocstall; // times a page allocator ran direct reclaim
unsigned long vm_pgrotated; // pages rotated to the tail of the LRU for immediate reclaim
// seen on a 2.6.8-rc1 kernel, apparently replacing old fields
-static unsigned long vm_pgalloc_dma; //
-static unsigned long vm_pgalloc_high; //
-static unsigned long vm_pgalloc_normal; //
-static unsigned long vm_pgrefill_dma; //
-static unsigned long vm_pgrefill_high; //
-static unsigned long vm_pgrefill_normal; //
-static unsigned long vm_pgscan_direct_dma; //
-static unsigned long vm_pgscan_direct_high; //
-static unsigned long vm_pgscan_direct_normal; //
-static unsigned long vm_pgscan_kswapd_dma; //
-static unsigned long vm_pgscan_kswapd_high; //
-static unsigned long vm_pgscan_kswapd_normal; //
-static unsigned long vm_pgsteal_dma; //
-static unsigned long vm_pgsteal_high; //
-static unsigned long vm_pgsteal_normal; //
+static unsigned long vm_pgalloc_dma; //
+static unsigned long vm_pgalloc_high; //
+static unsigned long vm_pgalloc_normal; //
+static unsigned long vm_pgrefill_dma; //
+static unsigned long vm_pgrefill_high; //
+static unsigned long vm_pgrefill_normal; //
+static unsigned long vm_pgscan_direct_dma; //
+static unsigned long vm_pgscan_direct_high; //
+static unsigned long vm_pgscan_direct_normal; //
+static unsigned long vm_pgscan_kswapd_dma; //
+static unsigned long vm_pgscan_kswapd_high; //
+static unsigned long vm_pgscan_kswapd_normal; //
+static unsigned long vm_pgsteal_dma; //
+static unsigned long vm_pgsteal_high; //
+static unsigned long vm_pgsteal_normal; //
// seen on a 2.6.8-rc1 kernel
static unsigned long vm_kswapd_inodesteal; //
static unsigned long vm_nr_unstable; //
*disks = NULL;
*partitions = NULL;
- buff[BUFFSIZE-1] = 0;
+ buff[BUFFSIZE-1] = 0;
fd = fopen("/proc/diskstats", "rb");
if(!fd) crash("/proc/diskstats");
&(*partitions)[cPartition].requested_writes
);
(*partitions)[cPartition++].parent_disk = cDisk-1;
- (*disks)[cDisk-1].partitions++;
+ (*disks)[cDisk-1].partitions++;
}
}
unsigned int getslabinfo (struct slab_cache **slab){
FILE* fd;
int cSlab = 0;
- buff[BUFFSIZE-1] = 0;
+ buff[BUFFSIZE-1] = 0;
*slab = NULL;
fd = fopen("/proc/slabinfo", "rb");
if(!fd) crash("/proc/slabinfo");
#ifdef __linux__
static struct utsname uts;
-
+
if (uname(&uts) == -1) /* failure implies impending death */
exit(1);
If the length of the username is greater than the length of the display
column, the numeric user ID is displayed instead.
.PP
-Commands options such as
+Commands options such as
.B ps \-aux
are not recommended as it is a confusion of two different standards.
According to the POSIX and UNIX standards, the above command asks to
display all processes with a TTY (generally the commands users are
running) plus all processes owned by a user named "x". If that user
-doesn't exist, then
+doesn't exist, then
.B ps
will assume you really meant "\fBps\fR \fIaux\fR".
.SH "PROCESS FLAGS"
listing of the top caches sorted by one of the listed sort criteria. It also
displays a statistics header filled with slab layer information.
.SH OPTIONS
-Normal invocation of
+Normal invocation of
.B slabtop
does not require any options. The behavior, however, can be fine-tuned by
specifying one or more of the following flags:
.SH DESCRIPTION
.B sysctl
is used to modify kernel parameters at runtime. The parameters available
-are those listed under /proc/sys/. Procfs is required for
+are those listed under /proc/sys/. Procfs is required for
.B sysctl
support in Linux. You can use
.B sysctl
sysctl.test/sysctl_read.exp \
uptime.test/uptime.exp \
vmstat.test/vmstat.exp \
- w.test/w.exp
+ w.test/w.exp
fputc('-', stdout);
}
} else { /* multiple colons found - it's an IPv6 address */
-
+
/* search for % (interface separator in case of IPv6 link address) */
while ( (tmp < (host + len)) && (*tmp != '%') && isprint(*tmp) ) tmp++;
if (*tmp == '%') { /* interface separator found */
-
+
/* number of chars till the end of the input field */
len -= (tmp - host);