This adds some log-messages to ioctl() calls where we don't really care
for the return value. It isn't strictly necessary to look for those, but
lets be sure and print warnings. This silences gcc and coverity, and also
makes sure we get reports in case something goes wrong and we didn't
expect it to fail that way.
grdrm_fb *grdrm_fb_free(grdrm_fb *fb) {
unsigned int i;
grdrm_fb *grdrm_fb_free(grdrm_fb *fb) {
unsigned int i;
if (!fb)
return NULL;
assert(fb->card);
if (!fb)
return NULL;
assert(fb->card);
- if (fb->id > 0 && fb->card->fd >= 0)
- ioctl(fb->card->fd, DRM_IOCTL_MODE_RMFB, fb->id);
+ if (fb->id > 0 && fb->card->fd >= 0) {
+ r = ioctl(fb->card->fd, DRM_IOCTL_MODE_RMFB, fb->id);
+ if (r < 0)
+ log_debug("grdrm: %s: cannot delete framebuffer %" PRIu32 ": %m",
+ fb->card->base.name, fb->id);
+ }
for (i = 0; i < ELEMENTSOF(fb->handles); ++i) {
struct drm_mode_destroy_dumb destroy_dumb = { };
for (i = 0; i < ELEMENTSOF(fb->handles); ++i) {
struct drm_mode_destroy_dumb destroy_dumb = { };
if (fb->handles[i] > 0 && fb->card->fd >= 0) {
destroy_dumb.handle = fb->handles[i];
if (fb->handles[i] > 0 && fb->card->fd >= 0) {
destroy_dumb.handle = fb->handles[i];
- ioctl(fb->card->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
+ r = ioctl(fb->card->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
+ if (r < 0)
+ log_debug("grdrm: %s: cannot destroy dumb-buffer %" PRIu32 ": %m",
+ fb->card->base.name, fb->handles[i]);
basecard->session->name, basecard->name, cu->devnode);
} else {
/* We might get DRM-Master implicitly on open(); drop it immediately
basecard->session->name, basecard->name, cu->devnode);
} else {
/* We might get DRM-Master implicitly on open(); drop it immediately
- * so we acquire it only once we're actually enabled. */
- ioctl(fd, DRM_IOCTL_DROP_MASTER, 0);
+ * so we acquire it only once we're actually enabled. We don't
+ * really care whether this call fails or not, but lets log any
+ * weird errors, anyway. */
+ r = ioctl(fd, DRM_IOCTL_DROP_MASTER, 0);
+ if (r < 0 && errno != EACCES && errno != EINVAL)
+ log_debug("grdrm: %s/%s: cannot drop DRM-Master: %m",
+ basecard->session->name, basecard->name);
r = grdrm_card_open(&cu->card, fd);
if (r < 0)
r = grdrm_card_open(&cu->card, fd);
if (r < 0)
}
void session_leave_vt(Session *s) {
}
void session_leave_vt(Session *s) {
assert(s);
/* This is called whenever we get a VT-switch signal from the kernel.
assert(s);
/* This is called whenever we get a VT-switch signal from the kernel.
return;
session_device_pause_all(s);
return;
session_device_pause_all(s);
- ioctl(s->vtfd, VT_RELDISP, 1);
+ r = ioctl(s->vtfd, VT_RELDISP, 1);
+ if (r < 0)
+ log_debug("Cannot release VT of session %s: %m", s->id);
}
bool session_is_controller(Session *s, const char *sender) {
}
bool session_is_controller(Session *s, const char *sender) {