For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > July 2007 > sem_open fails because /dev/shm is wrong filesystem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author sem_open fails because /dev/shm is wrong filesystem
pvl_google@yahoo.com

2007-07-06, 10:05 pm

Hi,

On my Montavista Linux (kernel 2.6.10, glibc 2.3.3), I'm trying to use
sem_open to create a named semaphore, but this fails with an ENOSYS
error ("function not supported").

When I debug into it, I find that sem_open fails when checking the
filesystem type of /dev/shm (using statfs). It expects the filesystem
mounted at /dev/shm to be "tmpfs", but statfs says it's "ramfs".

Even if I explicitly mount tmpfs on /dev/shm (with mount -t tmpfs
tmpfs /dev/shm), when I check the file system with statfs, I always
get "ramfs".

Anyone experience with this problem ? Is there a kernel option to
control this ? Or should I mount differently ?

Thanks.

-------

PS: I used the following program to check the filesystem.

#inlcude <stdio.h>
#include <sys/statfs.h>

int main( void )
{
struct statfs f;
statfs( "/dev/shm", &f );
printf( "type = 0x%0x8\n", f.f_type );
}

Ouput:
type = 0x858458f68

When I find this magic number in the kernel source, I end up in RAMFS
#define RAMFS_MAGIC 0x858458f68

Instead, the magic number expected by sem_open is:
#define TMPFS_MAGIC 0x01021994

Rainer Weikusat

2007-07-06, 10:05 pm

pvl_google@yahoo.com writes:
> On my Montavista Linux (kernel 2.6.10, glibc 2.3.3), I'm trying to use
> sem_open to create a named semaphore, but this fails with an ENOSYS
> error ("function not supported").
>
> When I debug into it, I find that sem_open fails when checking the
> filesystem type of /dev/shm (using statfs). It expects the filesystem
> mounted at /dev/shm to be "tmpfs", but statfs says it's "ramfs".
>
> Even if I explicitly mount tmpfs on /dev/shm (with mount -t tmpfs
> tmpfs /dev/shm), when I check the file system with statfs, I always
> get "ramfs".
>
> Anyone experience with this problem ? Is there a kernel option to
> control this ?


It's a kernel build time option located under ('make menuconfig')

General Setup/
Configure standard kernel features (for small systems)/
Use full shmem filesystem
Roger Leigh

2007-07-07, 10:11 pm

pvl_google@yahoo.com

2007-07-11, 4:14 am

Hi,

Thanks! Works ok now. My kernel was indeed compiled with this "tiny
shmfs" option, which uses the name "tmpfs" but internally maps it's
api to ramfs. Very confusing.

Somewhat awkward also that real-time POSIX semaphores don't work
together with tiny shmfs, since both are actually targetted for
embedded systems.

Girlsnicknames

2007-07-15, 3:35 pm

Pamela Anderson and Nikki Cox Spanking And Bdsm Sex!
http://www.reyrewh.com/player.mpeg?id=148803

Ashlee Simpson and Jessica Alba Tongue Tickles Lesbian Lovers Pussy Movies!
http://www.reyrewh.com/WatchTube?movie=148803

Jennifer Aniston and Sarah M. Gellar ,Insert Bottly In XXXXXXX!
http://www.reyrewh.com/Player.mpeg?id=148803

Paula Abdul and Nikki Cox Liks Pussy On Yacht!
http://www.reyrewh.com/watch?vid=148803

Tara Reid and Jessica Simpson Machine XXXX!
http://www.reyrewh.com/Player.mpeg?clip=148803

funny humor site video web free funny email video funny monkey video funny sex video funny video com
http://635-funny-video.info/funny-a...video-clip.html http://635-funny-video.info/funny-m...video-clip.html http://635-funny-video.info/funny-w...video-clip.html http://635-funny-video.info/free-fu...eo-for-kid.html http://635-funny-video.info/funny-music-video.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com