Lines Matching refs:sem_ptr
137 sysvsem_sem *sem_ptr = (sysvsem_sem *)rsrc->ptr; local
145 if (sem_ptr->count == -1 || !sem_ptr->auto_release) {
146 efree(sem_ptr);
157 if (sem_ptr->count) {
160 sop[1].sem_op = sem_ptr->count;
166 semop(sem_ptr->semid, sop, opcount);
167 efree(sem_ptr);
194 sysvsem_sem *sem_ptr; in PHP_FUNCTION() local
286 sem_ptr = (sysvsem_sem *) emalloc(sizeof(sysvsem_sem)); in PHP_FUNCTION()
287 sem_ptr->key = key; in PHP_FUNCTION()
288 sem_ptr->semid = semid; in PHP_FUNCTION()
289 sem_ptr->count = 0; in PHP_FUNCTION()
290 sem_ptr->auto_release = auto_release; in PHP_FUNCTION()
292 sem_ptr->id = ZEND_REGISTER_RESOURCE(return_value, sem_ptr, php_sysvsem_module.le_sem); in PHP_FUNCTION()
301 sysvsem_sem *sem_ptr; in php_sysvsem_semop() local
308 …ZEND_FETCH_RESOURCE(sem_ptr, sysvsem_sem *, &arg_id, -1, "SysV semaphore", php_sysvsem_module.le_s… in php_sysvsem_semop()
310 if (!acquire && sem_ptr->count == 0) { in php_sysvsem_semop()
311 …ARNING, "SysV semaphore %ld (key 0x%x) is not currently acquired", Z_LVAL_P(arg_id), sem_ptr->key); in php_sysvsem_semop()
319 while (semop(sem_ptr->semid, &sop, 1) == -1) { in php_sysvsem_semop()
321 …E_WARNING, "failed to %s key 0x%x: %s", acquire ? "acquire" : "release", sem_ptr->key, strerror(er… in php_sysvsem_semop()
326 sem_ptr->count -= acquire ? -1 : 1; in php_sysvsem_semop()
358 sysvsem_sem *sem_ptr; local
368 …ZEND_FETCH_RESOURCE(sem_ptr, sysvsem_sem *, &arg_id, -1, "SysV semaphore", php_sysvsem_module.le_s…
372 if (semctl(sem_ptr->semid, 0, IPC_STAT, un) < 0) {
374 if (semctl(sem_ptr->semid, 0, IPC_STAT, NULL) < 0) {
381 if (semctl(sem_ptr->semid, 0, IPC_RMID, un) < 0) {
383 if (semctl(sem_ptr->semid, 0, IPC_RMID, NULL) < 0) {
393 sem_ptr->count = -1;