t-shm.c (141858) | t-shm.c (147078) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2000-2002, 2004 Sendmail, Inc. and its suppliers. | 2 * Copyright (c) 2000-2002, 2004, 2005 Sendmail, Inc. and its suppliers. |
3 * All rights reserved. 4 * 5 * By using this file, you agree to the terms and conditions set 6 * forth in the LICENSE file which can be found at the top level of 7 * the sendmail distribution. 8 */ 9 10#include <sm/gen.h> | 3 * All rights reserved. 4 * 5 * By using this file, you agree to the terms and conditions set 6 * forth in the LICENSE file which can be found at the top level of 7 * the sendmail distribution. 8 */ 9 10#include <sm/gen.h> |
11SM_RCSID("@(#)$Id: t-shm.c,v 1.20 2004/08/03 20:51:36 ca Exp $") | 11SM_RCSID("@(#)$Id: t-shm.c,v 1.22 2005/01/14 02:14:10 ca Exp $") |
12 13#include <stdio.h> 14 15#if SM_CONF_SHM 16# include <stdlib.h> 17# include <unistd.h> 18# include <sys/wait.h> 19 --- 58 unchanged lines hidden (view full) --- 78 } 79 if (*shm != SHM_MAX + t) 80 fprintf(stderr, "error: %d != %d\n", 81 *shm, SHM_MAX + t); 82 break; 83 case 'v': 84 printf("shmval: %d\n", *shm); 85 break; | 12 13#include <stdio.h> 14 15#if SM_CONF_SHM 16# include <stdlib.h> 17# include <unistd.h> 18# include <sys/wait.h> 19 --- 58 unchanged lines hidden (view full) --- 78 } 79 if (*shm != SHM_MAX + t) 80 fprintf(stderr, "error: %d != %d\n", 81 *shm, SHM_MAX + t); 82 break; 83 case 'v': 84 printf("shmval: %d\n", *shm); 85 break; |
86 case 'S': 87 i = sm_shmsetowner(shmid, getuid(), getgid(), 0644); 88 printf("sm_shmsetowner=%d\n", i); 89 break; |
|
86 } 87 } 88 return sm_shmstop((void *) shm, shmid, owner); 89} 90 91 92/* 93** SHMBIG -- testing of shared memory --- 66 unchanged lines hidden (view full) --- 160 perror("shminit failed"); 161 return -1; 162 } 163 164 if (owner) 165 { 166 int r; 167 | 90 } 91 } 92 return sm_shmstop((void *) shm, shmid, owner); 93} 94 95 96/* 97** SHMBIG -- testing of shared memory --- 66 unchanged lines hidden (view full) --- 164 perror("shminit failed"); 165 return -1; 166 } 167 168 if (owner) 169 { 170 int r; 171 |
172 r = sm_shmsetowner(shmid, getuid(), getgid(), 0660); 173 SM_TEST(r == 0); |
|
168 *shm = 1; 169 while (*shm == 1 && cnt++ < MAX_CNT) 170 sleep(1); 171 SM_TEST(cnt <= MAX_CNT); 172 173 /* release and re-acquire the segment */ 174 r = sm_shmstop((void *) shm, shmid, owner); 175 SM_TEST(r == 0); --- 95 unchanged lines hidden --- | 174 *shm = 1; 175 while (*shm == 1 && cnt++ < MAX_CNT) 176 sleep(1); 177 SM_TEST(cnt <= MAX_CNT); 178 179 /* release and re-acquire the segment */ 180 r = sm_shmstop((void *) shm, shmid, owner); 181 SM_TEST(r == 0); --- 95 unchanged lines hidden --- |