summaryrefslogtreecommitdiff
path: root/src/bin/e_ipc.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2013-01-11 10:34:29 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2013-01-11 10:34:29 +0000
commit9e8e755cdf37a22c1a1ab48e0abf21a1d8450563 (patch)
tree372d924eb663ce0e4a71faaa23b2cc3e37b5edaf /src/bin/e_ipc.c
parent845ba1ba12d3338f9ff837bf71c657fb2346cf99 (diff)
formatting: all at once
SVN revision: 82625
Diffstat (limited to 'src/bin/e_ipc.c')
-rw-r--r--src/bin/e_ipc.c136
1 files changed, 69 insertions, 67 deletions
diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c
index c616c0f..8501958 100644
--- a/src/bin/e_ipc.c
+++ b/src/bin/e_ipc.c
@@ -27,12 +27,12 @@ e_ipc_init(void)
27 if (tmp) base = tmp; 27 if (tmp) base = tmp;
28 tmp = getenv("SD_USER_SOCKETS_DIR"); 28 tmp = getenv("SD_USER_SOCKETS_DIR");
29 if (tmp) base = tmp; 29 if (tmp) base = tmp;
30 30
31 user = getenv("USER"); 31 user = getenv("USER");
32 if (!user) 32 if (!user)
33 { 33 {
34 int uidint; 34 int uidint;
35 35
36 user = "__unknown__"; 36 user = "__unknown__";
37 uidint = getuid(); 37 uidint = getuid();
38 if (uidint >= 0) 38 if (uidint >= 0)
@@ -41,31 +41,31 @@ e_ipc_init(void)
41 user = buf2; 41 user = buf2;
42 } 42 }
43 } 43 }
44 44
45 disp = getenv("DISPLAY"); 45 disp = getenv("DISPLAY");
46 if (!disp) disp = ":0"; 46 if (!disp) disp = ":0";
47 47
48 e_util_env_set("E_IPC_SOCKET", ""); 48 e_util_env_set("E_IPC_SOCKET", "");
49 49
50 pid = (int)getpid(); 50 pid = (int)getpid();
51 for (trynum = 0; trynum <= 4096; trynum++) 51 for (trynum = 0; trynum <= 4096; trynum++)
52 { 52 {
53 struct stat st; 53 struct stat st;
54 int id1 = 0; 54 int id1 = 0;
55 55
56 snprintf(buf, sizeof(buf), "%s/e-%s@%x", 56 snprintf(buf, sizeof(buf), "%s/e-%s@%x",
57 base, user, id1); 57 base, user, id1);
58 mkdir(buf, S_IRWXU); 58 mkdir(buf, S_IRWXU);
59 if (stat(buf, &st) == 0) 59 if (stat(buf, &st) == 0)
60 { 60 {
61 if ((st.st_uid == getuid()) && 61 if ((st.st_uid == getuid()) &&
62 ((st.st_mode & (S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)) == 62 ((st.st_mode & (S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)) ==
63 (S_IRWXU | S_IFDIR))) 63 (S_IRWXU | S_IFDIR)))
64 { 64 {
65 snprintf(buf3, sizeof(buf3), "%s/%s-%i", 65 snprintf(buf3, sizeof(buf3), "%s/%s-%i",
66 buf, disp, pid); 66 buf, disp, pid);
67 _e_ipc_server = ecore_ipc_server_add 67 _e_ipc_server = ecore_ipc_server_add
68 (ECORE_IPC_LOCAL_SYSTEM, buf3, 0, NULL); 68 (ECORE_IPC_LOCAL_SYSTEM, buf3, 0, NULL);
69 if (_e_ipc_server) break; 69 if (_e_ipc_server) break;
70 } 70 }
71 } 71 }
@@ -146,50 +146,50 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
146 switch (e->minor) 146 switch (e->minor)
147 { 147 {
148 case E_IPC_OP_EXEC_ACTION: 148 case E_IPC_OP_EXEC_ACTION:
149 { 149 {
150 E_Ipc_2Str *req = NULL; 150 E_Ipc_2Str *req = NULL;
151 151
152 if (e_ipc_codec_2str_dec(e->data, e->size, &req)) 152 if (e_ipc_codec_2str_dec(e->data, e->size, &req))
153 { 153 {
154 Eina_List *m = e_manager_list(); 154 Eina_List *m = e_manager_list();
155 int len, ok = 0; 155 int len, ok = 0;
156 void *d; 156 void *d;
157 157
158 if (m) 158 if (m)
159 { 159 {
160 E_Manager *man = eina_list_data_get(m); 160 E_Manager *man = eina_list_data_get(m);
161 161
162 if (man) 162 if (man)
163 { 163 {
164 E_Action *act = e_action_find(req->str1); 164 E_Action *act = e_action_find(req->str1);
165 165
166 if ((act) && (act->func.go)) 166 if ((act) && (act->func.go))
167 { 167 {
168 act->func.go(E_OBJECT(man), req->str2); 168 act->func.go(E_OBJECT(man), req->str2);
169 ok = 1; 169 ok = 1;
170 } 170 }
171 } 171 }
172 } 172 }
173 173
174 d = e_ipc_codec_int_enc(ok, &len); 174 d = e_ipc_codec_int_enc(ok, &len);
175 if (d) 175 if (d)
176 { 176 {
177 ecore_ipc_client_send(e->client, 177 ecore_ipc_client_send(e->client,
178 E_IPC_DOMAIN_REPLY, 178 E_IPC_DOMAIN_REPLY,
179 E_IPC_OP_EXEC_ACTION_REPLY, 179 E_IPC_OP_EXEC_ACTION_REPLY,
180 0, 0, 0, d, len); 180 0, 0, 0, d, len);
181 free(d); 181 free(d);
182 } 182 }
183 183
184 if (req) 184 if (req)
185 { 185 {
186 E_FREE(req->str1); 186 E_FREE(req->str1);
187 E_FREE(req->str2); 187 E_FREE(req->str2);
188 E_FREE(req); 188 E_FREE(req);
189 } 189 }
190 } 190 }
191 } 191 }
192 break; 192 break;
193 193
194 default: 194 default:
195 break; 195 break;
@@ -209,20 +209,22 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
209 break; 209 break;
210 210
211 case E_IPC_DOMAIN_ALERT: 211 case E_IPC_DOMAIN_ALERT:
212 { 212 {
213 switch (e->minor) 213 switch (e->minor)
214 { 214 {
215 case E_ALERT_OP_RESTART: 215 case E_ALERT_OP_RESTART:
216 if (getenv("E_START_MTRACK")) 216 if (getenv("E_START_MTRACK"))
217 e_util_env_set("MTRACK", "track"); 217 e_util_env_set("MTRACK", "track");
218 ecore_app_restart(); 218 ecore_app_restart();
219 break; 219 break;
220 case E_ALERT_OP_EXIT: 220
221 exit(-11); 221 case E_ALERT_OP_EXIT:
222 break; 222 exit(-11);
223 } 223 break;
224 } 224 }
225 break; 225 }
226 break;
227
226 default: 228 default:
227 break; 229 break;
228 } 230 }