2019-11-08 in class

This commit is contained in:
Claudio Maggioni 2019-11-08 09:02:08 +01:00
parent 9b25392945
commit dfd0afbbda
13 changed files with 1047 additions and 0 deletions

144
midterm/processes/Makefile Normal file
View file

@ -0,0 +1,144 @@
OBJECTS=processes.o
CFLAGS=-Wall -g
CXXFLAGS=-Wall -g
SHELL=/bin/bash
TIMEOUT=8
TESTS_DIR=tests
TESTS_SH:=$(wildcard $(TESTS_DIR)/*.sh)
TESTS_SH_NAMES:=$(patsubst $(TESTS_DIR)/%.sh, %, $(TESTS_SH))
TESTS_IO:=$(wildcard $(TESTS_DIR)/*.in)
TESTS_IO_NAMES:=$(patsubst $(TESTS_DIR)/%.in, %, $(TESTS_IO))
TESTS_C:=$(wildcard $(TESTS_DIR)/*.c)
TESTS_CXX:=$(wildcard $(TESTS_DIR)/*.cc)
TESTS_BIN:=$(patsubst $(TESTS_DIR)/%.c, $(TESTS_DIR)/%, $(TESTS_C)) \
$(patsubst $(TESTS_DIR)/%.cc, $(TESTS_DIR)/%, $(TESTS_CXX))
TESTS_BIN_NAMES:=$(patsubst $(TESTS_DIR)/%.c, %, $(TESTS_C)) $(patsubst $(TESTS_DIR)/%.cc, %, $(TESTS_CXX))
.PHONY: all
all: compile check
.PHONY: compile-program
compile: $(PROGRAMS) $(OBJECTS)
.PHONY: check
check: check-bin check-io-sh
.PHONY: check-io-sh
check-io-sh: compile $(TESTS_IO) $(TESTS_SH)
@exec 2> /dev/null; \
for p in $(foreach prog,$(PROGRAMS),$(dir $(prog))$(prog)); do \
echo "Testing $${p}:" ; \
for t in $(TESTS_IO_NAMES); do \
echo -n "Running test $$t..." ; \
"$$p" < "$(TESTS_DIR)/$$t.in" > "$$t.out" 2>&1 & \
prog_pid=$$!; \
( sleep $(TIMEOUT); kill $$prog_pid > /dev/null 2>&1 ) & \
killer_pid=$$!; \
wait $$prog_pid; \
res=$$?; \
if test $$res -gt 128; \
then \
case `kill -l $$(($$res - 128))` in \
ABRT ) echo "FAIL"; ;; \
TERM ) echo "TIME OUT"; ;; \
* ) echo "UNKNOWN ERROR"; ;; \
esac ; \
echo "see $(TESTS_DIR)/$$t.in" ;\
echo "you may run $$p < $(TESTS_DIR)/$$t.in" ;\
echo "to see what went wrong";\
rm -f "$$t.out" ;\
else \
kill $$killer_pid > /dev/null 2>&1 ;\
wait $$killer_pid; \
if cmp -s "$$t.out" "$(TESTS_DIR)/$$t.expected"; \
then \
echo "PASS" ;\
rm -f "$$t.out" ;\
else \
echo "FAIL" ;\
echo "see $(TESTS_DIR)/$$t.sh" ;\
echo "run diff $$t.out $(TESTS_DIR)/$$t.expected";\
echo "to see the difference between the actual and expected output";\
fi; \
fi; \
done; \
for t in $(TESTS_SH_NAMES); do \
echo -n "Running test $$t..." ; \
$(SHELL) "$(TESTS_DIR)/$$t.sh" "$$p" > "$$t.out" 2>&1 & \
prog_pid=$$!; \
( sleep $(TIMEOUT); kill $$prog_pid > /dev/null 2>&1 ) & \
killer_pid=$$!; \
wait $$prog_pid; \
res=$$?; \
if test $$res -gt 128; \
then \
case `kill -l $$(($$res - 128))` in \
ABRT ) echo "FAIL"; ;; \
TERM ) echo "TIME OUT"; ;; \
* ) echo "UNKNOWN ERROR"; ;; \
esac ; \
echo "see $(TESTS_DIR)/$$t.sh" ;\
echo "you may run $(TESTS_DIR)/$$t.sh $$p" ;\
echo "to see what went wrong";\
rm -f "$$t.out" ;\
else \
kill $$killer_pid > /dev/null 2>&1 ;\
wait $$killer_pid; \
if cmp -s "$$t.out" "$(TESTS_DIR)/$$t.expected"; \
then \
echo "PASS" ;\
rm -f "$$t.out" ;\
else \
echo "FAIL" ;\
echo "see $(TESTS_DIR)/$$t.sh" ;\
echo "run diff $$t.out $(TESTS_DIR)/$$t.expected";\
echo "to see the difference between the actual and expected output";\
fi; \
fi; \
done; \
done
$(TESTS_DIR)/%: $(TESTS_DIR)/%.c $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) $(TESTS_DIR)/$*.c $(OBJECTS) -o $@
$(TESTS_DIR)/%: $(TESTS_DIR)/%.cc $(OBJECTS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(TESTS_DIR)/$*.cc $(OBJECTS) -o $@
.PHONY: check-bin
check-bin: $(TESTS_BIN)
@exec 2> /dev/null; \
for t in $(TESTS_BIN_NAMES); do \
echo -n "Running test $$t..." ; \
"$(TESTS_DIR)/$$t" &\
prog_pid=$$!; \
( sleep $(TIMEOUT); kill $$prog_pid > /dev/null 2>&1 ) & \
killer_pid=$$!; \
wait $$prog_pid; \
res=$$?; \
if test $$res -gt 128; \
then \
case `kill -l $$(($$res - 128))` in \
ABRT ) echo "FAIL"; ;; \
TERM ) echo "TIME OUT"; ;; \
* ) echo "UNKNOWN ERROR"; ;; \
esac ; \
echo "you may run $(TESTS_DIR)/$$t to see what went wrong" ;\
else \
kill $$killer_pid > /dev/null 2>&1 ;\
wait $$killer_pid; \
echo "PASS" ;\
fi; \
done
.PHONY: clean
clean:
rm -f $(PROGRAMS) $(OBJECTS) tests/*.o $(TESTS_BIN)

View file

@ -0,0 +1,39 @@
#include <stdlib.h>
#include "processes.h"
typedef unsigned int uint;
typedef unsigned long int ulong;
const ulong INIT_CAP = 1024;
struct process {
uint pid;
uint ppid;
char user[9];
double priority;
ulong resident_size;
ulong size;
ulong virtual_size;
char command[16];
};
struct processes {
ulong size;
ulong capacity;
struct process procs[];
};
struct processes* new_processes() {
struct processes* p = malloc(sizeof(struct processes) + INIT_CAP *
sizeof(struct process));
if (!p) {
return NULL;
}
p->size = 0;
p->capacity = INTT_CAP;
return p;
}

View file

@ -0,0 +1,36 @@
#ifndef PROCESSS_H_INCLUDED
#define PROCESSS_H_INCLUDED
struct processes;
extern struct processes * new_processes();
extern void delete(struct processes * p);
extern int add_from_file(struct processes * p, const char * filename);
extern void clear(struct processes * p);
struct query {
int priority;
long int rss;
long int size;
long int vsize;
float cpu_usage;
};
struct query_result;
struct query_result * search(struct processes *, const struct query *);
extern int get_pid(struct query_result *r);
extern int get_ppid(struct query_result *r);
extern const char * get_user(struct query_result *r);
extern int get_priority(struct query_result *r);
extern float get_cpu_usage(struct query_result *r);
extern long int get_rss(struct query_result *r);
extern long int get_size(struct query_result *r);
extern long int get_vsize(struct query_result *r);
extern const char * get_command(struct query_result *r);
struct query_result * next(struct query_result *);
void terminate_query(struct query_result *);
#endif

View file

@ -0,0 +1,13 @@
#ifndef BASIC_TESTING_H_INCLUDED
#define BASIC_TESTING_H_INCLUDED
#include <stdlib.h>
#include <stdio.h>
#define assert_int_equal(expr,value) \
do { int e = (expr); int v = (value); \
if (e != v) { \
fprintf(stderr, "%s:%d: Assertion `%s == %s' failed (%d != %d).\n", __FILE__, __LINE__, #expr, #value, e, v); \
abort(); } } while(0)
#endif

View file

@ -0,0 +1,284 @@
1 0 root 19 0.1 9164 18868 225468 systemd
2 0 root 19 0.0 0 0 0 kthreadd
4 2 root 39 0.0 0 0 0 kworker/0:0H
6 2 root 39 0.0 0 0 0 mm_percpu_wq
7 2 root 19 0.0 0 0 0 ksoftirqd/0
8 2 root 19 0.0 0 0 0 rcu_sched
9 2 root 19 0.0 0 0 0 rcu_bh
10 2 root 139 0.0 0 0 0 migration/0
11 2 root 139 0.0 0 0 0 watchdog/0
12 2 root 19 0.0 0 0 0 cpuhp/0
13 2 root 19 0.0 0 0 0 cpuhp/1
14 2 root 139 0.0 0 0 0 watchdog/1
15 2 root 139 0.0 0 0 0 migration/1
16 2 root 19 0.0 0 0 0 ksoftirqd/1
18 2 root 39 0.0 0 0 0 kworker/1:0H
19 2 root 19 0.0 0 0 0 cpuhp/2
20 2 root 139 0.0 0 0 0 watchdog/2
21 2 root 139 0.0 0 0 0 migration/2
22 2 root 19 0.0 0 0 0 ksoftirqd/2
24 2 root 39 0.0 0 0 0 kworker/2:0H
25 2 root 19 0.0 0 0 0 cpuhp/3
26 2 root 139 0.0 0 0 0 watchdog/3
27 2 root 139 0.0 0 0 0 migration/3
28 2 root 19 0.0 0 0 0 ksoftirqd/3
30 2 root 39 0.0 0 0 0 kworker/3:0H
31 2 root 19 0.0 0 0 0 kdevtmpfs
32 2 root 39 0.0 0 0 0 netns
33 2 root 19 0.0 0 0 0 rcu_tasks_kthre
34 2 root 19 0.0 0 0 0 kauditd
37 2 root 19 0.0 0 0 0 khungtaskd
38 2 root 19 0.0 0 0 0 oom_reaper
39 2 root 39 0.0 0 0 0 writeback
40 2 root 19 0.0 0 0 0 kcompactd0
41 2 root 14 0.0 0 0 0 ksmd
42 2 root 0 0.0 0 0 0 khugepaged
43 2 root 39 0.0 0 0 0 crypto
44 2 root 39 0.0 0 0 0 kintegrityd
45 2 root 39 0.0 0 0 0 kblockd
46 2 root 39 0.0 0 0 0 ata_sff
47 2 root 39 0.0 0 0 0 md
48 2 root 39 0.0 0 0 0 edac-poller
49 2 root 39 0.0 0 0 0 devfreq_wq
50 2 root 39 0.0 0 0 0 watchdogd
52 2 root 19 0.0 0 0 0 kworker/1:1
55 2 root 19 0.0 0 0 0 kswapd0
57 2 root 19 0.0 0 0 0 ecryptfs-kthrea
99 2 root 39 0.0 0 0 0 kthrotld
100 2 root 39 0.0 0 0 0 acpi_thermal_pm
105 2 root 39 0.0 0 0 0 ipv6_addrconf
115 2 root 39 0.0 0 0 0 kstrp
132 2 root 39 0.0 0 0 0 charger_manager
194 2 root 19 0.0 0 0 0 scsi_eh_0
195 2 root 39 0.0 0 0 0 scsi_tmf_0
196 2 root 19 0.0 0 0 0 scsi_eh_1
197 2 root 39 0.0 0 0 0 scsi_tmf_1
198 2 root 19 0.0 0 0 0 scsi_eh_2
199 2 root 39 0.0 0 0 0 scsi_tmf_2
200 2 root 90 0.0 0 0 0 irq/16-mmc0
201 2 root 19 0.0 0 0 0 scsi_eh_3
202 2 root 39 0.0 0 0 0 scsi_tmf_3
203 2 root 19 0.0 0 0 0 scsi_eh_4
204 2 root 39 0.0 0 0 0 scsi_tmf_4
205 2 root 19 0.0 0 0 0 scsi_eh_5
206 2 root 39 0.0 0 0 0 scsi_tmf_5
240 2 root 41 0.0 0 0 0 i915/signal:0
241 2 root 41 0.0 0 0 0 i915/signal:1
242 2 root 41 0.0 0 0 0 i915/signal:2
249 2 root 39 0.0 0 0 0 kworker/3:1H
296 2 root 39 0.0 0 0 0 kworker/0:1H
305 2 root 39 0.0 0 0 0 kdmflush
307 2 root 39 0.0 0 0 0 bioset
308 2 root 39 0.0 0 0 0 kcryptd_io
310 2 root 39 0.0 0 0 0 kcryptd
311 2 root 19 0.0 0 0 0 dmcrypt_write
312 2 root 39 0.0 0 0 0 bioset
315 2 root 39 0.0 0 0 0 kworker/u17:1
316 2 root 39 0.0 0 0 0 kworker/u17:2
349 2 root 19 0.0 0 0 0 jbd2/sda1-8
350 2 root 39 0.0 0 0 0 ext4-rsv-conver
404 1 root 20 0.0 72160 17552 201844 systemd-journal
418 1 root 19 0.0 4652 1628 46320 systemd-udevd
432 2 root 39 0.0 0 0 0 loop0
445 2 root 39 0.0 0 0 0 loop1
453 2 root 39 0.0 0 0 0 loop2
475 2 root 39 0.0 0 0 0 kworker/1:1H
476 2 root 39 0.0 0 0 0 loop3
553 2 root 39 0.0 0 0 0 kworker/2:1H
576 2 root 90 0.0 0 0 0 irq/20-smo8800
635 2 root 90 0.0 0 0 0 irq/31-mei_me
669 2 root 39 0.0 0 0 0 kmemstick
678 2 root 39 0.0 0 0 0 cfg80211
688 2 root 90 0.1 0 0 0 irq/32-iwlwifi
819 1 systemd+ 19 0.0 6104 700 70748 systemd-resolve
820 1 systemd+ 19 0.0 3384 8908 146112 systemd-timesyn
915 1 root 19 0.0 9256 9168 179884 thermald
919 1 syslog 19 0.0 4696 18628 263036 rsyslogd
922 1 avahi 19 0.0 3840 676 47272 avahi-daemon
926 1 root 19 0.0 17388 16912 170784 networkd-dispat
930 1 daemon 19 0.0 2348 468 28332 atd
931 1 root 19 0.0 7200 25928 287676 accounts-daemon
932 1 root 19 0.0 4600 556 36480 bluetoothd
939 922 avahi 19 0.0 340 480 47076 avahi-daemon
940 1 root 19 0.0 6216 768 70664 systemd-logind
948 1 root 19 0.0 3204 468 31320 cron
951 1 root 19 0.0 11308 43920 503024 udisksd
956 1 root 19 0.0 9504 34508 434328 ModemManager
958 1 message+ 19 0.0 6668 3388 52640 dbus-daemon
998 1 root 19 0.0 19544 38568 483364 NetworkManager
999 1 root 19 0.0 7960 712 45468 wpa_supplicant
1000 1 root 19 0.0 824 312 4552 acpid
1002 1 root 19 0.0 3488 8820 110480 irqbalance
1003 1 root 19 0.0 23140 129772 1070008 snapd
1015 1 root 19 0.0 9932 28080 296220 polkitd
1025 1 dictd 19 0.0 6672 596 43292 dictd
1036 1 colord 19 0.0 14220 30076 318272 colord
1053 1 root 19 0.0 19868 16760 187232 unattended-upgr
1064 1 root 19 0.0 7856 26156 300948 gdm3
1070 1064 root 19 0.0 9280 18232 279348 gdm-session-wor
1090 1 gdm 19 0.0 8044 1100 76884 systemd
1096 1090 gdm 19 0.0 2760 2532 141308 (sd-pam)
1107 1 debian-+ 19 0.1 45196 39272 98192 tor
1108 1 root 19 0.0 7052 25344 2113988 console-kit-dae
1181 1070 gdm 19 0.0 5424 17236 190692 gdm-wayland-ses
1183 1090 gdm 19 0.0 4568 976 50228 dbus-daemon
1185 1181 gdm 19 0.0 13472 43260 552028 gnome-session-b
1196 1185 gdm 19 0.2 126180 201116 3329884 gnome-shell
1216 1 root 19 0.0 8424 34424 315340 upowerd
1266 1196 gdm 19 0.0 52928 58160 618220 Xwayland
1274 1090 gdm 19 0.0 6372 33916 349432 at-spi-bus-laun
1279 1274 gdm 19 0.0 4216 672 49924 dbus-daemon
1281 1090 gdm 19 0.0 5772 17476 220764 at-spi2-registr
1285 1090 gdm 19 0.0 11892 19552 1408664 pulseaudio
1286 1 rtkit 18 0.0 2896 17112 183504 rtkit-daemon
1301 1196 gdm 19 0.0 7900 42812 427988 ibus-daemon
1304 1301 gdm 19 0.0 5732 25704 273640 ibus-dconf
1307 1 gdm 19 0.0 28640 31840 480164 ibus-x11
1309 1090 gdm 19 0.0 5980 25572 271452 ibus-portal
1323 1 root 19 0.0 6844 25808 289764 boltd
1324 1 root 19 0.0 13580 26472 366580 packagekitd
1325 1185 gdm 19 0.0 31676 49072 632684 gsd-xsettings
1327 1185 gdm 19 0.0 5884 25700 271208 gsd-a11y-settin
1329 1185 gdm 19 0.0 28276 31848 479788 gsd-clipboard
1332 1185 gdm 19 0.0 30696 65496 804504 gsd-color
1338 1185 gdm 19 0.0 13772 18100 386604 gsd-datetime
1339 1185 gdm 19 0.0 5484 25588 276636 gsd-housekeepin
1340 1185 gdm 19 0.0 28928 48836 634384 gsd-keyboard
1347 1185 gdm 19 0.0 30964 73804 1142000 gsd-media-keys
1348 1185 gdm 19 0.0 4536 17240 194892 gsd-mouse
1349 1185 gdm 19 0.0 30504 48788 926224 gsd-power
1352 1185 gdm 19 0.0 8672 17608 259900 gsd-print-notif
1353 1185 gdm 19 0.0 4628 17240 194912 gsd-rfkill
1354 1185 gdm 19 0.0 4656 25564 268628 gsd-screensaver
1358 1185 gdm 19 0.0 8308 25820 298164 gsd-sharing
1363 1185 gdm 19 0.0 9132 34120 370988 gsd-smartcard
1366 1185 gdm 19 0.0 7984 25892 325920 gsd-sound
1368 1185 gdm 19 0.0 29052 40552 564868 gsd-wacom
1379 1301 gdm 19 0.0 6396 17380 197784 ibus-engine-sim
1431 1064 root 19 0.0 9460 18308 285572 gdm-session-wor
1447 1 carzanig 19 0.0 8400 1428 77212 systemd
1450 2 root 39 0.0 0 0 0 iprt-VBoxWQueue
1451 1447 carzanig 19 0.0 2860 2676 141452 (sd-pam)
1456 2 root 19 0.0 0 0 0 iprt-VBoxTscThr
1504 1 carzanig 19 0.0 8592 67720 650080 gnome-keyring-d
1507 998 root 19 0.0 6252 1304 25992 dhclient
1516 1431 carzanig 19 0.0 5888 17288 205024 gdm-x-session
1518 1516 root 19 2.2 131164 29704 610272 Xorg
1524 1447 carzanig 19 0.0 5380 1840 51092 dbus-daemon
1533 1516 carzanig 19 0.0 920 316 4628 run-systemd-ses
1616 1533 carzanig 19 0.0 320 392 11304 ssh-agent
1698 1533 carzanig 19 0.0 5776 532 64920 systemctl
1710 1447 carzanig 19 0.0 11532 35148 938468 indicator-sound
1711 1447 carzanig 19 0.0 7448 59828 836672 indicator-sessi
1712 1447 carzanig 19 0.0 7960 34776 366732 indicator-messa
1713 1447 carzanig 19 0.0 28264 38736 594244 indicator-print
1714 1447 carzanig 19 0.0 38996 66700 843356 indicator-keybo
1715 1447 carzanig 19 0.0 10828 26144 391392 indicator-appli
1727 1447 carzanig 19 0.0 6808 42488 424808 indicator-power
1732 1447 carzanig 19 0.0 27548 80792 1324524 indicator-datet
1735 1447 carzanig 19 0.0 14584 51952 626188 gnome-session-b
1738 1447 carzanig 19 0.0 5976 34020 340836 indicator-bluet
1750 1447 carzanig 19 0.0 21668 29116 421636 gnome-screensav
1762 1447 carzanig 19 0.0 6208 33960 349532 at-spi-bus-laun
1766 1447 carzanig 30 4.4 12440 19896 2212080 pulseaudio
1770 1762 carzanig 19 0.0 4256 784 50036 dbus-daemon
1775 1447 carzanig 19 0.0 6860 17496 220784 at-spi2-registr
1787 1447 carzanig 19 0.0 7064 25788 284860 gvfsd
1790 1447 carzanig 19 0.0 25820 62008 1234200 evolution-sourc
1802 1447 carzanig 19 0.0 5236 42636 416116 gvfsd-fuse
1824 1447 carzanig 19 0.0 31304 44068 769352 goa-daemon
1826 2 root 29 0.0 0 0 0 krfcommd
1834 1735 carzanig 19 0.0 7240 34188 357692 gsd-housekeepin
1838 1735 carzanig 19 0.0 19744 36264 497944 gsd-keyboard
1839 1735 carzanig 19 0.0 21512 61208 1005540 gsd-media-keys
1841 1735 carzanig 19 0.0 5828 25700 271268 gsd-mouse
1843 1447 carzanig 19 0.0 67528 88500 885212 evolution-calen
1847 1735 carzanig 19 0.0 23424 45660 863440 gsd-power
1852 1735 carzanig 19 0.0 10164 26116 342224 gsd-print-notif
1853 1735 carzanig 19 0.0 5760 42344 416240 gsd-rfkill
1858 1735 carzanig 19 0.0 11384 44680 446868 gsd-sharing
1860 1735 carzanig 19 0.0 7964 42440 444772 gsd-smartcard
1862 1735 carzanig 19 0.0 4736 25564 268628 gsd-screensaver
1876 1447 carzanig 19 0.0 7428 25712 296252 goa-identity-se
1891 1735 carzanig 19 0.0 8140 25880 325964 gsd-sound
1892 1735 carzanig 19 0.0 19580 28884 419616 gsd-wacom
1895 1735 carzanig 19 0.0 22576 36628 488008 gsd-xsettings
1897 1735 carzanig 19 0.0 5980 25700 271264 gsd-a11y-settin
1898 1735 carzanig 19 0.0 17076 19160 334744 gsd-clipboard
1901 1735 carzanig 19 0.0 23068 63076 873916 gsd-color
1906 1735 carzanig 19 0.0 13728 26428 462848 gsd-datetime
1943 1735 carzanig 19 0.7 44420 66644 639552 compiz
1949 1447 carzanig 19 0.0 12712 34592 501652 gsd-printer
1956 1843 carzanig 19 0.0 70900 154496 1281016 evolution-calen
1961 1735 carzanig 19 0.0 46692 51596 809560 gnome-panel
1967 1447 carzanig 19 0.0 6052 18168 188708 dconf-service
1978 1447 carzanig 19 0.0 24436 52372 725792 evolution-addre
1994 1978 carzanig 19 0.0 27236 86028 1010240 evolution-addre
2043 1735 carzanig 19 0.0 116608 88548 1619804 nautilus-deskto
2057 1787 carzanig 19 0.0 6908 34248 360996 gvfsd-trash
2061 1447 carzanig 19 0.0 8464 26312 299328 gvfs-udisks2-vo
2066 1447 carzanig 19 0.0 6600 26132 281684 gvfs-gphoto2-vo
2071 1447 carzanig 19 0.0 5964 25696 266940 gvfs-goa-volume
2075 1447 carzanig 19 0.0 7556 34152 371708 gvfs-afc-volume
2078 1943 carzanig 19 0.0 832 316 4628 sh
2081 2078 carzanig 19 0.1 31788 29896 482720 gtk-window-deco
2082 1447 carzanig 19 0.0 4924 25588 268764 gvfs-mtp-volume
2093 1447 carzanig 19 0.6 8260 35204 354776 ibus-daemon
2102 2093 carzanig 19 0.0 6620 25700 273696 ibus-dconf
2104 1447 carzanig 19 0.3 16864 19008 334976 ibus-x11
2115 1447 carzanig 19 0.0 5984 25704 271584 ibus-portal
2159 1735 carzanig 19 0.0 5868 25956 271936 gsd-disk-utilit
2168 1735 carzanig 19 0.0 51420 60824 638708 blueman-applet
2181 1735 carzanig 19 0.0 16352 23828 214208 python3
2186 1735 carzanig 19 0.0 28776 46908 612284 nm-applet
2194 2093 carzanig 19 0.1 6220 17384 197780 ibus-engine-sim
2212 1447 carzanig 19 0.0 47000 67556 743776 gnome-terminal-
2220 1787 carzanig 19 0.0 7016 34116 358596 gvfsd-burn
2230 2212 carzanig 19 0.0 3696 680 21572 bash
2238 1447 carzanig 19 0.0 36248 47688 231144 gvfsd-metadata
2247 1447 carzanig 19 0.0 6948 648 82728 obexd
2262 2230 carzanig 19 0.0 3136 708 31428 screen
2263 2262 carzanig 19 0.0 14884 12704 43424 screen
2264 2263 carzanig 19 0.0 3960 680 21572 bash
2268 2264 carzanig 19 2.1 377204 391188 721460 emacs
2284 2263 carzanig 19 0.0 3936 580 21472 bash
2290 2284 carzanig 19 0.0 6868 1228 48672 slogin
2292 1504 carzanig 19 0.0 1492 392 11304 ssh-agent
2305 1735 carzanig 19 0.0 21008 44572 584664 update-notifier
2326 2263 carzanig 19 0.0 3260 580 21472 bash
2331 2264 carzanig 19 2.4 317828 378876 3743140 firefox
2371 2331 carzanig 19 0.2 222916 147396 882804 GPUProcess
2463 2331 carzanig 19 0.2 209232 242752 21726056 WebExtensions
2517 2331 carzanig 19 0.8 185976 154580 2861540 WebContent
2636 2331 carzanig 19 0.3 178576 124612 2805000 WebContent
2691 1447 carzanig 19 0.0 3624 8772 93312 gpg-agent
2792 2 root 19 0.0 0 0 0 kworker/3:0
2846 2331 carzanig 19 0.0 35108 13412 402872 RDDProcess
2869 2 root 19 0.0 0 0 0 kworker/0:0
2936 2331 carzanig 19 0.1 154380 103616 2669980 WebContent
2986 2331 carzanig 19 1.8 205724 125112 2808932 WebContent
3031 2331 carzanig 19 0.1 145748 108032 2692248 WebContent
3396 2 root 19 0.0 0 0 0 kworker/3:2
3448 2268 carzanig 19 0.0 3740 448 21340 bash
3562 1735 carzanig 19 0.1 36620 39580 597456 gnome-flashback
3906 2 root 19 0.0 0 0 0 kworker/2:1
3950 2331 carzanig 19 0.1 162084 110312 2646940 WebContent
4241 2 root 19 0.0 0 0 0 kworker/u16:5
4318 2 root 19 0.0 0 0 0 kworker/2:0
4327 2 root 19 0.0 0 0 0 kworker/u16:3
4430 2 root 19 0.0 0 0 0 kworker/0:1
4574 2 root 19 0.0 0 0 0 kworker/u16:2
4585 2331 carzanig 19 0.5 145552 97308 2641336 WebContent
4623 2331 carzanig 19 0.0 83624 50528 2564716 WebContent
4835 2 root 19 0.0 0 0 0 kworker/u16:1
4854 2 root 19 0.0 0 0 0 kworker/1:2
4888 2268 carzanig 19 3.2 11052 18824 596476 ogg123
4892 1 root 19 0.0 2660 356 15928 anacron
4898 2 root 19 0.0 0 0 0 kworker/1:0
4905 2 root 19 0.0 0 0 0 kworker/u16:0
4910 2 root 19 0.0 0 0 0 kworker/u16:4
5047 1 root 19 0.0 10432 3104 102552 cupsd
5048 1 root 19 0.0 10824 18144 303668 cups-browsed
5061 5047 lp 19 0.0 5992 772 86412 dbus
5062 5047 lp 19 0.0 6052 772 86412 dbus
5113 2264 carzanig 19 0.0 3384 1060 37364 ps

View file

@ -0,0 +1,100 @@
1 0 root 19 0.1 9164 18868 225468 systemd
2 0 root 19 0.0 0 0 0 kthreadd
4 2 root 39 0.0 0 0 0 kworker/0:0H
6 2 root 39 0.0 0 0 0 mm_percpu_wq
7 2 root 19 0.0 0 0 0 ksoftirqd/0
8 2 root 19 0.0 0 0 0 rcu_sched
9 2 root 19 0.0 0 0 0 rcu_bh
10 2 root 139 0.0 0 0 0 migration/0
11 2 root 139 0.0 0 0 0 watchdog/0
12 2 root 19 0.0 0 0 0 cpuhp/0
13 2 root 19 0.0 0 0 0 cpuhp/1
14 2 root 139 0.0 0 0 0 watchdog/1
15 2 root 139 0.0 0 0 0 migration/1
16 2 root 19 0.0 0 0 0 ksoftirqd/1
18 2 root 39 0.0 0 0 0 kworker/1:0H
19 2 root 19 0.0 0 0 0 cpuhp/2
20 2 root 139 0.0 0 0 0 watchdog/2
21 2 root 139 0.0 0 0 0 migration/2
22 2 root 19 0.0 0 0 0 ksoftirqd/2
24 2 root 39 0.0 0 0 0 kworker/2:0H
25 2 root 19 0.0 0 0 0 cpuhp/3
26 2 root 139 0.0 0 0 0 watchdog/3
27 2 root 139 0.0 0 0 0 migration/3
28 2 root 19 0.0 0 0 0 ksoftirqd/3
30 2 root 39 0.0 0 0 0 kworker/3:0H
31 2 root 19 0.0 0 0 0 kdevtmpfs
32 2 root 39 0.0 0 0 0 netns
33 2 root 19 0.0 0 0 0 rcu_tasks_kthre
34 2 root 19 0.0 0 0 0 kauditd
37 2 root 19 0.0 0 0 0 khungtaskd
38 2 root 19 0.0 0 0 0 oom_reaper
39 2 root 39 0.0 0 0 0 writeback
40 2 root 19 0.0 0 0 0 kcompactd0
41 2 root 14 0.0 0 0 0 ksmd
42 2 root 0 0.0 0 0 0 khugepaged
43 2 root 39 0.0 0 0 0 crypto
44 2 root 39 0.0 0 0 0 kintegrityd
45 2 root 39 0.0 0 0 0 kblockd
46 2 root 39 0.0 0 0 0 ata_sff
47 2 root 39 0.0 0 0 0 md
48 2 root 39 0.0 0 0 0 edac-poller
49 2 root 39 0.0 0 0 0 devfreq_wq
50 2 root 39 0.0 0 0 0 watchdogd
52 2 root 19 0.0 0 0 0 kworker/1:1
55 2 root 19 0.0 0 0 0 kswapd0
57 2 root 19 0.0 0 0 0 ecryptfs-kthrea
99 2 root 39 0.0 0 0 0 kthrotld
100 2 root 39 0.0 0 0 0 acpi_thermal_pm
105 2 root 39 0.0 0 0 0 ipv6_addrconf
115 2 root 39 0.0 0 0 0 kstrp
132 2 root 39 0.0 0 0 0 charger_manager
194 2 root 19 0.0 0 0 0 scsi_eh_0
195 2 root 39 0.0 0 0 0 scsi_tmf_0
196 2 root 19 0.0 0 0 0 scsi_eh_1
197 2 root 39 0.0 0 0 0 scsi_tmf_1
198 2 root 19 0.0 0 0 0 scsi_eh_2
199 2 root 39 0.0 0 0 0 scsi_tmf_2
200 2 root 90 0.0 0 0 0 irq/16-mmc0
201 2 root 19 0.0 0 0 0 scsi_eh_3
202 2 root 39 0.0 0 0 0 scsi_tmf_3
203 2 root 19 0.0 0 0 0 scsi_eh_4
204 2 root 39 0.0 0 0 0 scsi_tmf_4
205 2 root 19 0.0 0 0 0 scsi_eh_5
206 2 root 39 0.0 0 0 0 scsi_tmf_5
240 2 root 41 0.0 0 0 0 i915/signal:0
241 2 root 41 0.0 0 0 0 i915/signal:1
242 2 root 41 0.0 0 0 0 i915/signal:2
249 2 root 39 0.0 0 0 0 kworker/3:1H
296 2 root 39 0.0 0 0 0 kworker/0:1H
305 2 root 39 0.0 0 0 0 kdmflush
307 2 root 39 0.0 0 0 0 bioset
308 2 root 39 0.0 0 0 0 kcryptd_io
310 2 root 39 0.0 0 0 0 kcryptd
311 2 root 19 0.0 0 0 0 dmcrypt_write
312 2 root 39 0.0 0 0 0 bioset
315 2 root 39 0.0 0 0 0 kworker/u17:1
316 2 root 39 0.0 0 0 0 kworker/u17:2
349 2 root 19 0.0 0 0 0 jbd2/sda1-8
350 2 root 39 0.0 0 0 0 ext4-rsv-conver
404 1 root 20 0.0 72160 17552 201844 systemd-journal
418 1 root 19 0.0 4652 1628 46320 systemd-udevd
432 2 root 39 0.0 0 0 0 loop0
445 2 root 39 0.0 0 0 0 loop1
453 2 root 39 0.0 0 0 0 loop2
475 2 root 39 0.0 0 0 0 kworker/1:1H
476 2 root 39 0.0 0 0 0 loop3
553 2 root 39 0.0 0 0 0 kworker/2:1H
576 2 root 90 0.0 0 0 0 irq/20-smo8800
635 2 root 90 0.0 0 0 0 irq/31-mei_me
669 2 root 39 0.0 0 0 0 kmemstick
678 2 root 39 0.0 0 0 0 cfg80211
688 2 root 90 0.1 0 0 0 irq/32-iwlwifi
819 1 systemd+ 19 0.0 6104 700 70748 systemd-resolve
820 1 systemd+ 19 0.0 3384 8908 146112 systemd-timesyn
915 1 root 19 0.0 9256 9168 179884 thermald
919 1 syslog 19 0.0 4696 18628 263036 rsyslogd
922 1 avahi 19 0.0 3840 676 47272 avahi-daemon
926 1 root 19 0.0 17388 16912 170784 networkd-dispat
930 1 daemon 19 0.0 2348 468 28332 atd
931 1 root 19 0.0 7200 25928 287676 accounts-daemon

View file

@ -0,0 +1,184 @@
932 1 root 19 0.0 4600 556 36480 bluetoothd
939 922 avahi 19 0.0 340 480 47076 avahi-daemon
940 1 root 19 0.0 6216 768 70664 systemd-logind
948 1 root 19 0.0 3204 468 31320 cron
951 1 root 19 0.0 11308 43920 503024 udisksd
956 1 root 19 0.0 9504 34508 434328 ModemManager
958 1 message+ 19 0.0 6668 3388 52640 dbus-daemon
998 1 root 19 0.0 19544 38568 483364 NetworkManager
999 1 root 19 0.0 7960 712 45468 wpa_supplicant
1000 1 root 19 0.0 824 312 4552 acpid
1002 1 root 19 0.0 3488 8820 110480 irqbalance
1003 1 root 19 0.0 23140 129772 1070008 snapd
1015 1 root 19 0.0 9932 28080 296220 polkitd
1025 1 dictd 19 0.0 6672 596 43292 dictd
1036 1 colord 19 0.0 14220 30076 318272 colord
1053 1 root 19 0.0 19868 16760 187232 unattended-upgr
1064 1 root 19 0.0 7856 26156 300948 gdm3
1070 1064 root 19 0.0 9280 18232 279348 gdm-session-wor
1090 1 gdm 19 0.0 8044 1100 76884 systemd
1096 1090 gdm 19 0.0 2760 2532 141308 (sd-pam)
1107 1 debian-+ 19 0.1 45196 39272 98192 tor
1108 1 root 19 0.0 7052 25344 2113988 console-kit-dae
1181 1070 gdm 19 0.0 5424 17236 190692 gdm-wayland-ses
1183 1090 gdm 19 0.0 4568 976 50228 dbus-daemon
1185 1181 gdm 19 0.0 13472 43260 552028 gnome-session-b
1196 1185 gdm 19 0.2 126180 201116 3329884 gnome-shell
1216 1 root 19 0.0 8424 34424 315340 upowerd
1266 1196 gdm 19 0.0 52928 58160 618220 Xwayland
1274 1090 gdm 19 0.0 6372 33916 349432 at-spi-bus-laun
1279 1274 gdm 19 0.0 4216 672 49924 dbus-daemon
1281 1090 gdm 19 0.0 5772 17476 220764 at-spi2-registr
1285 1090 gdm 19 0.0 11892 19552 1408664 pulseaudio
1286 1 rtkit 18 0.0 2896 17112 183504 rtkit-daemon
1301 1196 gdm 19 0.0 7900 42812 427988 ibus-daemon
1304 1301 gdm 19 0.0 5732 25704 273640 ibus-dconf
1307 1 gdm 19 0.0 28640 31840 480164 ibus-x11
1309 1090 gdm 19 0.0 5980 25572 271452 ibus-portal
1323 1 root 19 0.0 6844 25808 289764 boltd
1324 1 root 19 0.0 13580 26472 366580 packagekitd
1325 1185 gdm 19 0.0 31676 49072 632684 gsd-xsettings
1327 1185 gdm 19 0.0 5884 25700 271208 gsd-a11y-settin
1329 1185 gdm 19 0.0 28276 31848 479788 gsd-clipboard
1332 1185 gdm 19 0.0 30696 65496 804504 gsd-color
1338 1185 gdm 19 0.0 13772 18100 386604 gsd-datetime
1339 1185 gdm 19 0.0 5484 25588 276636 gsd-housekeepin
1340 1185 gdm 19 0.0 28928 48836 634384 gsd-keyboard
1347 1185 gdm 19 0.0 30964 73804 1142000 gsd-media-keys
1348 1185 gdm 19 0.0 4536 17240 194892 gsd-mouse
1349 1185 gdm 19 0.0 30504 48788 926224 gsd-power
1352 1185 gdm 19 0.0 8672 17608 259900 gsd-print-notif
1353 1185 gdm 19 0.0 4628 17240 194912 gsd-rfkill
1354 1185 gdm 19 0.0 4656 25564 268628 gsd-screensaver
1358 1185 gdm 19 0.0 8308 25820 298164 gsd-sharing
1363 1185 gdm 19 0.0 9132 34120 370988 gsd-smartcard
1366 1185 gdm 19 0.0 7984 25892 325920 gsd-sound
1368 1185 gdm 19 0.0 29052 40552 564868 gsd-wacom
1379 1301 gdm 19 0.0 6396 17380 197784 ibus-engine-sim
1431 1064 root 19 0.0 9460 18308 285572 gdm-session-wor
1447 1 carzanig 19 0.0 8400 1428 77212 systemd
1450 2 root 39 0.0 0 0 0 iprt-VBoxWQueue
1451 1447 carzanig 19 0.0 2860 2676 141452 (sd-pam)
1456 2 root 19 0.0 0 0 0 iprt-VBoxTscThr
1504 1 carzanig 19 0.0 8592 67720 650080 gnome-keyring-d
1507 998 root 19 0.0 6252 1304 25992 dhclient
1516 1431 carzanig 19 0.0 5888 17288 205024 gdm-x-session
1518 1516 root 19 2.2 131164 29704 610272 Xorg
1524 1447 carzanig 19 0.0 5380 1840 51092 dbus-daemon
1533 1516 carzanig 19 0.0 920 316 4628 run-systemd-ses
1616 1533 carzanig 19 0.0 320 392 11304 ssh-agent
1698 1533 carzanig 19 0.0 5776 532 64920 systemctl
1710 1447 carzanig 19 0.0 11532 35148 938468 indicator-sound
1711 1447 carzanig 19 0.0 7448 59828 836672 indicator-sessi
1712 1447 carzanig 19 0.0 7960 34776 366732 indicator-messa
1713 1447 carzanig 19 0.0 28264 38736 594244 indicator-print
1714 1447 carzanig 19 0.0 38996 66700 843356 indicator-keybo
1715 1447 carzanig 19 0.0 10828 26144 391392 indicator-appli
1727 1447 carzanig 19 0.0 6808 42488 424808 indicator-power
1732 1447 carzanig 19 0.0 27548 80792 1324524 indicator-datet
1735 1447 carzanig 19 0.0 14584 51952 626188 gnome-session-b
1738 1447 carzanig 19 0.0 5976 34020 340836 indicator-bluet
1750 1447 carzanig 19 0.0 21668 29116 421636 gnome-screensav
1762 1447 carzanig 19 0.0 6208 33960 349532 at-spi-bus-laun
1766 1447 carzanig 30 4.4 12440 19896 2212080 pulseaudio
1770 1762 carzanig 19 0.0 4256 784 50036 dbus-daemon
1775 1447 carzanig 19 0.0 6860 17496 220784 at-spi2-registr
1787 1447 carzanig 19 0.0 7064 25788 284860 gvfsd
1790 1447 carzanig 19 0.0 25820 62008 1234200 evolution-sourc
1802 1447 carzanig 19 0.0 5236 42636 416116 gvfsd-fuse
1824 1447 carzanig 19 0.0 31304 44068 769352 goa-daemon
1826 2 root 29 0.0 0 0 0 krfcommd
1834 1735 carzanig 19 0.0 7240 34188 357692 gsd-housekeepin
1838 1735 carzanig 19 0.0 19744 36264 497944 gsd-keyboard
1839 1735 carzanig 19 0.0 21512 61208 1005540 gsd-media-keys
1841 1735 carzanig 19 0.0 5828 25700 271268 gsd-mouse
1843 1447 carzanig 19 0.0 67528 88500 885212 evolution-calen
1847 1735 carzanig 19 0.0 23424 45660 863440 gsd-power
1852 1735 carzanig 19 0.0 10164 26116 342224 gsd-print-notif
1853 1735 carzanig 19 0.0 5760 42344 416240 gsd-rfkill
1858 1735 carzanig 19 0.0 11384 44680 446868 gsd-sharing
1860 1735 carzanig 19 0.0 7964 42440 444772 gsd-smartcard
1862 1735 carzanig 19 0.0 4736 25564 268628 gsd-screensaver
1876 1447 carzanig 19 0.0 7428 25712 296252 goa-identity-se
1891 1735 carzanig 19 0.0 8140 25880 325964 gsd-sound
1892 1735 carzanig 19 0.0 19580 28884 419616 gsd-wacom
1895 1735 carzanig 19 0.0 22576 36628 488008 gsd-xsettings
1897 1735 carzanig 19 0.0 5980 25700 271264 gsd-a11y-settin
1898 1735 carzanig 19 0.0 17076 19160 334744 gsd-clipboard
1901 1735 carzanig 19 0.0 23068 63076 873916 gsd-color
1906 1735 carzanig 19 0.0 13728 26428 462848 gsd-datetime
1943 1735 carzanig 19 0.7 44420 66644 639552 compiz
1949 1447 carzanig 19 0.0 12712 34592 501652 gsd-printer
1956 1843 carzanig 19 0.0 70900 154496 1281016 evolution-calen
1961 1735 carzanig 19 0.0 46692 51596 809560 gnome-panel
1967 1447 carzanig 19 0.0 6052 18168 188708 dconf-service
1978 1447 carzanig 19 0.0 24436 52372 725792 evolution-addre
1994 1978 carzanig 19 0.0 27236 86028 1010240 evolution-addre
2043 1735 carzanig 19 0.0 116608 88548 1619804 nautilus-deskto
2057 1787 carzanig 19 0.0 6908 34248 360996 gvfsd-trash
2061 1447 carzanig 19 0.0 8464 26312 299328 gvfs-udisks2-vo
2066 1447 carzanig 19 0.0 6600 26132 281684 gvfs-gphoto2-vo
2071 1447 carzanig 19 0.0 5964 25696 266940 gvfs-goa-volume
2075 1447 carzanig 19 0.0 7556 34152 371708 gvfs-afc-volume
2078 1943 carzanig 19 0.0 832 316 4628 sh
2081 2078 carzanig 19 0.1 31788 29896 482720 gtk-window-deco
2082 1447 carzanig 19 0.0 4924 25588 268764 gvfs-mtp-volume
2093 1447 carzanig 19 0.6 8260 35204 354776 ibus-daemon
2102 2093 carzanig 19 0.0 6620 25700 273696 ibus-dconf
2104 1447 carzanig 19 0.3 16864 19008 334976 ibus-x11
2115 1447 carzanig 19 0.0 5984 25704 271584 ibus-portal
2159 1735 carzanig 19 0.0 5868 25956 271936 gsd-disk-utilit
2168 1735 carzanig 19 0.0 51420 60824 638708 blueman-applet
2181 1735 carzanig 19 0.0 16352 23828 214208 python3
2186 1735 carzanig 19 0.0 28776 46908 612284 nm-applet
2194 2093 carzanig 19 0.1 6220 17384 197780 ibus-engine-sim
2212 1447 carzanig 19 0.0 47000 67556 743776 gnome-terminal-
2220 1787 carzanig 19 0.0 7016 34116 358596 gvfsd-burn
2230 2212 carzanig 19 0.0 3696 680 21572 bash
2238 1447 carzanig 19 0.0 36248 47688 231144 gvfsd-metadata
2247 1447 carzanig 19 0.0 6948 648 82728 obexd
2262 2230 carzanig 19 0.0 3136 708 31428 screen
2263 2262 carzanig 19 0.0 14884 12704 43424 screen
2264 2263 carzanig 19 0.0 3960 680 21572 bash
2268 2264 carzanig 19 2.1 377204 391188 721460 emacs
2284 2263 carzanig 19 0.0 3936 580 21472 bash
2290 2284 carzanig 19 0.0 6868 1228 48672 slogin
2292 1504 carzanig 19 0.0 1492 392 11304 ssh-agent
2305 1735 carzanig 19 0.0 21008 44572 584664 update-notifier
2326 2263 carzanig 19 0.0 3260 580 21472 bash
2331 2264 carzanig 19 2.4 317828 378876 3743140 firefox
2371 2331 carzanig 19 0.2 222916 147396 882804 GPUProcess
2463 2331 carzanig 19 0.2 209232 242752 21726056 WebExtensions
2517 2331 carzanig 19 0.8 185976 154580 2861540 WebContent
2636 2331 carzanig 19 0.3 178576 124612 2805000 WebContent
2691 1447 carzanig 19 0.0 3624 8772 93312 gpg-agent
2792 2 root 19 0.0 0 0 0 kworker/3:0
2846 2331 carzanig 19 0.0 35108 13412 402872 RDDProcess
2869 2 root 19 0.0 0 0 0 kworker/0:0
2936 2331 carzanig 19 0.1 154380 103616 2669980 WebContent
2986 2331 carzanig 19 1.8 205724 125112 2808932 WebContent
3031 2331 carzanig 19 0.1 145748 108032 2692248 WebContent
3396 2 root 19 0.0 0 0 0 kworker/3:2
3448 2268 carzanig 19 0.0 3740 448 21340 bash
3562 1735 carzanig 19 0.1 36620 39580 597456 gnome-flashback
3906 2 root 19 0.0 0 0 0 kworker/2:1
3950 2331 carzanig 19 0.1 162084 110312 2646940 WebContent
4241 2 root 19 0.0 0 0 0 kworker/u16:5
4318 2 root 19 0.0 0 0 0 kworker/2:0
4327 2 root 19 0.0 0 0 0 kworker/u16:3
4430 2 root 19 0.0 0 0 0 kworker/0:1
4574 2 root 19 0.0 0 0 0 kworker/u16:2
4585 2331 carzanig 19 0.5 145552 97308 2641336 WebContent
4623 2331 carzanig 19 0.0 83624 50528 2564716 WebContent
4835 2 root 19 0.0 0 0 0 kworker/u16:1
4854 2 root 19 0.0 0 0 0 kworker/1:2
4888 2268 carzanig 19 3.2 11052 18824 596476 ogg123
4892 1 root 19 0.0 2660 356 15928 anacron
4898 2 root 19 0.0 0 0 0 kworker/1:0
4905 2 root 19 0.0 0 0 0 kworker/u16:0
4910 2 root 19 0.0 0 0 0 kworker/u16:4
5047 1 root 19 0.0 10432 3104 102552 cupsd
5048 1 root 19 0.0 10824 18144 303668 cups-browsed
5061 5047 lp 19 0.0 5992 772 86412 dbus
5062 5047 lp 19 0.0 6052 772 86412 dbus
5113 2264 carzanig 19 0.0 3384 1060 37364 ps

View file

@ -0,0 +1,10 @@
#include <assert.h>
#include "../processes.h"
int main() {
struct processes * p = new_processes();
assert(p);
delete(p);
return 0;
}

View file

@ -0,0 +1,12 @@
#include <assert.h>
#include "../processes.h"
int main() {
struct processes * p = new_processes();
assert(p);
assert(add_from_file(p, "tests/proc.txt"));
clear(p);
delete(p);
return 0;
}

View file

@ -0,0 +1,72 @@
#include <assert.h>
#include "basic_testing.h"
#include "../processes.h"
int main() {
struct processes * p1 = new_processes();
assert(p1);
assert(add_from_file(p1, "tests/proc.txt"));
struct query q;
q.priority = 0;
q.rss = 0;
q.size = 0;
q.vsize = 0;
q.cpu_usage = 0;
struct query_result * r1;
struct query_result * r2;
int count = 0;
for (r1 = search(p1, &q); r1 != 0; r1 = next(r1))
count += 1;
assert_int_equal(count, 284);
struct processes * p2 = new_processes();
assert(p2);
assert(add_from_file(p2, "tests/proc1.txt"));
assert(add_from_file(p2, "tests/proc2.txt"));
r1 = search(p1, &q);
r2 = search(p2, &q);
count = 0;
while (r1 && r2) {
assert(get_pid(r1) == get_pid(r2));
assert(get_ppid(r1) == get_ppid(r2));
assert(strcmp(get_user(r1), get_user(r2)) == 0);
assert(get_priority(r1) == get_priority(r2));
assert(get_cpu_usage(r1) == get_cpu_usage(r2));
assert(get_rss(r1) == get_rss(r2));
assert(get_size(r1) == get_size(r2));
assert(get_vsize(r1) == get_vsize(r2));
assert(strcmp(get_command(r1), get_command(r2)) == 0);
r1 = next(r1);
r2 = next(r2);
}
assert(!r1);
assert(!r2);
clear(p1);
assert(search(p1, &q) == 0);
count = 0;
for (r2 = search(p2, &q); r2 != 0; r2 = next(r2))
count += 1;
assert_int_equal(count, 284);
clear(p2);
assert(search(p2, &q) == 0);
delete(p1);
delete(p2);
return 0;
}

View file

@ -0,0 +1,49 @@
#include <assert.h>
#include "basic_testing.h"
#include "../processes.h"
int main() {
struct processes * p1 = new_processes();
assert(p1);
assert(add_from_file(p1, "tests/proc.txt"));
struct query q;
q.priority = 139;
q.rss = 0;
q.size = 0;
q.vsize = 0;
q.cpu_usage = 0;
struct query_result * r1;
struct query_result * r2;
int count = 0;
for (r1 = search(p1, &q); r1 != 0; r1 = next(r1))
count += 1;
assert_int_equal(count, 8);
r1 = search(p1, &q);
q.priority = 19;
r2 = search(p1, &q);
count = 0;
for (; r1 != 0; r1 = next(r1))
count += 1;
assert_int_equal(count, 8);
count = 0;
for (; r2 != 0; r2 = next(r2))
count += 1;
assert_int_equal(count, 218);
delete(p1);
return 0;
}

View file

@ -0,0 +1,52 @@
#include <assert.h>
#include <string.h>
#include "basic_testing.h"
#include "../processes.h"
int main() {
struct processes * p1 = new_processes();
assert(p1);
assert(add_from_file(p1, "tests/proc.txt"));
struct query q;
q.priority = 139;
q.rss = 0;
q.size = 0;
q.vsize = 0;
q.cpu_usage = 0;
struct query_result * r1;
assert((r1 = search(p1, &q)));
assert(strcmp(get_command(r1), "migration/0")==0);
assert((r1 = next(r1)));
assert(strcmp(get_command(r1), "watchdog/0")==0);
assert((r1 = next(r1)));
assert(strcmp(get_command(r1), "watchdog/1")==0);
assert((r1 = next(r1)));
assert(strcmp(get_command(r1), "migration/1")==0);
assert((r1 = next(r1)));
assert(strcmp(get_command(r1), "watchdog/2")==0);
assert((r1 = next(r1)));
assert(strcmp(get_command(r1), "migration/2")==0);
assert((r1 = next(r1)));
assert(strcmp(get_command(r1), "watchdog/3")==0);
assert((r1 = next(r1)));
assert(strcmp(get_command(r1), "migration/3")==0);
assert(!(r1 = next(r1)));
q.vsize = 1;
assert(!(r1 = search(p1, &q)));
q.vsize = -1;
assert(!(r1 = search(p1, &q)));
delete(p1);
return 0;
}

View file

@ -0,0 +1,52 @@
#include <assert.h>
#include <string.h>
#include "basic_testing.h"
#include "../processes.h"
int main() {
struct processes * p1 = new_processes();
assert(p1);
assert(add_from_file(p1, "tests/proc.txt"));
struct query q;
q.priority = 19;
q.rss = -1;
q.size = 0;
q.vsize = 0;
q.cpu_usage = 0;
struct query_result * r1;
assert((r1 = search(p1, &q)));
assert(strcmp(get_user(r1), "root") == 0);
assert((r1 = next(r1)));
assert(strcmp(get_user(r1), "root") == 0);
assert((r1 = next(r1)));
assert(strcmp(get_user(r1), "systemd+") == 0);
assert((r1 = next(r1)));
assert(strcmp(get_user(r1), "systemd+") == 0);
assert((r1 = next(r1)));
terminate_query(r1);
q.priority = 19;
q.rss = 0;
q.size = 0;
q.vsize = -2000000;
q.cpu_usage = -1.0;
assert((r1 = search(p1, &q)));
assert(get_pid(r1) == 2331);
assert(strcmp(get_command(r1), "firefox") == 0);
assert((r1 = next(r1)));
assert(get_pid(r1) == 2986);
assert(strcmp(get_command(r1), "WebContent") == 0);
assert(!(r1 = next(r1)));
delete(p1);
return 0;
}