sysv_sem.c (219028) | sysv_sem.c (220388) |
---|---|
1/*- 2 * Implementation of SVID semaphores 3 * 4 * Author: Daniel Boulet 5 * 6 * This software is provided ``AS IS'' without any warranties of any kind. 7 */ 8/*- --- 23 unchanged lines hidden (view full) --- 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 */ 38 39#include <sys/cdefs.h> | 1/*- 2 * Implementation of SVID semaphores 3 * 4 * Author: Daniel Boulet 5 * 6 * This software is provided ``AS IS'' without any warranties of any kind. 7 */ 8/*- --- 23 unchanged lines hidden (view full) --- 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 */ 38 39#include <sys/cdefs.h> |
40__FBSDID("$FreeBSD: head/sys/kern/sysv_sem.c 219028 2011-02-25 10:11:01Z netchild $"); | 40__FBSDID("$FreeBSD: head/sys/kern/sysv_sem.c 220388 2011-04-06 16:59:54Z trasz $"); |
41 42#include "opt_compat.h" 43#include "opt_sysvipc.h" 44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/sysproto.h> 48#include <sys/eventhandler.h> --- 602 unchanged lines hidden (view full) --- 651 case IPC_RMID: 652 if ((error = semvalid(semid, semakptr)) != 0) 653 goto done2; 654 if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_M))) 655 goto done2; 656 semakptr->u.sem_perm.cuid = cred->cr_uid; 657 semakptr->u.sem_perm.uid = cred->cr_uid; 658 semakptr->u.sem_perm.mode = 0; | 41 42#include "opt_compat.h" 43#include "opt_sysvipc.h" 44 45#include <sys/param.h> 46#include <sys/systm.h> 47#include <sys/sysproto.h> 48#include <sys/eventhandler.h> --- 602 unchanged lines hidden (view full) --- 651 case IPC_RMID: 652 if ((error = semvalid(semid, semakptr)) != 0) 653 goto done2; 654 if ((error = ipcperm(td, &semakptr->u.sem_perm, IPC_M))) 655 goto done2; 656 semakptr->u.sem_perm.cuid = cred->cr_uid; 657 semakptr->u.sem_perm.uid = cred->cr_uid; 658 semakptr->u.sem_perm.mode = 0; |
659 crfree(semakptr->cred); 660 semakptr->cred = NULL; |
|
659 SEMUNDO_LOCK(); 660 semundo_clear(semidx, -1); 661 SEMUNDO_UNLOCK(); 662#ifdef MAC 663 mac_sysvsem_cleanup(semakptr); 664#endif 665 wakeup(semakptr); 666 for (i = 0; i < seminfo.semmni; i++) { --- 265 unchanged lines hidden (view full) --- 932 KASSERT((sema[semid].u.sem_perm.mode & SEM_ALLOC) == 0, 933 ("Lost semaphore %d", semid)); 934 sema[semid].u.sem_perm.key = key; 935 sema[semid].u.sem_perm.cuid = cred->cr_uid; 936 sema[semid].u.sem_perm.uid = cred->cr_uid; 937 sema[semid].u.sem_perm.cgid = cred->cr_gid; 938 sema[semid].u.sem_perm.gid = cred->cr_gid; 939 sema[semid].u.sem_perm.mode = (semflg & 0777) | SEM_ALLOC; | 661 SEMUNDO_LOCK(); 662 semundo_clear(semidx, -1); 663 SEMUNDO_UNLOCK(); 664#ifdef MAC 665 mac_sysvsem_cleanup(semakptr); 666#endif 667 wakeup(semakptr); 668 for (i = 0; i < seminfo.semmni; i++) { --- 265 unchanged lines hidden (view full) --- 934 KASSERT((sema[semid].u.sem_perm.mode & SEM_ALLOC) == 0, 935 ("Lost semaphore %d", semid)); 936 sema[semid].u.sem_perm.key = key; 937 sema[semid].u.sem_perm.cuid = cred->cr_uid; 938 sema[semid].u.sem_perm.uid = cred->cr_uid; 939 sema[semid].u.sem_perm.cgid = cred->cr_gid; 940 sema[semid].u.sem_perm.gid = cred->cr_gid; 941 sema[semid].u.sem_perm.mode = (semflg & 0777) | SEM_ALLOC; |
942 crhold(cred); 943 sema[semid].cred = cred; |
|
940 sema[semid].u.sem_perm.seq = 941 (sema[semid].u.sem_perm.seq + 1) & 0x7fff; 942 sema[semid].u.sem_nsems = nsems; 943 sema[semid].u.sem_otime = 0; 944 sema[semid].u.sem_ctime = time_second; 945 sema[semid].u.sem_base = &sem[semtot]; 946 semtot += nsems; 947 bzero(sema[semid].u.sem_base, --- 703 unchanged lines hidden --- | 944 sema[semid].u.sem_perm.seq = 945 (sema[semid].u.sem_perm.seq + 1) & 0x7fff; 946 sema[semid].u.sem_nsems = nsems; 947 sema[semid].u.sem_otime = 0; 948 sema[semid].u.sem_ctime = time_second; 949 sema[semid].u.sem_base = &sem[semtot]; 950 semtot += nsems; 951 bzero(sema[semid].u.sem_base, --- 703 unchanged lines hidden --- |