openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/util-linux/2.33.2-r0/util-linux-2.33.2/misc-utils/uuidd.c
static int create_pidfile(struct uuidd_cxt_t* cxt, const char* pidfile_path)
{
    int fd_pidfile;
    struct flock fl;

    fd_pidfile = open(pidfile_path, O_CREAT | O_RDWR, 0664);
    if (fd_pidfile < 0)
    {
        if (!cxt->quiet)
            warn(_("cannot open %s"), pidfile_path);
        exit(EXIT_FAILURE);
    }
    cxt->cleanup_pidfile = pidfile_path;

    fl.l_type = F_WRLCK;
    fl.l_whence = SEEK_SET;
    fl.l_start = 0;
    fl.l_len = 0;
    fl.l_pid = 0;
    while (fcntl(fd_pidfile, F_SETLKW, &fl) < 0)
    {
        if ((errno == EAGAIN) || (errno == EINTR))
            continue;
        if (!cxt->quiet)
            warn(_("cannot lock %s"), pidfile_path);
        exit(EXIT_FAILURE);
    }

    return fd_pidfile;
}
/*
 * Exclusively create and open a pid file with path @pidfile_path
 *
 * Return file descriptor of the created pid_file.
 */
Exclusively create and open a pid file with path @pidfile_path
Return file descriptor of the created pid_file.
Exclusively create and open a pid file with path @pidfile_path Return file descriptor of the created pid_file .
static int create_pidfile(struct uuidd_cxt_t* cxt, const char* pidfile_path)
{
    int fd_pidfile;
    struct flock fl;
    fd_pidfile = open(pidfile_path, O_CREAT | O_RDWR, 0664);
    if (fd_pidfile < 0)
    {
        if (!cxt->quiet)
            warn(_("cannot open %s"), pidfile_path);
        exit(EXIT_FAILURE);
    }
    cxt->cleanup_pidfile = pidfile_path;
    fl.l_type = F_WRLCK;
    fl.l_whence = SEEK_SET;
    fl.l_start = 0;
    fl.l_len = 0;
    fl.l_pid = 0;
    while (fcntl(fd_pidfile, F_SETLKW, &fl) < 0)
    {
        if ((errno == EAGAIN) || (errno == EINTR))
            continue;
        if (!cxt->quiet)
            warn(_("cannot lock %s"), pidfile_path);
        exit(EXIT_FAILURE);
    }
    return fd_pidfile;
}
static int create_pidfile ( struct uuidd_cxt_t * cxt , const char * pidfile_path ) { int fd_pidfile ; struct flock fl ; fd_pidfile = open ( pidfile_path , O_CREAT | O_RDWR , 0664 ) ; if ( fd_pidfile < 0 ) { if ( ! cxt -> quiet ) warn ( _ ( " " ) , pidfile_path ) ; exit ( EXIT_FAILURE ) ; } cxt -> cleanup_pidfile = pidfile_path ; fl . l_type = F_WRLCK ; fl . l_whence = SEEK_SET ; fl . l_start = 0 ; fl . l_len = 0 ; fl . l_pid = 0 ; while ( fcntl ( fd_pidfile , F_SETLKW , & fl ) < 0 ) { if ( ( errno == EAGAIN ) || ( errno == EINTR ) ) continue ; if ( ! cxt -> quiet ) warn ( _ ( " " ) , pidfile_path ) ; exit ( EXIT_FAILURE ) ; } return fd_pidfile ; }
Exclusively create and open a pid file with path @pidfile_path
 Return file descriptor of the created pid_file.
Exclusively create and open a pid file with path @pidfile_path Return file descriptor of the created pid_file .