On 07/30/2009 03:19 PM, leo mueller wrote: > > by doing a mmap() my program exits with -EINVAL and up to now i have > no clue why... parametes should be right. > > do you have any idea? > maybe somethings wrong with your socket. mmap-ping a fd for example only works if you open the fd O_RDWR, e.g.: /** Open a file for writing. * - Creating the file if it doesn't exist. * - Truncating it to 0 size if it already exists. (not really needed) * * Note: "O_WRONLY" mode is not sufficient when mmap-ing. **/ fd = open( FILEPATH, O_RDWR | O_CREAT | O_TRUNC, ( mode_t )0600 ); if ( fd == -1 ) { perror( "Error opening file for writing" ); exit( EXIT_FAILURE ); } /** * Now the file is ready to be mmap-ped. **/ map = mmap( 0, FILESIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 ); if ( map == MAP_FAILED ) { close( fd ); perror( "Error mmapping the file" ); exit( EXIT_FAILURE ); } -- To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html