Lines Matching refs:sem_ptr

138 	sysvsem_sem *sem_ptr = (sysvsem_sem *)rsrc->ptr;  local
146 if (sem_ptr->count == -1 || !sem_ptr->auto_release) {
147 efree(sem_ptr);
158 if (sem_ptr->count) {
161 sop[1].sem_op = sem_ptr->count;
167 semop(sem_ptr->semid, sop, opcount);
168 efree(sem_ptr);
195 sysvsem_sem *sem_ptr; in PHP_FUNCTION() local
287 sem_ptr = (sysvsem_sem *) emalloc(sizeof(sysvsem_sem)); in PHP_FUNCTION()
288 sem_ptr->key = key; in PHP_FUNCTION()
289 sem_ptr->semid = semid; in PHP_FUNCTION()
290 sem_ptr->count = 0; in PHP_FUNCTION()
291 sem_ptr->auto_release = auto_release; in PHP_FUNCTION()
293 RETVAL_RES(zend_register_resource(sem_ptr, php_sysvsem_module.le_sem)); in PHP_FUNCTION()
294 sem_ptr->id = Z_RES_HANDLE_P(return_value); in PHP_FUNCTION()
304 sysvsem_sem *sem_ptr; in php_sysvsem_semop() local
317 …if ((sem_ptr = (sysvsem_sem *)zend_fetch_resource(Z_RES_P(arg_id), "SysV semaphore", php_sysvsem_m… in php_sysvsem_semop()
321 if (!acquire && sem_ptr->count == 0) { in php_sysvsem_semop()
322 …semaphore " ZEND_LONG_FMT " (key 0x%x) is not currently acquired", Z_LVAL_P(arg_id), sem_ptr->key); in php_sysvsem_semop()
330 while (semop(sem_ptr->semid, &sop, 1) == -1) { in php_sysvsem_semop()
333 …E_WARNING, "failed to %s key 0x%x: %s", acquire ? "acquire" : "release", sem_ptr->key, strerror(er… in php_sysvsem_semop()
339 sem_ptr->count -= acquire ? -1 : 1; in php_sysvsem_semop()
371 sysvsem_sem *sem_ptr; local
381 …if ((sem_ptr = (sysvsem_sem *)zend_fetch_resource(Z_RES_P(arg_id), "SysV semaphore", php_sysvsem_m…
387 if (semctl(sem_ptr->semid, 0, IPC_STAT, un) < 0) {
389 if (semctl(sem_ptr->semid, 0, IPC_STAT, NULL) < 0) {
396 if (semctl(sem_ptr->semid, 0, IPC_RMID, un) < 0) {
398 if (semctl(sem_ptr->semid, 0, IPC_RMID, NULL) < 0) {
408 sem_ptr->count = -1;