Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

当使用不同size生成两次共享内存时返回的错误代码

From Wiki
Jump to: navigation, search
  • 详细描述

为了增进性能和更好的适应POSIX标准,Open C的下一个发布版将会在架构上有诸多改进。其中一些变化也会影响到以前版本的的二进制兼容性。


之前版本中,当用户试图两次使用不同的大小生成一个共享的内存段(shmget)时,就会返回EINVAL。而在新版中就会返回EEXIST。


  • 如何重演
int shm_id ;
 
if ((shm_id = shmget(1000, 100, 512))== -1) {
printf("shared memory create failed with errno %d\n", errno);
}
 
if ((shm_id = shmget(1000, 200, 1536))== -1) {
/* now returns with errno = 17 ( not errno = 22 ) */
printf("Shared memory create failed with errno %d\n", errno);
}


  • 解决方案

Open C程序应该准备好处理这些返回错误值的变化。

This page was last modified on 8 August 2012, at 02:07.
27 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×