tag | line | file | source code |
sma | 91 | include/linux/sem.h | struct semid_ds * sma; /* semaphore array for operations */ |
sma | 69 | ipc/sem.c | struct semid_ds *sma; |
sma | 72 | ipc/sem.c | while ((sma = semary[id]) == IPC_NOID) |
sma | 74 | ipc/sem.c | if (sma == IPC_UNUSED) |
sma | 76 | ipc/sem.c | if (key == sma->sem_perm.key) |
sma | 85 | ipc/sem.c | struct semid_ds *sma; |
sma | 100 | ipc/sem.c | size = sizeof (*sma) + nsems * sizeof (struct sem); |
sma | 102 | ipc/sem.c | sma = (struct semid_ds *) kmalloc (size, GFP_KERNEL); |
sma | 103 | ipc/sem.c | if (!sma) { |
sma | 110 | ipc/sem.c | memset (sma, 0, size); |
sma | 111 | ipc/sem.c | sma->sem_base = (struct sem *) &sma[1]; |
sma | 112 | ipc/sem.c | ipcp = &sma->sem_perm; |
sma | 117 | ipc/sem.c | sma->sem_perm.seq = sem_seq; |
sma | 119 | ipc/sem.c | sma->sem_pending_last = &sma->sem_pending; |
sma | 121 | ipc/sem.c | sma->sem_nsems = nsems; |
sma | 122 | ipc/sem.c | sma->sem_ctime = CURRENT_TIME; |
sma | 126 | ipc/sem.c | semary[id] = sma; |
sma | 129 | ipc/sem.c | return (unsigned int) sma->sem_perm.seq * SEMMNI + id; |
sma | 135 | ipc/sem.c | struct semid_ds *sma; |
sma | 148 | ipc/sem.c | sma = semary[id]; |
sma | 149 | ipc/sem.c | if (nsems > sma->sem_nsems) |
sma | 151 | ipc/sem.c | if (ipcperms(&sma->sem_perm, semflg)) |
sma | 153 | ipc/sem.c | return (unsigned int) sma->sem_perm.seq * SEMMNI + id; |
sma | 159 | ipc/sem.c | static inline void insert_into_queue (struct semid_ds * sma, struct sem_queue * q) |
sma | 161 | ipc/sem.c | *(q->prev = sma->sem_pending_last) = q; |
sma | 162 | ipc/sem.c | *(sma->sem_pending_last = &q->next) = NULL; |
sma | 164 | ipc/sem.c | static inline void remove_from_queue (struct semid_ds * sma, struct sem_queue * q) |
sma | 170 | ipc/sem.c | sma->sem_pending_last = q->prev; |
sma | 177 | ipc/sem.c | static int try_semop (struct semid_ds * sma, struct sembuf * sops, int nsops) |
sma | 184 | ipc/sem.c | struct sem * curr = &sma->sem_base[sop->sem_num]; |
sma | 208 | ipc/sem.c | struct sem * curr = &sma->sem_base[sop->sem_num]; |
sma | 216 | ipc/sem.c | static int do_semop (struct semid_ds * sma, struct sembuf * sops, int nsops, |
sma | 223 | ipc/sem.c | struct sem * curr = &sma->sem_base[sop->sem_num]; |
sma | 244 | ipc/sem.c | sma->sem_otime = CURRENT_TIME; |
sma | 257 | ipc/sem.c | static void update_queue (struct semid_ds * sma) |
sma | 264 | ipc/sem.c | for (q = sma->sem_pending; q; q = q->next) { |
sma | 265 | ipc/sem.c | error = try_semop(sma, q->sops, q->nsops); |
sma | 271 | ipc/sem.c | error = do_semop(sma, q->sops, q->nsops, q->undo, q->pid); |
sma | 274 | ipc/sem.c | remove_from_queue(sma,q); |
sma | 291 | ipc/sem.c | static int count_semncnt (struct semid_ds * sma, ushort semnum) |
sma | 297 | ipc/sem.c | for (q = sma->sem_pending; q; q = q->next) { |
sma | 309 | ipc/sem.c | static int count_semzcnt (struct semid_ds * sma, ushort semnum) |
sma | 315 | ipc/sem.c | for (q = sma->sem_pending; q; q = q->next) { |
sma | 331 | ipc/sem.c | struct semid_ds *sma = semary[id]; |
sma | 336 | ipc/sem.c | sma->sem_perm.seq++; |
sma | 338 | ipc/sem.c | used_sems -= sma->sem_nsems; |
sma | 347 | ipc/sem.c | for (un = sma->undo; un; un = un->id_next) |
sma | 351 | ipc/sem.c | for (q = sma->sem_pending; q; q = q->next) { |
sma | 357 | ipc/sem.c | kfree(sma); |
sma | 365 | ipc/sem.c | struct semid_ds *sma; |
sma | 409 | ipc/sem.c | sma = semary[semid]; |
sma | 410 | ipc/sem.c | if (sma == IPC_UNUSED || sma == IPC_NOID) |
sma | 412 | ipc/sem.c | if (ipcperms (&sma->sem_perm, S_IRUGO)) |
sma | 414 | ipc/sem.c | id = (unsigned int) sma->sem_perm.seq * SEMMNI + semid; |
sma | 415 | ipc/sem.c | tbuf.sem_perm = sma->sem_perm; |
sma | 416 | ipc/sem.c | tbuf.sem_otime = sma->sem_otime; |
sma | 417 | ipc/sem.c | tbuf.sem_ctime = sma->sem_ctime; |
sma | 418 | ipc/sem.c | tbuf.sem_nsems = sma->sem_nsems; |
sma | 424 | ipc/sem.c | sma = semary [id]; |
sma | 425 | ipc/sem.c | if (sma == IPC_UNUSED || sma == IPC_NOID) |
sma | 427 | ipc/sem.c | ipcp = &sma->sem_perm; |
sma | 428 | ipc/sem.c | nsems = sma->sem_nsems; |
sma | 429 | ipc/sem.c | if (sma->sem_perm.seq != (unsigned int) semid / SEMMNI) |
sma | 440 | ipc/sem.c | curr = &sma->sem_base[semnum]; |
sma | 455 | ipc/sem.c | case GETNCNT: return count_semncnt(sma,semnum); |
sma | 456 | ipc/sem.c | case GETZCNT: return count_semzcnt(sma,semnum); |
sma | 499 | ipc/sem.c | if (sma->sem_perm.seq != (unsigned int) semid / SEMMNI) |
sma | 506 | ipc/sem.c | for (i = 0; i < sma->sem_nsems; i++) |
sma | 507 | ipc/sem.c | sem_io[i] = sma->sem_base[i].semval; |
sma | 513 | ipc/sem.c | for (un = sma->undo; un; un = un->id_next) |
sma | 516 | ipc/sem.c | sma->sem_ctime = CURRENT_TIME; |
sma | 518 | ipc/sem.c | update_queue(sma); |
sma | 526 | ipc/sem.c | sma->sem_ctime = CURRENT_TIME; |
sma | 533 | ipc/sem.c | tbuf.sem_perm = sma->sem_perm; |
sma | 534 | ipc/sem.c | tbuf.sem_otime = sma->sem_otime; |
sma | 535 | ipc/sem.c | tbuf.sem_ctime = sma->sem_ctime; |
sma | 536 | ipc/sem.c | tbuf.sem_nsems = sma->sem_nsems; |
sma | 543 | ipc/sem.c | sma->sem_base[i].semval = sem_io[i]; |
sma | 544 | ipc/sem.c | for (un = sma->undo; un; un = un->id_next) |
sma | 547 | ipc/sem.c | sma->sem_ctime = CURRENT_TIME; |
sma | 549 | ipc/sem.c | update_queue(sma); |
sma | 560 | ipc/sem.c | struct semid_ds *sma; |
sma | 575 | ipc/sem.c | if ((sma = semary[id]) == IPC_UNUSED || sma == IPC_NOID) |
sma | 577 | ipc/sem.c | if (sma->sem_perm.seq != (unsigned int) semid / SEMMNI) |
sma | 581 | ipc/sem.c | if (sop->sem_num >= sma->sem_nsems) |
sma | 588 | ipc/sem.c | if (ipcperms(&sma->sem_perm, alter ? S_IWUGO : S_IRUGO)) |
sma | 590 | ipc/sem.c | error = try_semop(sma, sops, nsops); |
sma | 601 | ipc/sem.c | size = sizeof(struct sem_undo) + sizeof(short)*sma->sem_nsems; |
sma | 610 | ipc/sem.c | un->id_next = sma->undo; |
sma | 611 | ipc/sem.c | sma->undo = un; |
sma | 617 | ipc/sem.c | error = do_semop(sma, sops, nsops, un, current->pid); |
sma | 619 | ipc/sem.c | update_queue(sma); |
sma | 627 | ipc/sem.c | queue.sma = sma; |
sma | 633 | ipc/sem.c | insert_into_queue(sma,&queue); |
sma | 645 | ipc/sem.c | remove_from_queue(sma,&queue); |
sma | 667 | ipc/sem.c | struct semid_ds *sma; |
sma | 675 | ipc/sem.c | remove_from_queue(q->sma,q); |
sma | 682 | ipc/sem.c | sma = semary[(unsigned int) u->semid % SEMMNI]; |
sma | 683 | ipc/sem.c | if (sma == IPC_UNUSED || sma == IPC_NOID) |
sma | 685 | ipc/sem.c | if (sma->sem_perm.seq != (unsigned int) u->semid / SEMMNI) |
sma | 688 | ipc/sem.c | for (unp = &sma->undo; (un = *unp); unp = &un->id_next) { |
sma | 697 | ipc/sem.c | nsems = sma->sem_nsems; |
sma | 699 | ipc/sem.c | struct sem * sem = &sma->sem_base[i]; |
sma | 705 | ipc/sem.c | sma->sem_otime = CURRENT_TIME; |
sma | 707 | ipc/sem.c | update_queue(sma); |