Lines Matching refs:shmop
100 PHP_MINIT(shmop),
104 PHP_MINFO(shmop),
111 ZEND_GET_MODULE(shmop) in ZEND_GET_MODULE() argument
118 struct php_shmop *shmop = (struct php_shmop *)rsrc->ptr; in ZEND_GET_MODULE() local
120 shmdt(shmop->addr); in ZEND_GET_MODULE()
121 efree(shmop); in ZEND_GET_MODULE()
127 PHP_MINIT_FUNCTION(shmop) in PHP_MINIT_FUNCTION() argument
137 PHP_MINFO_FUNCTION(shmop) in PHP_MINFO_FUNCTION() argument
150 struct php_shmop *shmop; in PHP_FUNCTION() local
164 shmop = emalloc(sizeof(struct php_shmop)); in PHP_FUNCTION()
165 memset(shmop, 0, sizeof(struct php_shmop)); in PHP_FUNCTION()
167 shmop->key = key; in PHP_FUNCTION()
168 shmop->shmflg |= mode; in PHP_FUNCTION()
173 shmop->shmatflg |= SHM_RDONLY; in PHP_FUNCTION()
176 shmop->shmflg |= IPC_CREAT; in PHP_FUNCTION()
177 shmop->size = size; in PHP_FUNCTION()
180 shmop->shmflg |= (IPC_CREAT | IPC_EXCL); in PHP_FUNCTION()
181 shmop->size = size; in PHP_FUNCTION()
194 if (shmop->shmflg & IPC_CREAT && shmop->size < 1) { in PHP_FUNCTION()
199 shmop->shmid = shmget(shmop->key, shmop->size, shmop->shmflg); in PHP_FUNCTION()
200 if (shmop->shmid == -1) { in PHP_FUNCTION()
205 if (shmctl(shmop->shmid, IPC_STAT, &shm)) { in PHP_FUNCTION()
211 shmop->addr = shmat(shmop->shmid, 0, shmop->shmatflg); in PHP_FUNCTION()
212 if (shmop->addr == (char*) -1) { in PHP_FUNCTION()
217 shmop->size = shm.shm_segsz; in PHP_FUNCTION()
219 RETURN_RES(zend_register_resource(shmop, shm_type)); in PHP_FUNCTION()
221 efree(shmop); in PHP_FUNCTION()
232 struct php_shmop *shmop; in PHP_FUNCTION() local
241 if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) { in PHP_FUNCTION()
245 if (start < 0 || start > shmop->size) { in PHP_FUNCTION()
250 if (count < 0 || start > (INT_MAX - count) || start + count > shmop->size) { in PHP_FUNCTION()
255 startaddr = shmop->addr + start; in PHP_FUNCTION()
256 bytes = count ? count : shmop->size - start; in PHP_FUNCTION()
269 struct php_shmop *shmop; in PHP_FUNCTION() local
276 if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) { in PHP_FUNCTION()
289 struct php_shmop *shmop; in PHP_FUNCTION() local
295 if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) { in PHP_FUNCTION()
299 RETURN_LONG(shmop->size); in PHP_FUNCTION()
307 struct php_shmop *shmop; in PHP_FUNCTION() local
317 if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) { in PHP_FUNCTION()
321 if ((shmop->shmatflg & SHM_RDONLY) == SHM_RDONLY) { in PHP_FUNCTION()
326 if (offset < 0 || offset > shmop->size) { in PHP_FUNCTION()
331 writesize = (ZSTR_LEN(data) < shmop->size - offset) ? ZSTR_LEN(data) : shmop->size - offset; in PHP_FUNCTION()
332 memcpy(shmop->addr + offset, ZSTR_VAL(data), writesize); in PHP_FUNCTION()
343 struct php_shmop *shmop; in PHP_FUNCTION() local
349 if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) { in PHP_FUNCTION()
353 if (shmctl(shmop->shmid, IPC_RMID, NULL)) { in PHP_FUNCTION()