Commit 56a1dcf9 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Merge branch 'nkupdates' into 'master'

MR with updates

See merge request !2
parents f70f6390 54f769cf
......@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67])
AC_INIT([cputool], [@PKG_VER_MAIN_CLEAN@-@PKG_VER_REL@], [nkukard@lbsd.net])
AC_INIT([cputool], [1.0.0], [nkukard@LBSD.net])
AM_INIT_AUTOMAKE([-Wno-portability])
AC_CONFIG_SRCDIR([cputool.h])
......
/*
* cputool.c - CPU & load managmenet tool
* Copyright (C) 2012-2015, AllWorldIT
* Copyright (C) 2012-2020, AllWorldIT
* Copyright (C) 2012, Nigel Kukard <nkukard@lbsd.net>
*
* This program is free software: you can redistribute it and/or modify
......@@ -67,7 +67,7 @@ uint64_t statsTimeDelayed = 0;
/* Print out our usage */
static void printUsage(char **argv) {
printf("%s - Copyright (c) 2012-2014, AllWorldIT\n",PACKAGE_STRING);
printf("%s - Copyright (c) 2012-2020, AllWorldIT\n",PACKAGE_STRING);
printf("Usage: %s [-c PCNT] [-l LOAD] [[-p PID | -P PID] | [--] COMMAND ...]\n",argv[0]);
printf("\n");
printf("Options:\n");
......@@ -429,7 +429,7 @@ static uint64_t getUpdateProcessGroupMembersCPUTime(pid_t pgrp)
/* Loop yet again and close/blank anything not active */
for (p = gPidList; p; p = p->next) {
/* Check if bit was not set */
/* Check if bit was not set */
if ((p->status | CPUTOOL_PID_ACTIVE) != p->status) {
/* Close & reset all data */
if (p->status & CPUTOOL_PID_FDOPEN) {
......@@ -609,17 +609,17 @@ int main (int argc, char *argv[]) {
/* Loop with options */
while (1) {
int option_index = 0;
char c;
int opt;
/* Process */
c = getopt_long(argc,argv,"p:P:c:l:vVh",long_options,&option_index);
opt = getopt_long(argc,argv,"p:P:c:l:vVh",long_options,&option_index);
if (c == -1) {
if (opt == -1) {
break;
}
/* Check... */
switch (c) {
switch (opt) {
case 'p':
if (pid != 0) {
fprintf(stderr,"%s: Multiple pid/pidgroups specified.\n",argv[0]);
......
......@@ -45,8 +45,8 @@
/* Structure to hold the info we get from /proc/X/stat */
struct cputool_stat {
int pid; // %d
struct cputool_stat {
int pid; // %d
char comm[256]; // %s
char state; // %c
int ppid; // %d
......@@ -85,9 +85,9 @@ struct cputool_stat {
unsigned long cnswap; // %lu
int exit_signal; // %d
int processor; // %d
unsigned long rt_priority; // %lu
unsigned long policy; // %lu
unsigned long long delayacct_blkio_ticks; // %llu
unsigned long rt_priority; // %lu
unsigned long policy; // %lu
unsigned long long delayacct_blkio_ticks; // %llu
};
/* Format of the /proc/X/stat file */
......
<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!-- Process this file with docbook-to-man to generate an nroff manual
page: `docbook-to-man manpage.sgml > manpage.1'. You may view
......@@ -20,13 +21,13 @@ manpage.1: manpage.sgml
<!ENTITY dhfirstname "<firstname>Nigel</firstname>">
<!ENTITY dhsurname "<surname>Kukard</surname>">
<!-- Please adjust the date whenever revising the manpage. -->
<!ENTITY dhdate "<date>2014-09-09 18:15</date>">
<!ENTITY dhdate "<date>2020-03-29 15:39</date>">
<!-- SECTION should be 1-8, maybe w/ subsection other parameters are
allowed: see man(7), man(1). -->
<!ENTITY dhsection "<manvolnum>8</manvolnum>">
<!ENTITY dhemail "<email>nkukard@lbsd.net</email>">
<!ENTITY dhemail "<email>nkukard@LBSD.net</email>">
<!ENTITY dhusername "nkukard">
<!ENTITY dhucpackage "<refentrytitle>CPUTOOL</refentrytitle>">
<!ENTITY dhucpackage "<refentrytitle>cputool</refentrytitle>">
<!ENTITY dhpackage "cputool">
<!ENTITY author "Nigel Kukard">
......@@ -71,7 +72,7 @@ manpage.1: manpage.sgml
<arg>--pid <replaceable>PID</replaceable></arg>
<arg>--pid-pgrp <replaceable>PID</replaceable></arg>
</group>
<arg><arg>--</arg> <arg rep=repeat choice=plain><replaceable>COMMAND</replaceable></arg></arg>
<arg><arg>--</arg> <arg rep="repeat" choice="plain"><replaceable>COMMAND</replaceable></arg></arg>
</group>
</cmdsynopsis>
</refsynopsisdiv>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment