Manual Pages for Linux CentOS command on man wl_shm_buffer
MyWebUniversity

Manual Pages for Linux CentOS command on man wl_shm_buffer

wlshmbuffer(3) Wayland wlshmbuffer(3)

NAME

wlshmbuffer - SYNOPSIS Public Member Functions void * wlshmbuffergetdata (struct wlshmbuffer *buffer) struct wlshmpool * wlshmbufferrefpool (struct wlshmbuffer *buffer) void wlshmbufferbeginaccess (struct wlshmbuffer *buffer) void wlshmbufferendaccess (struct wlshmbuffer *buffer) Data Fields struct wlresource * resource int32t width int32t height int32t stride uint32t format int offset struct wlshmpool * pool Member Function Documentation void wlshmbufferbeginaccess (struct wlshmbuffer *buffer) Mark that the given SHM buffer is about to be accessed Parameters: buffer The SHM buffer

An SHM buffer is a memory-mapped file given by the client. According to

POSIX, reading from a memory-mapped region that extends off the end of the file will cause a SIGBUS signal to be generated. Normally this would cause the compositor to terminate. In order to make the compositor robust against clients that change the size of the underlying file or lie about its size, you should protect access to the buffer by calling this function before reading from the memory and call wlshmbufferendaccess afterwards. This will install a signal handler for SIGBUS which will prevent the compositor from crashing. After calling this function the signal handler will remain installed for the lifetime of the compositor process. Note that this function will not work properly if the compositor is also installing its own handler for SIGBUS. If a SIGBUS signal is received for an address within the range of the SHM pool of the given buffer then the client will be sent an error event when wlshmbufferendaccess is called. If the signal is for an address outside that range then the signal handler will reraise the signal which would will likely cause the compositor to terminate. It is safe to nest calls to these functions as long as the nested calls are all accessing the same buffer. The number of calls to wlshmbufferendaccess must match the number of calls to

wlshmbufferbeginaccess. These functions are thread-safe and it is allowed to simultaneously access different buffers or the same buffer from multiple threads. void wlshmbufferendaccess (struct wlshmbuffer *buffer) Ends the access to a buffer started by wlshmbufferbeginaccess Parameters: buffer The SHM buffer This should be called after wlshmbufferbeginaccess once the buffer

is no longer being accessed. If a SIGBUS signal was generated in- between these two calls then the resource for the given buffer will be sent an error. void * wlshmbuffergetdata (struct wlshmbuffer *buffer) Get a pointer to the memory for the SHM buffer Parameters: buffer The buffer object Returns a pointer which can be used to read the data contained in the given SHM buffer.

As this buffer is memory-mapped, reading from it may generate SIGBUS signals. This can happen if the client claims that the buffer is larger than it is or if something truncates the underlying file. To prevent this signal from causing the compositor to crash you should call wlshmbufferbeginaccess and wlshmbufferendaccess around code that reads from the memory. struct wlshmpool * wlshmbufferrefpool (struct wlshmbuffer *buffer) Get a reference to a shmbuffer's shmpool Parameters: buffer The buffer object Returns a pointer to a buffer's shmpool and increases the shmpool refcount. The compositor must remember to call wlshmpoolunref when it no longer needs the reference to ensure proper destruction of the pool. See Also: wlshmpoolunref Field Documentation uint32t wlshmbuffer::format int32t wlshmbuffer::height int wlshmbuffer::offset struct wlshmpool* wlshmbuffer::pool struct wlresource* wlshmbuffer::resource int32t wlshmbuffer::stride int32t wlshmbuffer::width Author Generated automatically by Doxygen for Wayland from the source code. Version 1.15.0 Tue Oct 30 2018 wlshmbuffer(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™