Changeset 8565a42 in mainline for uspace/srv/clipboard/clipboard.c
- Timestamp:
- 2018-03-02T20:34:50Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a1a81f69, d5e5fd1
- Parents:
- 3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
- git-committer:
- GitHub <noreply@…> (2018-03-02 20:34:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/clipboard/clipboard.c
r3061bc1 r8565a42 52 52 errno_t rc; 53 53 size_t size; 54 54 55 55 switch (IPC_GET_ARG1(*request)) { 56 56 case CLIPBOARD_TAG_NONE: 57 57 fibril_mutex_lock(&clip_mtx); 58 58 59 59 if (clip_data) 60 60 free(clip_data); 61 61 62 62 clip_data = NULL; 63 63 clip_size = 0; 64 64 clip_tag = CLIPBOARD_TAG_NONE; 65 65 66 66 fibril_mutex_unlock(&clip_mtx); 67 67 async_answer_0(rid, EOK); … … 73 73 break; 74 74 } 75 75 76 76 fibril_mutex_lock(&clip_mtx); 77 77 78 78 if (clip_data) 79 79 free(clip_data); 80 80 81 81 clip_data = data; 82 82 clip_size = size; 83 83 clip_tag = CLIPBOARD_TAG_DATA; 84 84 85 85 fibril_mutex_unlock(&clip_mtx); 86 86 async_answer_0(rid, EOK); … … 94 94 { 95 95 fibril_mutex_lock(&clip_mtx); 96 96 97 97 ipc_callid_t callid; 98 98 size_t size; 99 99 100 100 /* Check for clipboard data tag compatibility */ 101 101 switch (IPC_GET_ARG1(*request)) { … … 106 106 break; 107 107 } 108 108 109 109 if (clip_tag != CLIPBOARD_TAG_DATA) { 110 110 /* So far we only understand binary data */ … … 113 113 break; 114 114 } 115 115 116 116 if (clip_size != size) { 117 117 /* The client expects different size of data */ … … 120 120 break; 121 121 } 122 122 123 123 errno_t retval = async_data_read_finalize(callid, clip_data, size); 124 124 if (retval != EOK) { … … 126 126 break; 127 127 } 128 128 129 129 async_answer_0(rid, EOK); 130 130 break; … … 137 137 break; 138 138 } 139 139 140 140 fibril_mutex_unlock(&clip_mtx); 141 141 } … … 144 144 { 145 145 fibril_mutex_lock(&clip_mtx); 146 146 147 147 size_t size = clip_size; 148 148 clipboard_tag_t tag = clip_tag; 149 149 150 150 fibril_mutex_unlock(&clip_mtx); 151 151 async_answer_2(rid, EOK, (sysarg_t) size, (sysarg_t) tag); … … 156 156 /* Accept connection */ 157 157 async_answer_0(iid, EOK); 158 158 159 159 while (true) { 160 160 ipc_call_t call; 161 161 ipc_callid_t callid = async_get_call(&call); 162 162 163 163 if (!IPC_GET_IMETHOD(call)) 164 164 break; 165 165 166 166 switch (IPC_GET_IMETHOD(call)) { 167 167 case CLIPBOARD_PUT_DATA: … … 183 183 { 184 184 errno_t rc; 185 185 186 186 printf("%s: HelenOS clipboard service\n", NAME); 187 187 async_set_fallback_port_handler(clip_connection, NULL); 188 188 189 189 rc = loc_server_register(NAME); 190 190 if (rc != EOK) { … … 192 192 return rc; 193 193 } 194 194 195 195 rc = loc_service_register(SERVICE_NAME_CLIPBOARD, &svc_id); 196 196 if (rc != EOK) { … … 198 198 return rc; 199 199 } 200 200 201 201 printf("%s: Accepting connections\n", NAME); 202 202 task_retval(0); 203 203 async_manager(); 204 204 205 205 /* Never reached */ 206 206 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.