Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06227deb08 | ||
|
|
53ca874f25 | ||
|
|
fbedd2a351 | ||
|
|
fb1974ef9b | ||
|
|
00ce2bed2a | ||
|
|
a1d643c4ca | ||
|
|
3d431ec0b6 | ||
|
|
38f147b166 | ||
|
|
9484298c47 | ||
|
|
a63975b5f9 | ||
|
|
1cbabd26de | ||
|
|
3e0ff42f52 | ||
|
|
f5ebd29a7c | ||
|
|
d9b4a0be07 |
49
Makefile
49
Makefile
@@ -1,21 +1,38 @@
|
||||
CFLAGS += -I/usr/X11R6/include/
|
||||
xmem: xmem.o get_mem.o MemStripChart.o
|
||||
gcc $(CFLAGS) -o xmem xmem.o get_mem.o MemStripChart.o -L/usr/X11R6/lib -lX11 -lXt -lXaw -lXmu
|
||||
PROG= xmem
|
||||
VERSION= 1.26
|
||||
LDFLAGS+= -L/usr/X11R6/lib -lX11 -lXt -lXaw -lXmu
|
||||
CFLAGS+= -Wall -I/usr/X11R6/include/
|
||||
OBJECTS= xmem.o get_mem.o MemStripChart.o
|
||||
|
||||
xmem.o: xmem.c
|
||||
gcc $(CFLAGS) -c xmem.c
|
||||
xmem: $(OBJECTS)
|
||||
$(CC) -o xmem $(OBJECTS) $(LDFLAGS)
|
||||
|
||||
get_mem.o: get_mem.c
|
||||
gcc $(CFLAGS) -c get_mem.c
|
||||
%.o: %c
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
MemStripChart.o: MemStripChart.c
|
||||
gcc $(CFLAGS) -c MemStripChart.c
|
||||
clean:
|
||||
-rm -rf $(OBJECTS) $(PROG)
|
||||
|
||||
clean:
|
||||
-rm xmem *.o *~
|
||||
dist:
|
||||
mkdir -p ${PROG}-${VERSION}
|
||||
cp *.h *.c Makefile xmem.1 xmem.bit copyright XMem.ad ${PROG}-${VERSION}
|
||||
tar cfvz ${PROG}-${VERSION}.tar.gz ${PROG}-${VERSION}
|
||||
rm -rf ${PROG}-${VERSION}
|
||||
|
||||
install: xmem
|
||||
install -d -m 755 $(DESTDIR)/usr/local/bin/
|
||||
install -d -m 755 $(DESTDIR)/etc/X11/app-defaults/
|
||||
install -m 755 xmem $(DESTDIR)/usr/local/bin/
|
||||
install -m 644 XMem.ad $(DESTDIR)/etc/X11/app-defaults/XMem
|
||||
dist-clean:
|
||||
-rm ${PROG}-${VERSION}.tar.gz
|
||||
|
||||
install:
|
||||
install -d -m 755 {PREFIX}/bin/
|
||||
install -c -S -s -o root -g bin -m 755 xmem ${PREFIX}/bin/xmem
|
||||
install -d -m 755 ${PREFIX}/man/man1/
|
||||
install -c -o root -g bin -m 644 xmem.1 ${PREFIX}/man/man1/xmem.1
|
||||
install -d -m 755 ${PREFIX}/lib/X11/app-defaults/
|
||||
install -c -o root -g bin -m 644 XMem.ad ${PREFIX}/lib/X11/app-defaults/XMem
|
||||
install -d -m 755 ${PREFIX}/share/${PROG}/
|
||||
install -c -o root -g bin -m 644 xmem.bit ${PREFIX}/share/${PROG}/xmem.bit
|
||||
install -c -o root -g bin -m 644 copyright ${PREFIX}/share/${PROG}/copyright
|
||||
|
||||
all: xmem
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -51,7 +51,7 @@ static XtResource resources[] = {
|
||||
|
||||
#undef offset
|
||||
|
||||
static void Initialize(), Destroy(), Redisplay(), MoveChart(), SetPoints();
|
||||
static void Initialize(), Destroy(), Redisplay(), MoveChart(MemStripChartWidget w, Boolean blit), SetPoints();
|
||||
static Boolean SetValues();
|
||||
static int repaint_window();
|
||||
|
||||
@@ -114,9 +114,7 @@ static void draw_it();
|
||||
*/
|
||||
|
||||
static void
|
||||
CreateGC(w, which)
|
||||
MemStripChartWidget w;
|
||||
unsigned int which;
|
||||
CreateGC(MemStripChartWidget w, unsigned int which)
|
||||
{
|
||||
XGCValues myXGCV;
|
||||
|
||||
@@ -165,9 +163,7 @@ CreateGC(w, which)
|
||||
*/
|
||||
|
||||
static void
|
||||
DestroyGC(w, which)
|
||||
MemStripChartWidget w;
|
||||
unsigned int which;
|
||||
DestroyGC(MemStripChartWidget w, unsigned int which)
|
||||
{
|
||||
if (which & FOREGROUND)
|
||||
XtReleaseGC((Widget) w, w->mem_strip_chart.fgGC);
|
||||
@@ -205,9 +201,7 @@ DestroyGC(w, which)
|
||||
*/
|
||||
|
||||
static void
|
||||
DrawMemStrip(w, x)
|
||||
MemStripChartWidget w;
|
||||
unsigned int x;
|
||||
DrawMemStrip(MemStripChartWidget w, unsigned int x)
|
||||
{
|
||||
int top, bottom;
|
||||
|
||||
@@ -260,10 +254,7 @@ DrawMemStrip(w, x)
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void Initialize (greq, gnew, args, num_args)
|
||||
Widget greq, gnew;
|
||||
ArgList args;
|
||||
Cardinal *num_args;
|
||||
static void Initialize (Widget greq, Widget gnew, ArgList args, Cardinal *num_args)
|
||||
{
|
||||
MemStripChartWidget w = (MemStripChartWidget)gnew;
|
||||
|
||||
@@ -281,8 +272,7 @@ static void Initialize (greq, gnew, args, num_args)
|
||||
SetPoints(w);
|
||||
}
|
||||
|
||||
static void Destroy (gw)
|
||||
Widget gw;
|
||||
static void Destroy (Widget gw)
|
||||
{
|
||||
MemStripChartWidget w = (MemStripChartWidget)gw;
|
||||
|
||||
@@ -300,10 +290,7 @@ static void Destroy (gw)
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
static void Redisplay(w, event, region)
|
||||
Widget w;
|
||||
XEvent *event;
|
||||
Region region;
|
||||
static void Redisplay(Widget w, XEvent *event, Region region)
|
||||
{
|
||||
if (event->type == GraphicsExpose)
|
||||
(void) repaint_window ((MemStripChartWidget)w, event->xgraphicsexpose.x,
|
||||
@@ -315,9 +302,7 @@ static void Redisplay(w, event, region)
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
draw_it(client_data, id)
|
||||
XtPointer client_data;
|
||||
XtIntervalId *id; /* unused */
|
||||
draw_it(XtPointer client_data, XtIntervalId *id)
|
||||
{
|
||||
MemStripChartWidget w = (MemStripChartWidget)client_data;
|
||||
MemStripChartCallbackData value;
|
||||
@@ -356,7 +341,8 @@ draw_it(client_data, id)
|
||||
w->mem_strip_chart.valuedata[w->mem_strip_chart.interval] = value;
|
||||
if (XtIsRealized((Widget)w)) {
|
||||
|
||||
DrawMemStrip(w, w->mem_strip_chart.interval, value);
|
||||
/* XXX DrawMemStrip(w, w->mem_strip_chart.interval, value); */
|
||||
DrawMemStrip(w, w->mem_strip_chart.interval);
|
||||
|
||||
/*
|
||||
* Fill in the graph lines we just painted over.
|
||||
@@ -385,9 +371,7 @@ draw_it(client_data, id)
|
||||
*/
|
||||
|
||||
static int
|
||||
repaint_window(w, left, width)
|
||||
MemStripChartWidget w;
|
||||
int left, width;
|
||||
repaint_window(MemStripChartWidget w, int left, int width)
|
||||
{
|
||||
int i, j;
|
||||
int next = w->mem_strip_chart.interval;
|
||||
@@ -425,7 +409,7 @@ repaint_window(w, left, width)
|
||||
|
||||
/* Draw data point lines. */
|
||||
for (i = left; i < width; i++) {
|
||||
DrawMemStrip(w, i, w->mem_strip_chart.valuedata[i]);
|
||||
DrawMemStrip(w, i);
|
||||
}
|
||||
|
||||
/* Draw graph reference lines */
|
||||
@@ -445,9 +429,7 @@ repaint_window(w, left, width)
|
||||
*/
|
||||
|
||||
static void
|
||||
MoveChart(w, blit)
|
||||
MemStripChartWidget w;
|
||||
Boolean blit;
|
||||
MoveChart(MemStripChartWidget w, Boolean blit)
|
||||
{
|
||||
double old_max;
|
||||
int left, i, j;
|
||||
@@ -509,10 +491,7 @@ MoveChart(w, blit)
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static Boolean SetValues (current, request, new, args, num_args)
|
||||
Widget current, request, new;
|
||||
ArgList args;
|
||||
Cardinal *num_args;
|
||||
static Boolean SetValues (Widget current, Widget request, Widget new, ArgList args, Cardinal *num_args)
|
||||
{
|
||||
MemStripChartWidget old = (MemStripChartWidget)current;
|
||||
MemStripChartWidget w = (MemStripChartWidget)new;
|
||||
@@ -583,8 +562,7 @@ static Boolean SetValues (current, request, new, args, num_args)
|
||||
#define HEIGHT ( (unsigned int) w->core.height)
|
||||
|
||||
static void
|
||||
SetPoints(widget)
|
||||
Widget widget;
|
||||
SetPoints(Widget widget)
|
||||
{
|
||||
MemStripChartWidget w = (MemStripChartWidget) widget;
|
||||
XPoint * points;
|
||||
|
||||
BIN
MemStripChart.o
BIN
MemStripChart.o
Binary file not shown.
37
copyright
Normal file
37
copyright
Normal file
@@ -0,0 +1,37 @@
|
||||
This package was debianized by Daniel Baumann <daniel@debian.org> on
|
||||
Sun, 22 Jan 2006 14:26:00 +0100.
|
||||
|
||||
This xmem was resurrected from the xfree86 sources of the bo release.
|
||||
|
||||
Copyright Holder: X Consortium
|
||||
|
||||
License:
|
||||
|
||||
Copyright (C) 1987 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the X Consortium shall
|
||||
not be used in advertising or otherwise to promote the sale, use or
|
||||
other dealings in this Software without prior written authorization from
|
||||
the X Consortium.
|
||||
|
||||
The Debian packaging is (C) 2006-2007, Daniel Baumann <daniel@debian.org> and
|
||||
is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: get_mem.c,v 1.3 2017/02/18 21:14:12 bch Exp $
|
||||
/* $Id: get_mem.c,v 1.4 2017/02/26 16:03:48 bch Exp $
|
||||
* Adapted: get memory usage on OpenBSD
|
||||
* Author: Christian Barthel <bch@vcs.onfire.org>
|
||||
*
|
||||
@@ -14,11 +14,14 @@
|
||||
#include <sys/swap.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <err.h>
|
||||
#include "MemStripChart.h"
|
||||
|
||||
static int pageshift = -1;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH XMEM 1x "Release 5, X Version 11" "memory display utility"
|
||||
.TH XMEM 1 "Release 5, X Version 11" "memory display utility"
|
||||
.SH NAME
|
||||
xmem \- memory/swap usage display utility for X
|
||||
.SH SYNOPSIS
|
||||
@@ -55,15 +55,15 @@ second. The default is 10.
|
||||
(Xresource: *mem.update)
|
||||
.TP
|
||||
.B \-codecolor color
|
||||
Color for used code and stack memory. The default is red.
|
||||
Color for used code and stack memory. The default is blue.
|
||||
(Xresource: *mem.codecolor)
|
||||
.TP
|
||||
.B \-cachedcolor color
|
||||
Color for cached memory. The default is yellow.
|
||||
Color for cached memory. The default is orange.
|
||||
(Xresource: *mem.cachedcolor)
|
||||
.TP
|
||||
.B \-buffercolor color
|
||||
Color for buffer memory. The default is blue.
|
||||
Color for buffer memory. See BUGS.
|
||||
(Xresource: *mem.buffercolor)
|
||||
.TP
|
||||
.B \-freecolor color
|
||||
@@ -109,7 +109,7 @@ stored in the RESOURCE_MANAGER property.
|
||||
.SH SEE ALSO
|
||||
X(1), xrdb(1), mem(4), Athena StripChart Widget.
|
||||
.SH BUGS
|
||||
The buffer-memory is always 0.
|
||||
The buffer-memory is always 0. There is no distinction on BSDs.
|
||||
.SH COPYRIGHT
|
||||
Copyright 1988, Massachusetts Institute of Technology.
|
||||
.br
|
||||
@@ -121,4 +121,4 @@ Della Fera (MIT-Athena), and Chris Peterson (MIT-LCS).
|
||||
.P
|
||||
Updated 2007/04 by Michelle Konzack <linux4michelle@freenet.de>
|
||||
.P
|
||||
Update by Christian Barthel <bch@onfire.org>, 2017/01, OpenBSD support.
|
||||
Update by Christian Barthel <bch@onfire.org>, 2017/01, OpenBSD support.
|
||||
24
xmem.c
24
xmem.c
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* xmem - display memory/swap usage utility for X
|
||||
*
|
||||
* Copyright 2017 Christian Barthel <bch@onfire.org>
|
||||
* Updated by Christian Barthel <bch@onfire.org>
|
||||
*
|
||||
* Copyright 1989 Massachusetts Institute of Technology
|
||||
*
|
||||
* $XConsortium: xload.c,v 1.36 91/05/24 16:57:46 converse Exp $
|
||||
@@ -45,17 +46,6 @@ typedef struct _XLoadResources {
|
||||
* pass over the remaining options after XtParseCommand is let loose.
|
||||
*/
|
||||
|
||||
static XrmOptionDescRec options[] = {
|
||||
{"-scale", "*load.minScale", XrmoptionSepArg, NULL},
|
||||
{"-update", "*load.update", XrmoptionSepArg, NULL},
|
||||
{"-hl", "*load.highlight", XrmoptionSepArg, NULL},
|
||||
{"-highlight", "*load.highlight", XrmoptionSepArg, NULL},
|
||||
{"-jumpscroll", "*load.jumpScroll", XrmoptionSepArg, NULL},
|
||||
{"-label", "*label.label", XrmoptionSepArg, NULL},
|
||||
{"-nolabel", "*showLabel", XrmoptionNoArg, "False"},
|
||||
{"-lights", "*useLights", XrmoptionNoArg, "True"},
|
||||
};
|
||||
|
||||
static XrmOptionDescRec options_mem[] = {
|
||||
{"-scale", "*mem.minScale", XrmoptionSepArg, NULL},
|
||||
{"-update", "*mem.update", XrmoptionSepArg, NULL},
|
||||
@@ -79,13 +69,6 @@ static XrmOptionDescRec options_mem[] = {
|
||||
|
||||
#define Offset(field) (XtOffsetOf(XLoadResources, field))
|
||||
|
||||
static XtResource my_resources[] = {
|
||||
{"showLabel", XtCBoolean, XtRBoolean, sizeof(Boolean),
|
||||
Offset(show_label), XtRImmediate, (XtPointer) TRUE},
|
||||
{"useLights", XtCBoolean, XtRBoolean, sizeof(Boolean),
|
||||
Offset(use_lights), XtRImmediate, (XtPointer) FALSE},
|
||||
};
|
||||
|
||||
static XtResource my_resources_mem[] = {
|
||||
{"showLabel", XtCBoolean, XtRBoolean, sizeof(Boolean),
|
||||
Offset(show_label), XtRImmediate, (XtPointer) TRUE},
|
||||
@@ -99,7 +82,6 @@ static XtActionsRec xload_actions[] = {
|
||||
{ "quit", quit },
|
||||
};
|
||||
static Atom wm_delete_window;
|
||||
static int light_update = 10 * 1000;
|
||||
|
||||
/*
|
||||
* Exit with message describing command line format.
|
||||
@@ -154,7 +136,6 @@ int main(int argc, char **argv)
|
||||
Arg args[1];
|
||||
Pixmap icon_pixmap = None;
|
||||
char *label, host[256];
|
||||
char *lastslash;
|
||||
|
||||
/* For security reasons, we reset our uid/gid after doing the necessary
|
||||
system initialization and before calling any X routines. */
|
||||
@@ -227,6 +208,7 @@ int main(int argc, char **argv)
|
||||
errx(1, "pledge failed: %s", strerror(errno));
|
||||
|
||||
XtAppMainLoop(app_con);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user