int fb_get_resolution(async_sess_t *sess, sysarg_t *maxx, sysarg_t *maxy) { async_exch_t *exch = async_exchange_begin(sess); int ret = async_req_0_2(exch, FB_GET_RESOLUTION, maxx, maxy); async_exchange_end(exch); return ret; }
int fb_vp_get_dimensions(async_sess_t *sess, vp_handle_t vp, sysarg_t *cols, sysarg_t *rows) { async_exch_t *exch = vp_exchange_begin(sess, vp); int ret = async_req_0_2(exch, FB_VP_GET_DIMENSIONS, cols, rows); vp_exchange_end(exch); return ret; }
int bd_get_num_blocks(bd_t *bd, aoff64_t *rnb) { sysarg_t nb_l; sysarg_t nb_h; async_exch_t *exch = async_exchange_begin(bd->sess); int rc = async_req_0_2(exch, BD_GET_NUM_BLOCKS, &nb_l, &nb_h); async_exchange_end(exch); if (rc != EOK) return rc; *rnb = (aoff64_t) MERGE_LOUP32(nb_l, nb_h); return EOK; }
/** Get a copy of clipboard contents. * * Returns a new string that can be deallocated with free(). * * @param str Here pointer to the newly allocated string is stored. * * @return Zero on success or negative error code. * */ int clipboard_get_str(char **str) { /* Loop until clipboard read succesful */ while (true) { async_exch_t *exch = clip_exchange_begin(); sysarg_t size; sysarg_t tag; sysarg_t rc = async_req_0_2(exch, CLIPBOARD_CONTENT, &size, &tag); clip_exchange_end(exch); if (rc != EOK) return (int) rc; char *sbuf; switch (tag) { case CLIPBOARD_TAG_NONE: sbuf = malloc(1); if (sbuf == NULL) return ENOMEM; sbuf[0] = 0; *str = sbuf; return EOK; case CLIPBOARD_TAG_DATA: sbuf = malloc(size + 1); if (sbuf == NULL) return ENOMEM; exch = clip_exchange_begin(); aid_t req = async_send_1(exch, CLIPBOARD_GET_DATA, tag, NULL); rc = async_data_read_start(exch, (void *) sbuf, size); clip_exchange_end(exch); if ((int) rc == EOVERFLOW) { /* * The data in the clipboard has changed since * the last call of CLIPBOARD_CONTENT */ break; } if (rc != EOK) { sysarg_t rc_orig; async_wait_for(req, &rc_orig); if (rc_orig == EOK) return (int) rc; else return (int) rc_orig; } async_wait_for(req, &rc); if (rc == EOK) { sbuf[size] = 0; *str = sbuf; } return rc; default: return EINVAL; } } }