svr4_ipc.c (160187) | svr4_ipc.c (194910) |
---|---|
1/*- 2 * Copyright (c) 1995 The NetBSD Foundation, Inc. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to The NetBSD Foundation 6 * by Christos Zoulas. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 57 unchanged lines hidden (view full) --- 66 * to preprocessor conditionals). A nice project for a kernel hacking 67 * novice might be to MakeItGo, but I have more important fish to fry 68 * at present. 69 * 70 * Derived from: $NetBSD: svr4_ipc.c,v 1.7 1998/10/19 22:43:00 tron Exp $ 71 */ 72 73#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1995 The NetBSD Foundation, Inc. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to The NetBSD Foundation 6 * by Christos Zoulas. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 57 unchanged lines hidden (view full) --- 66 * to preprocessor conditionals). A nice project for a kernel hacking 67 * novice might be to MakeItGo, but I have more important fish to fry 68 * at present. 69 * 70 * Derived from: $NetBSD: svr4_ipc.c,v 1.7 1998/10/19 22:43:00 tron Exp $ 71 */ 72 73#include <sys/cdefs.h> |
74__FBSDID("$FreeBSD: head/sys/compat/svr4/svr4_ipc.c 160187 2006-07-08 19:51:38Z jhb $"); | 74__FBSDID("$FreeBSD: head/sys/compat/svr4/svr4_ipc.c 194910 2009-06-24 21:10:52Z jhb $"); |
75 76#include "opt_sysvipc.h" 77 78#include <sys/param.h> 79#include <sys/ipc.h> 80#include <sys/msg.h> 81#include <sys/proc.h> 82#include <sys/sem.h> --- 81 unchanged lines hidden (view full) --- 164#endif 165 166#ifdef SYSVSEM 167static void 168bsd_to_svr4_semid_ds(bds, sds) 169 const struct semid_ds *bds; 170 struct svr4_semid_ds *sds; 171{ | 75 76#include "opt_sysvipc.h" 77 78#include <sys/param.h> 79#include <sys/ipc.h> 80#include <sys/msg.h> 81#include <sys/proc.h> 82#include <sys/sem.h> --- 81 unchanged lines hidden (view full) --- 164#endif 165 166#ifdef SYSVSEM 167static void 168bsd_to_svr4_semid_ds(bds, sds) 169 const struct semid_ds *bds; 170 struct svr4_semid_ds *sds; 171{ |
172 bzero(sds, sizeof(*sds)); |
|
172 bsd_to_svr4_ipc_perm(&bds->sem_perm, &sds->sem_perm); 173 sds->sem_base = (struct svr4_sem *) bds->sem_base; 174 sds->sem_nsems = bds->sem_nsems; 175 sds->sem_otime = bds->sem_otime; | 173 bsd_to_svr4_ipc_perm(&bds->sem_perm, &sds->sem_perm); 174 sds->sem_base = (struct svr4_sem *) bds->sem_base; 175 sds->sem_nsems = bds->sem_nsems; 176 sds->sem_otime = bds->sem_otime; |
176 sds->sem_pad1 = bds->sem_pad1; | |
177 sds->sem_ctime = bds->sem_ctime; | 177 sds->sem_ctime = bds->sem_ctime; |
178 sds->sem_pad2 = bds->sem_pad2; | |
179} 180 181static void 182svr4_to_bsd_semid_ds(sds, bds) 183 const struct svr4_semid_ds *sds; 184 struct semid_ds *bds; 185{ 186 svr4_to_bsd_ipc_perm(&sds->sem_perm, &bds->sem_perm); 187 bds->sem_base = (struct sem *) bds->sem_base; 188 bds->sem_nsems = sds->sem_nsems; 189 bds->sem_otime = sds->sem_otime; | 178} 179 180static void 181svr4_to_bsd_semid_ds(sds, bds) 182 const struct svr4_semid_ds *sds; 183 struct semid_ds *bds; 184{ 185 svr4_to_bsd_ipc_perm(&sds->sem_perm, &bds->sem_perm); 186 bds->sem_base = (struct sem *) bds->sem_base; 187 bds->sem_nsems = sds->sem_nsems; 188 bds->sem_otime = sds->sem_otime; |
190 bds->sem_pad1 = sds->sem_pad1; | |
191 bds->sem_ctime = sds->sem_ctime; | 189 bds->sem_ctime = sds->sem_ctime; |
192 bds->sem_pad2 = sds->sem_pad2; | |
193} 194 195struct svr4_sys_semctl_args { 196 int what; 197 int semid; 198 int semnum; 199 int cmd; 200 union semun arg; --- 144 unchanged lines hidden (view full) --- 345#endif 346 347#ifdef SYSVMSG 348static void 349bsd_to_svr4_msqid_ds(bds, sds) 350 const struct msqid_ds *bds; 351 struct svr4_msqid_ds *sds; 352{ | 190} 191 192struct svr4_sys_semctl_args { 193 int what; 194 int semid; 195 int semnum; 196 int cmd; 197 union semun arg; --- 144 unchanged lines hidden (view full) --- 342#endif 343 344#ifdef SYSVMSG 345static void 346bsd_to_svr4_msqid_ds(bds, sds) 347 const struct msqid_ds *bds; 348 struct svr4_msqid_ds *sds; 349{ |
350 bzero(sds, sizeof(*sds)); |
|
353 bsd_to_svr4_ipc_perm(&bds->msg_perm, &sds->msg_perm); 354 sds->msg_first = (struct svr4_msg *) bds->msg_first; 355 sds->msg_last = (struct svr4_msg *) bds->msg_last; 356 sds->msg_cbytes = bds->msg_cbytes; 357 sds->msg_qnum = bds->msg_qnum; 358 sds->msg_qbytes = bds->msg_qbytes; 359 sds->msg_lspid = bds->msg_lspid; 360 sds->msg_lrpid = bds->msg_lrpid; 361 sds->msg_stime = bds->msg_stime; | 351 bsd_to_svr4_ipc_perm(&bds->msg_perm, &sds->msg_perm); 352 sds->msg_first = (struct svr4_msg *) bds->msg_first; 353 sds->msg_last = (struct svr4_msg *) bds->msg_last; 354 sds->msg_cbytes = bds->msg_cbytes; 355 sds->msg_qnum = bds->msg_qnum; 356 sds->msg_qbytes = bds->msg_qbytes; 357 sds->msg_lspid = bds->msg_lspid; 358 sds->msg_lrpid = bds->msg_lrpid; 359 sds->msg_stime = bds->msg_stime; |
362 sds->msg_pad1 = bds->msg_pad1; | |
363 sds->msg_rtime = bds->msg_rtime; | 360 sds->msg_rtime = bds->msg_rtime; |
364 sds->msg_pad2 = bds->msg_pad2; | |
365 sds->msg_ctime = bds->msg_ctime; | 361 sds->msg_ctime = bds->msg_ctime; |
366 sds->msg_pad3 = bds->msg_pad3; 367 368 /* use the padding for the rest of the fields */ 369 { 370 const short *pad = (const short *) bds->msg_pad4; 371 sds->msg_cv = pad[0]; 372 sds->msg_qnum_cv = pad[1]; 373 } | |
374} 375 376static void 377svr4_to_bsd_msqid_ds(sds, bds) 378 const struct svr4_msqid_ds *sds; 379 struct msqid_ds *bds; 380{ 381 svr4_to_bsd_ipc_perm(&sds->msg_perm, &bds->msg_perm); 382 bds->msg_first = (struct msg *) sds->msg_first; 383 bds->msg_last = (struct msg *) sds->msg_last; 384 bds->msg_cbytes = sds->msg_cbytes; 385 bds->msg_qnum = sds->msg_qnum; 386 bds->msg_qbytes = sds->msg_qbytes; 387 bds->msg_lspid = sds->msg_lspid; 388 bds->msg_lrpid = sds->msg_lrpid; 389 bds->msg_stime = sds->msg_stime; | 362} 363 364static void 365svr4_to_bsd_msqid_ds(sds, bds) 366 const struct svr4_msqid_ds *sds; 367 struct msqid_ds *bds; 368{ 369 svr4_to_bsd_ipc_perm(&sds->msg_perm, &bds->msg_perm); 370 bds->msg_first = (struct msg *) sds->msg_first; 371 bds->msg_last = (struct msg *) sds->msg_last; 372 bds->msg_cbytes = sds->msg_cbytes; 373 bds->msg_qnum = sds->msg_qnum; 374 bds->msg_qbytes = sds->msg_qbytes; 375 bds->msg_lspid = sds->msg_lspid; 376 bds->msg_lrpid = sds->msg_lrpid; 377 bds->msg_stime = sds->msg_stime; |
390 bds->msg_pad1 = sds->msg_pad1; | |
391 bds->msg_rtime = sds->msg_rtime; | 378 bds->msg_rtime = sds->msg_rtime; |
392 bds->msg_pad2 = sds->msg_pad2; | |
393 bds->msg_ctime = sds->msg_ctime; | 379 bds->msg_ctime = sds->msg_ctime; |
394 bds->msg_pad3 = sds->msg_pad3; 395 396 /* use the padding for the rest of the fields */ 397 { 398 short *pad = (short *) bds->msg_pad4; 399 pad[0] = sds->msg_cv; 400 pad[1] = sds->msg_qnum_cv; 401 } | |
402} 403 404struct svr4_sys_msgsnd_args { 405 int what; 406 int msqid; 407 void * msgp; 408 size_t msgsz; 409 int msgflg; --- 128 unchanged lines hidden (view full) --- 538 539#ifdef SYSVSHM 540 541static void 542bsd_to_svr4_shmid_ds(bds, sds) 543 const struct shmid_ds *bds; 544 struct svr4_shmid_ds *sds; 545{ | 380} 381 382struct svr4_sys_msgsnd_args { 383 int what; 384 int msqid; 385 void * msgp; 386 size_t msgsz; 387 int msgflg; --- 128 unchanged lines hidden (view full) --- 516 517#ifdef SYSVSHM 518 519static void 520bsd_to_svr4_shmid_ds(bds, sds) 521 const struct shmid_ds *bds; 522 struct svr4_shmid_ds *sds; 523{ |
524 bzero(sds, sizeof(*sds)); |
|
546 bsd_to_svr4_ipc_perm(&bds->shm_perm, &sds->shm_perm); 547 sds->shm_segsz = bds->shm_segsz; 548 sds->shm_lkcnt = 0; 549 sds->shm_lpid = bds->shm_lpid; 550 sds->shm_cpid = bds->shm_cpid; | 525 bsd_to_svr4_ipc_perm(&bds->shm_perm, &sds->shm_perm); 526 sds->shm_segsz = bds->shm_segsz; 527 sds->shm_lkcnt = 0; 528 sds->shm_lpid = bds->shm_lpid; 529 sds->shm_cpid = bds->shm_cpid; |
551 sds->shm_amp = bds->shm_internal; | 530 sds->shm_amp = 0; |
552 sds->shm_nattch = bds->shm_nattch; 553 sds->shm_cnattch = 0; 554 sds->shm_atime = bds->shm_atime; | 531 sds->shm_nattch = bds->shm_nattch; 532 sds->shm_cnattch = 0; 533 sds->shm_atime = bds->shm_atime; |
555 sds->shm_pad1 = 0; | |
556 sds->shm_dtime = bds->shm_dtime; | 534 sds->shm_dtime = bds->shm_dtime; |
557 sds->shm_pad2 = 0; | |
558 sds->shm_ctime = bds->shm_ctime; | 535 sds->shm_ctime = bds->shm_ctime; |
559 sds->shm_pad3 = 0; | |
560} 561 562static void 563svr4_to_bsd_shmid_ds(sds, bds) 564 const struct svr4_shmid_ds *sds; 565 struct shmid_ds *bds; 566{ 567 svr4_to_bsd_ipc_perm(&sds->shm_perm, &bds->shm_perm); 568 bds->shm_segsz = sds->shm_segsz; 569 bds->shm_lpid = sds->shm_lpid; 570 bds->shm_cpid = sds->shm_cpid; | 536} 537 538static void 539svr4_to_bsd_shmid_ds(sds, bds) 540 const struct svr4_shmid_ds *sds; 541 struct shmid_ds *bds; 542{ 543 svr4_to_bsd_ipc_perm(&sds->shm_perm, &bds->shm_perm); 544 bds->shm_segsz = sds->shm_segsz; 545 bds->shm_lpid = sds->shm_lpid; 546 bds->shm_cpid = sds->shm_cpid; |
571 bds->shm_internal = sds->shm_amp; | |
572 bds->shm_nattch = sds->shm_nattch; 573 bds->shm_atime = sds->shm_atime; 574 bds->shm_dtime = sds->shm_dtime; 575 bds->shm_ctime = sds->shm_ctime; 576} 577 578struct svr4_sys_shmat_args { 579 int what; --- 153 unchanged lines hidden --- | 547 bds->shm_nattch = sds->shm_nattch; 548 bds->shm_atime = sds->shm_atime; 549 bds->shm_dtime = sds->shm_dtime; 550 bds->shm_ctime = sds->shm_ctime; 551} 552 553struct svr4_sys_shmat_args { 554 int what; --- 153 unchanged lines hidden --- |