Bug#848682: Process accounting: Using the NETLINK interface, the command TASKSTATS_CMD_GET returns -EINVAL
Dear Ben, dear maintainers,
I reported the second issue as:
Bug#848683: Process accounting: Using the NETLINK inface, the command
TASKSTATS_CMD_GET returns -EINVAL
https://bugs.debian.org/848683
I forgot to attach the test program from Gerlof. I attach it now.
Thanks,
--
Martin Steigerwald | Trainer
teamix GmbH
Südwestpark 43
90449 Nürnberg
Tel.: +49 911 30999 55 | Fax: +49 911 30999 99
mail: martin.steigerwald@teamix.de | web: http://www.teamix.de | blog: http://blog.teamix.de
Amtsgericht Nürnberg, HRB 18320 | Geschäftsführer: Oliver Kügow, Richard Müller
teamix Support Hotline: +49 911 30999-112
*** Bitte liken Sie uns auf Facebook: facebook.com/teamix ***
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#define ACCTFILE "/tmp/mypacct"
main()
{
int fd;
char buf[1024];
if ( (fd = open(ACCTFILE, O_RDWR|O_CREAT|O_TRUNC, 0777)) == -1)
{
perror("Open " ACCTFILE);
exit(1);
}
if (acct(ACCTFILE) == -1)
{
perror("Switch on accounting");
exit(1);
}
if ( fork() == 0 ) // fork new process
exit(0); // child process: finish
// parent process:
// wait for child to finish
wait((int *)0);
// read the process accounting record of the finished child
while (read(fd, buf, sizeof buf) == 0)
{
printf("No process accounting record yet....\n");
sleep(1);
}
printf("Yeeeeah, found a process accounting record!\n");
}
Reply to: