📄 rtapi_shmem.3rtapi
字号:
.TH rtapi_shmem "3rtapi" "2006-10-12" "EMC Documentation" "RTAPI".SH NAMErtapi_shmem \- Functions for managing shared memory blocks.SH SYNTAX.HP int rtapi_shmem_new(int \fIkey\fR, int \fImodule_id\fR, unsigned long int \fIsize\fR).HP int rtapi_shmem_delete(int \fIshmem_id\fR, int \fImodule_id\fR).HP int rtapi_shmem_getptr(int \fIshmem_id\fR, void ** \fIptr\fR).SH ARGUMENTS.IP \fIkey\fBIdentifies the memory block. Key must be nonzero. All modules wishing to use the same memory must use the same key..IP \fImodule_id\fBModule identifier returned by a prior call to \fBrtapi_init\fR..IP \fIsize\fBThe desired size of the shared memory block, in bytes.IP \fIptr\fBThe pointer to the shared memory block. Note that the block may be mappedat a different address for different modules..SH DESCRIPTION\fBrtapi_shmem_new\fR allocates a block of shared memory. \fIkey\fRidentifies the memory block, and must be non-zero. All moduleswishing to access the same memory must use the same key.\fImodule_id\fR is the ID of the module that is making the call (seertapi_init). The block will be at least \fIsize\fR bytes, and maybe rounded up. Allocating many small blocks may be very wasteful.When a particular block is allocated for the first time, the first4 bytes are zeroed. Subsequent allocations of the same blockby other modules or processes will not touch the contents of theblock. Applications can use those bytes to see if they need to initialize the block, or if another module already did so.On success, it returns a positive integer ID, which is used forall subsequent calls dealing with the block. On failure it returns a negative error code.\fBrtapi_shmem_delete\fR frees the shared memory block associatedwith \fIshmem_id\fR. \fImodule_id\fR is the ID of the calling module.Returns a status code.\fBrtapi_shmem_getptr\fR sets \fI*ptr\fR to point to shared memory blockassociated with \fIshmem_id\fR..SH REALTIME CONSIDERATIONS\fBrtapi_shmem_getptr\fR may be called from user code, init/cleanup code,or realtime tasks.\fBrtapi_shmem_new\fR and \fBrtapi_shmem_dete\fR may not be called fromrealtime tasks..SH RETURN VALUE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -