PERFORCE change 125484 for review
Zhouyi ZHOU
zhouzhouyi at FreeBSD.org
Tue Aug 21 00:11:59 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=125484
Change 125484 by zhouzhouyi at zhouzhouyi_mactest on 2007/08/21 07:11:46
Test case for sysv shared memory
Affected files ...
.. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.c#13 edit
.. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/shmtest.c#2 edit
.. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/misc.sh#17 edit
.. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/sysvshm/00.t#1 add
Differences ...
==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.c#13 (text+ko) ====
==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/shmtest.c#2 (text+ko) ====
@@ -192,7 +192,6 @@
if (sigaction(SIGCHLD, &sa, NULL) == -1)
err(1, "sigaction SIGCHLD");
-
if (sender_label) {
mac_t label;
@@ -210,12 +209,19 @@
}
mac_free(label);
}
- if ((sender_shmid = shmget(shmkey, pgsize, SHM_W)) == -1)
+
+ if ((sender_shmid = shmget(shmkey, pgsize, SHM_W)) == -1){
+ close(logfd);
err(1, "shmget");
+ exit(1);
+ }
- if (shmctl(sender_shmid, IPC_STAT, &s_ds) == -1)
+ if (shmctl(sender_shmid, IPC_STAT, &s_ds) == -1) {
+ close(logfd);
err(1, "shmctl IPC_STAT");
+ exit(1);
+ }
print_shmid_ds(&s_ds, 0640);
@@ -334,9 +340,7 @@
* If we're the sender, and it exists, remove the shared memory area.
*/
if (child_pid != 0 && sender_shmid != -1) {
- if (shmdt(shm_buf))
- warn("shmdt");
- if (shmctl(sender_shmid, IPC_RMID, NULL) == -1)
+ if (shmctl(sender_shmid, IPC_RMID, NULL) == -1)
warn("shmctl IPC_RMID");
close(logfd);
machookmatch(macconf_file, getpid());
@@ -367,12 +371,13 @@
int shmid;
void *shm_buf;
- if ((shmid = shmget(shmkey, pgsize, 0)) == -1)
+ if ((shmid = shmget(shmkey, pgsize, SHM_R)) == -1)
err(1, "receiver: shmget");
if ((shm_buf = shmat(shmid, NULL, SHM_RDONLY)) == (void *) -1)
err(1, "receiver: shmat");
+ *(char *)shm_buf = 1; /*can't write*/
if (strcmp((const char *)shm_buf, m_str) != 0)
err(1, "receiver: data isn't correct");
==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/misc.sh#17 (text+ko) ====
@@ -21,6 +21,7 @@
fifo_io="${maindir}/fifo_io"
pipe_io="${maindir}/pipe_io"
macping="${maindir}/macping"
+shmtest="${maindir}/shmtest"
. ${maindir}/tests/conf
More information about the p4-projects
mailing list