[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] C rutine til exec + pipe til og fra



> EBADF: Kan opstå ved en programmeringsfejl, fx hvis man glemmer at tjekke
> returværdien af open, pipe, dup el. lign., eller hvis man kommer til at
> close() en fil to gange. Her hjælper det ikke noget at forværre den fejl
> ved at dø i et uendeligt loop.

Jo, så opdager man meget hurtigt at man har glemt at
> tjekke returværdien af open, pipe, dup el. lign.
eller
> close() en fil to gange
Kan du vise, at en sådan situation kan opstå i programmet?
 
> EIO: Kan opstå hvis man løber tør for diskplads, fx på et RAM-baseret
> /tmp filsystem.
Denne situation tror jeg ikke opstår med pipe's. See nedenstående uddrag
fra pipe.c i linux kernen. Så vidt jeg har hørt har pipes normalt en preallokeret
(ved pipe()) buffer til rådighed i de fleste UNIX OS'er.

> to [EIO]; if this error is returned, the state of fildes is unspecified.",
> så det er sandsynligt at man lander i et EBADF loop her.
God pointe, se dog ovenstående.

Så min holdning er, at en kamikaze løsning er legitimt, da en
fejl vil være af en charakter, der ikke tillader en systematisk
udvej af miseren.

Hans-Christian Stadler

-----------------------------------------------------------
static int
pipe_release(struct inode *inode, int decr, int decw)
{
        down(PIPE_SEM(*inode));
        PIPE_READERS(*inode) -= decr;
        PIPE_WRITERS(*inode) -= decw;
        if (!PIPE_READERS(*inode) && !PIPE_WRITERS(*inode)) {
                struct pipe_inode_info *info = inode->i_pipe;
                inode->i_pipe = NULL;
                free_page((unsigned long) info->base);
                kfree(info);
        } else {
                wake_up_interruptible(PIPE_WAIT(*inode));
        }
        up(PIPE_SEM(*inode));

        return 0;
}



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *