sprintf(portname, "event%lx", self->handlerThread); sprintf(semname, "sync%lx", self->handlerThread);
PR_snprintf(portname, sizeof(portname), "event%lx", (long unsigned) self->handlerThread); PR_snprintf(semname, sizeof(semname), "sync%lx", (long unsigned) self->handlerThread);
_pl_SetupNativeNotifier(PLEventQueue* self){#if defined(XP_MAC)#pragma unused (self)#endif#if defined(VMS)    unsigned int status;    self->idFunc = 0;    self->idFuncClosure = 0;    status = LIB$GET_EF(&self->efn);    if (!$VMS_STATUS_SUCCESS(status))        return PR_FAILURE;    PR_LOG(event_lm, PR_LOG_DEBUG,           ("$$$ Allocated event flag %d", self->efn));    return PR_SUCCESS;#elif defined(XP_UNIX) && !defined(XP_MACOSX)    int err;    int flags;    self->idFunc = 0;    self->idFuncClosure = 0;    err = pipe(self->eventPipe);    if (err != 0) {        return PR_FAILURE;    }    /* make the pipe nonblocking */    flags = fcntl(self->eventPipe[0], F_GETFL, 0);    if (flags == -1) {        goto failed;    }    err = fcntl(self->eventPipe[0], F_SETFL, flags | O_NONBLOCK);    if (err == -1) {        goto failed;    }    flags = fcntl(self->eventPipe[1], F_GETFL, 0);    if (flags == -1) {        goto failed;    }    err = fcntl(self->eventPipe[1], F_SETFL, flags | O_NONBLOCK);    if (err == -1) {        goto failed;    }    return PR_SUCCESS;failed:    close(self->eventPipe[0]);    close(self->eventPipe[1]);    return PR_FAILURE;#elif defined(XP_BEOS)    /* hook up to the nsToolkit queue, however the appshell     * isn't necessairly started, so we might have to create     * the queue ourselves     */    char portname[64];    char semname[64];    sprintf(portname, "event%lx", self->handlerThread);    sprintf(semname, "sync%lx", self->handlerThread);    if((self->eventport = find_port(portname)) < 0)    {        /* create port         */        self->eventport = create_port(500, portname);        /* We don't use the sem, but it has to be there         */        create_sem(0, semname);    }    return PR_SUCCESS;#else    return PR_SUCCESS;#endif}