All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH] cr_tests: Add two testcases for epoll checkpoint/restart.
Date: Mon, 31 Aug 2009 10:24:44 -0500	[thread overview]
Message-ID: <20090831152443.GA9673@us.ibm.com> (raw)
In-Reply-To: <1250744745-1360-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

Quoting Matt Helsley (matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org):
...
> diff --git a/epoll/Makefile b/epoll/Makefile
> new file mode 100644
> index 0000000..e1e3351
> --- /dev/null
> +++ b/epoll/Makefile
> @@ -0,0 +1,21 @@
> +.PHONY: clean all
> +
> +LIBS := ../libcrtest/libcrtest.a
> +CFLAGS := -Wall $(ARCHOPTS) -I./libfutex -I../ -I../libcrtest

libfutex?

You also mention futexes in several places where i think you mean
epoll.

> diff --git a/epoll/empty.c b/epoll/empty.c
> new file mode 100644
> index 0000000..c8c2109
> --- /dev/null
> +++ b/epoll/empty.c
> @@ -0,0 +1,83 @@
> +/*
> + * Make sure epoll sets stay empty across c/r.
> + *
> + * epoll create
> + * checkpoint
> + * close epoll
> + */
> +/* pretty standard stuff really */
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <errno.h>
> +#include <unistd.h>
> +#include <string.h>
> +
> +/* open() */
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <fcntl.h>
> +
> +/* waitpid() and W* status macros */
> +#include <sys/wait.h>
> +
> +/* epoll syscalls */
> +#include <sys/epoll.h>
> +
> +#include "libcrtest/libcrtest.h"
> +
> +#define LOG_FILE	"log.empty"
> +FILE *logfp = NULL;
> +
> +/*
> + * Log output with a tag (INFO, WARN, FAIL, PASS) and a format.
> + * Adds information about the thread originating the message.
> + *
> + * Flush the log after every write to make sure we get consistent, and
> + * complete logs.
> + */
> +#define log(tag, fmt, ...) \
> +do { \
> +	pid_t __tid = getpid(); \

gettid()?

> +	fprintf(logfp, ("%s: thread %d: " fmt), (tag), __tid, ##__VA_ARGS__ ); \
> +	fflush(logfp); \
> +	fsync(fileno(logfp)); \
> +} while(0)
> +
> +/* like perror() except to the log */
> +#define log_error(s) log("FAIL", "%s: %s\n", (s), strerror(errno))
> +
> +int main (int argc, char **argv)
> +{
> +	int efd;
> +
> +	/* FIXME eventually stdio streams should be harmless */
> +	close(0);
> +	logfp = fopen(LOG_FILE, "w");
> +	if (!logfp) {
> +		perror("could not open logfile");
> +		exit(1);
> +	}
> +	dup2(fileno(logfp), 1); /* redirect stdout and stderr to the log file */
> +	dup2(fileno(logfp), 2);

Hmm?  Does dup2 automatically close first?  Manpage suggests not,
so shouldn't you do so?

No other comments...  will wait to apply until the updated kernel
patches hit the list - and the tree.

thanks,
-serge

      parent reply	other threads:[~2009-08-31 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-20  5:05 [PATCH] cr_tests: Add two testcases for epoll checkpoint/restart Matt Helsley
     [not found] ` <1250744745-1360-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-08-31 15:24   ` Serge E. Hallyn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090831152443.GA9673@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.