Thus spake Robert Latham: > On lain, however, shmctl(2) returns EPERM. This is different from the > error returned when db tries to call shmctl (EAGAIN), but does suggest > some sort of broader shared memory problem.
Hrmm, I tried it on my Debian machine (2.6.16 kernel) and another one
with a 2.4.20 kernel, and it didn't error out on either of them.
Some data points to look at:
- Kernel version
- glibc version
- Values of /proc/sys/kernel/shm*
- Info from shmctl(IPC_STAT)
Try this code on lain, and see what happens with it...
(When I didn't pass S_IRWXU on the create flags, I got a permission
denied on the stat, sooo who knows, but it's worth looking at. Mostly
we're interested in seeing if the creator uid and owner uid are getting
filled in properly, which according to the man page is the only reason
it _should_ return EPERM for shmctl.
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(int argc, char ** argv)
{
int shm, ret;
struct shmid_ds info;
ret = shmget(646567224, 1024, IPC_CREAT | S_IRWXU);
if (ret == -1) {
perror("shmget");
return -1;
}
shm = ret;
ret = shmctl(shm, IPC_STAT, &info);
if (ret == -1) {
perror("shmctl IPC_STAT");
return -1;
}
printf("cuid=%d\nuid=%d\n", info.shm_perm.cuid, info.shm_perm.uid);
ret = shmctl(shm, IPC_RMID, 0);
if (ret == -1){
perror("shmctl IPC_RMID");
return -1;
}
return 0;
}
> I don't know a whole lot about shared memory regions. Can anyone
> suggest what's wrong with the test program, or why it might fail?
> lain does have a tmpfs mounted on /dev/shm, and /dev/shm has the same
> permissions as on other machines. the kernel has SYSV IPC support
> built in.
The SYSV shared memory support is implemented in a different manner in
Linux. The /dev/shm mount point is used by Linux to implement POSIX
shared memory
--
Nathan Poznick <[EMAIL PROTECTED]>
Cards were at first for benefits designed, Sent to amuse, not to
enslave the mind. - David Garrick
signature.asc
Description: Digital signature
_______________________________________________ Pvfs2-developers mailing list [email protected] http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
