[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] patch:MiNT:single-task



Comments in-line...

Alan.

On Wed, 2010-06-02 at 12:16 +0000, Helmut Karlowski wrote:
> Sorry: that was the wrong file - should have been this
> 
> ----------------------------------------------------
> add support for single-task-mode for XaAES
> ----------------------------------------------------
> 
> 
> plain text document attachment (single-task.patch)
> --- dosfile.c	13 Jan 2010 17:13:49 -0000	1.35
> +++ dosfile.c	2 Jun 2010 11:39:51 -0000
> @@ -197,7 +197,17 @@
>  	DIR **where, **_where;
>  	long r;
> 
> -	TRACE (("Fclose: %d", fd));
> +	DEBUG (("Fclose: %d", fd));
> +
> +	/* this is for pure-debugger:
> +	 * some progs call Fclose(-1) when they exit which would
> +	 * cause pd to lose keyboard
> +	 */
> +	if( fd < 0 && (p->modeflags & M_SINGLE_TASK) )
> +	{
> +		DEBUG(("Fclose:return 0 for negative fd in singletask-mode."));
> +		return 0;
> +	}

Could PD have redirected output to file descriptor -1 ?

By not closing are we risking losing some data here.

>  	r = GETFILEPTR (&p, &fd, &f);
>  	if (r) return r;
> --- k_exec.c	13 Jan 2010 17:13:49 -0000	1.44
> +++ k_exec.c	2 Jun 2010 11:39:52 -0000
> @@ -892,6 +892,15 @@
> 
>  	b = (BASEPAGE *) base->loc;
> 
> +	DEBUG(("create_process: p_flags=%lx", b->p_flags));
> +
> +	if ((b->p_flags & F_SINGLE_TASK) && (rootproc->modeflags & M_SINGLE_TASK))
> +	{
> +		DEBUG(("create_process(single-task):already in single-task-mode."));
> +		r = EPERM;
> +		goto leave;
> +	}
> +
>  	if (stack)
>  	{
>  		stack += 256 + b->p_tlen + b->p_dlen + b->p_blen;
> @@ -907,6 +916,18 @@
>  	if (!p)
>  		goto leave;
> 
> +	if (b->p_flags & F_SINGLE_TASK)
> +	{
> +		DEBUG(("create_process: setting M_SINGLE_TASK for %s", filename));
> +		p->modeflags |= M_SINGLE_TASK;
> +	}
> +	if (b->p_flags & F_DONT_STOP)
> +	{
> +		DEBUG(("create_process: setting M_DONT_STOP for %s", filename));
> +		p->modeflags |= M_DONT_STOP;
> +	}
> +	b->p_flags &= ~(F_SINGLE_TASK | F_DONT_STOP);
> +
>  	/* jr: add Pexec information to PROC struct */
>  	strncpy(p->cmdlin, b->p_cmdlin, 128);

Can you give some help on what F/M_DONT_STOP imply ?

> --- keyboard.c	23 May 2010 19:16:24 -0000	1.100
> +++ keyboard.c	2 Jun 2010 11:39:52 -0000
> @@ -915,7 +916,16 @@
>  		scanb[scanb_tail].scan = scancode;
>  		scanb_tail = tail;
>  	}
> -	if (!ikbd_to)
> +
> +	if( curproc->modeflags & M_SINGLE_TASK )
> +	{
> +# ifdef DEBUG_INFO
> +		extern short in_kernel;
> +		DEBUG(("ikbd_scan directly for '%s' head=%d p_flags=%lx slices=%d in_kernel=%x", curproc->name, scanb_head, curproc->p_mem->base->p_flags, curproc->slices, in_kernel ));
> +# endif
> +		IkbdScan( curproc, 1);
> +	}
> +	else if (!ikbd_to)
>  	{

What happens with the existing keyboard timeout routines that you need
to bypass them ?

Alan.