Changeset 8d6bcc8c in mainline
- Timestamp:
- 2017-09-25T20:51:51Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7b616e2
- Parents:
- 11d9630
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/clipboard.c
r11d9630 r8d6bcc8c 38 38 */ 39 39 40 #include <async.h> 40 41 #include <clipboard.h> 41 #include <ns.h> 42 #include <errno.h> 43 #include <fibril_synch.h> 44 #include <ipc/clipboard.h> 42 45 #include <ipc/services.h> 43 #include <ipc/clipboard.h> 44 #include <fibril_synch.h> 45 #include <async.h> 46 #include <loc.h> 47 #include <malloc.h> 46 48 #include <str.h> 47 #include <errno.h>48 #include <malloc.h>49 49 50 50 static FIBRIL_MUTEX_INITIALIZE(clip_mutex); … … 58 58 static async_exch_t *clip_exchange_begin(void) 59 59 { 60 service_id_t sid; 61 int rc; 62 60 63 fibril_mutex_lock(&clip_mutex); 61 64 62 while (clip_sess == NULL) 63 clip_sess = service_connect_blocking(SERVICE_CLIPBOARD, 64 INTERFACE_CLIPBOARD, 0); 65 while (clip_sess == NULL) { 66 rc = loc_service_get_id(SERVICE_NAME_CLIPBOARD, &sid, 67 IPC_FLAG_BLOCKING); 68 if (rc != EOK) 69 continue; 70 71 clip_sess = loc_service_connect(sid, INTERFACE_CLIPBOARD, 72 IPC_FLAG_BLOCKING); 73 } 65 74 66 75 fibril_mutex_unlock(&clip_mutex); -
uspace/lib/c/include/ipc/services.h
r11d9630 r8d6bcc8c 48 48 SERVICE_DEVMAN = FOURCC('d', 'e', 'v', 'n'), 49 49 SERVICE_IRC = FOURCC('i', 'r', 'c', ' '), 50 SERVICE_CLIPBOARD = FOURCC('c', 'l', 'i', 'p'),51 50 } service_t; 52 51 52 #define SERVICE_NAME_CLIPBOARD "clipboard" 53 53 #define SERVICE_NAME_CORECFG "corecfg" 54 54 #define SERVICE_NAME_DHCP "net/dhcp" -
uspace/srv/clipboard/clipboard.c
r11d9630 r8d6bcc8c 27 27 */ 28 28 29 #include <async.h> 30 #include <errno.h> 31 #include <fibril_synch.h> 32 #include <ipc/services.h> 33 #include <ipc/clipboard.h> 34 #include <loc.h> 35 #include <malloc.h> 29 36 #include <stdio.h> 30 37 #include <stdbool.h> 31 #include <async.h> 32 #include <ns.h> 33 #include <ipc/services.h> 34 #include <ipc/clipboard.h> 35 #include <malloc.h> 36 #include <fibril_synch.h> 37 #include <errno.h> 38 #include <task.h> 38 39 39 40 #define NAME "clipboard" … … 43 44 static clipboard_tag_t clip_tag = CLIPBOARD_TAG_NONE; 44 45 static FIBRIL_MUTEX_INITIALIZE(clip_mtx); 46 static service_id_t svc_id; 45 47 46 48 static void clip_put_data(ipc_callid_t rid, ipc_call_t *request) … … 179 181 int main(int argc, char *argv[]) 180 182 { 183 int rc; 184 181 185 printf("%s: HelenOS clipboard service\n", NAME); 182 183 186 async_set_fallback_port_handler(clip_connection, NULL); 184 int rc = service_register(SERVICE_CLIPBOARD); 185 if (rc != EOK) 187 188 rc = loc_server_register(NAME); 189 if (rc != EOK) { 190 printf("%s: Failed registering server. (%d)\n", NAME, rc); 186 191 return rc; 192 } 193 194 rc = loc_service_register(SERVICE_NAME_CLIPBOARD, &svc_id); 195 if (rc != EOK) { 196 printf("%s: Failed registering service. (%d)\n", NAME, rc); 197 return rc; 198 } 187 199 188 200 printf("%s: Accepting connections\n", NAME);
Note:
See TracChangeset
for help on using the changeset viewer.