All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: Linux Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: how to handle devpts
Date: Mon, 30 Nov 2009 14:22:23 -0600	[thread overview]
Message-ID: <20091130202223.GA20224@us.ibm.com> (raw)

We currently checkpoint and restart unix98 ptys in the kernel.
So what do we want to do about the userspace part?  In particular,
if I run the following test program and checkpoint it, it
has `tty` open.  What do we want to do about that?

Just having user-cr/restart.c take an option to mount a new
instance of devpts isn't enough - we don't get hooked up to
restart.c's stdin/out obviously, and restart succeeds but the
restarted program exists with -EIO.  At the same time, just
doing a cradvise type of thing to plug fds 0,1,2 suffice for
this testcase, but not for something more complicated which
also has other unix98 ptys open.

Do we require that it be run in screen?  Then what about the
screen session's terminals themselves?

Anyway, I have this feeling that other have already thought
through this, so here is the simple program for discussion:

#include <stdio.h>
#include <curses.h>
#include <string.h>

int main(int argc, char *argv[])
{
#define MAXLEN 20
	char input[MAXLEN+1];
	int i = 0;

	initscr();
	cbreak();
	//noecho();
	nonl();
	intrflush(stdscr, FALSE);
	keypad(stdscr, TRUE);

	addstr("Enter some text: ");
	memset(input, 0, MAXLEN+1);
	while (1) {
		input[i] = getch();
		if (input[i] == KEY_ENTER || input[i]=='\r')
			break;
		i++;
		if (i == MAXLEN)
			break;
	}
	endwin();
	printf("I read the text: %s\n", input);
	return 0;
}

-serge

             reply	other threads:[~2009-11-30 20:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30 20:22 Serge E. Hallyn [this message]
     [not found] ` <20091130202223.GA20224-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-12-01  9:37   ` how to handle devpts Louis Rilling
     [not found]     ` <20091201093708.GC2430-Hu8+6S1rdjywhHL9vcZdMVaTQe2KTcn/@public.gmane.org>
2009-12-01 15:02       ` Serge E. Hallyn

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=20091130202223.GA20224@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=orenl-eQaUEPhvms7ENvBUuze7eA@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.