| iMatix home page
| << | < | > | >>
SMT Logo SMT
Version 2.81

 

lazy_creat

#include "smtlib.h"
int
lazy_creat (char *path, int mode)

Synopsis

Calls the standard creat() function without blocking. (Actually, calls the open() function, but with the O_CREAT flag.) Returns a file handle when the call succeeds, else returns -1 and sets errno to the cause of the error. The file is always opened in binary mode, and you must process control characters yourself. We use open() so that we can force O_NONBLOCK. If the call would block, returns -1, sets errno to EAGAIN, and calls recycle module() to re-execute the current dialog module automatically. You can override this behavious by calling recycle module (FALSE) after the return. Sets the global variable "io_completed" to TRUE if the i/o access completed, with or without an error.

Source Code - (smtlib.c)

{
    int rc;

#if (defined (SMT_TRACE))
    trace ("lazy_create: path=%s", path);
#endif
    rc = open (path, O_CREAT | O_WRONLY | O_TRUNC | O_NONBLOCK | O_BINARY,
               mode);

    set_io_completed (rc);
    return (rc);
}

| << | < | > | >> iMatix Copyright © 1996-99 iMatix Corporation