aix 共享記憶體段問題

gaoyj1973發表於2007-11-21

關於aix作業系統上 共享記憶體(shared memory)單個段的最大值到底受什麼影響,我從網上搜集了大量的資訊但是沒有一個做明確說明的。根據我的經驗 m85 --aix 4.3.3單段最大值是2G,今天在新的p570上測試,剛開始發現,將我們應用程式的配置引數調整到2G以上,shmget就會報錯。

向我們公司平臺工程師諮詢,看看是不是有哪個引數需要修改,得到的答覆:AIX中沒什麼引數需要修改,最新的作業系統5.3支援超過2G,5.1,5.2沒有查過能不能超過2G。

測試:

增加#include

shmid=shmget(p_key,length,IPC_CREAT|IPC_EXCL|0644);

cout <

發現errno = 22

檢視errno.h:

#define EINVAL 22 /* Invalid argument */

是引數的問題,繼續查詢引數的問題,發現我們的length定義的是int,改為 long 正常了。

(說明:其實同樣的問題,我們在m85上也是做過測試的當時改為long是不行的,後來我們考慮可能有兩方面的原因:
1.我們使用的m85雖然是64位的,但是作業系統的核心是32位的;
2.我們m85上的aix是4.3.3)

問題解決了,在此記錄一下。

附其他errno的解釋,方便以後查詢:

/usr/include/errno.h
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Arg list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file descriptor */
#define ECHILD 10 /* No child processes */
#define EAGAIN 11 /* Resource temporarily unavailable */
#define ENOMEM 12 /* Not enough space */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#define ENOTBLK 15 /* Block device required */
#define EBUSY 16 /* Resource busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Improper link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory */
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* Too many open files in system */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Inappropriate I/O control operation */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Invalid seek */
#define EROFS 30 /* Read only file system */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
#define EDOM 33 /* Domain error within math function */
#define ERANGE 34 /* Result too large */
#define ENOMSG 35 /* No message of desired type */
#define EIDRM 36 /* Identifier removed */
#define ECHRNG 37 /* Channel number out of range */
#define EL2NSYNC 38 /* Level 2 not synchronized */
#define EL3HLT 39 /* Level 3 halted */
#define EL3RST 40 /* Level 3 reset */
#define ELNRNG 41 /* Link number out of range */
#define EUNATCH 42 /* Protocol driver not attached */
#define ENOCSI 43 /* No CSI structure available */
#define EL2HLT 44 /* Level 2 halted */
#define EDEADLK 45 /* Resource deadlock avoided */

#define ENOTREADY 46 /* Device not ready */
#define EWRPROTECT 47 /* Write-protected media */
#define EFORMAT 48 /* Unformatted media */

#define ENOLCK 49 /* No locks available */

#define ENOCONNECT 50 /* no connection */
#define ESTALE 52 /* no filesystem */
#define EDIST 53 /* old, currently unused AIX errno*/

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267897/viewspace-983179/,如需轉載,請註明出處,否則將追究法律責任。

相關文章