summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2009-08-04 00:42:40 +0200
committerGravatar Nikias Bassen2009-08-04 00:42:40 +0200
commitf6ee6302f7d87294b7175b4b639b293aafb80424 (patch)
tree9da4a0b057c287fd0e3f168765e5aa46aeda299e
parentbfdcd3a071fb73ac43715a2900db292f88d7cc47 (diff)
downloadusbmuxd-f6ee6302f7d87294b7175b4b639b293aafb80424.tar.gz
usbmuxd-f6ee6302f7d87294b7175b4b639b293aafb80424.tar.bz2
Revert "Add udev mode of operation"
This reverts commit b7d4f48d7e85c43f0dd1111619acf79aba535371. Not working as expected.
-rw-r--r--src/main.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/main.c b/src/main.c
index de68242..ee633b6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -58,7 +58,6 @@ static int verbose = DEBUG_LEVEL;
58static int foreground = 0; 58static int foreground = 0;
59static int exit_on_no_devices = 0; 59static int exit_on_no_devices = 0;
60static int drop_privileges = 0; 60static int drop_privileges = 0;
61static int udev = 0;
62 61
63struct device_info { 62struct device_info {
64 uint32_t device_id; 63 uint32_t device_id;
@@ -1031,7 +1030,6 @@ static void usage()
1031 printf("\t-f|--foreground do not daemonize\n"); 1030 printf("\t-f|--foreground do not daemonize\n");
1032 printf("\t-e|--exit-on-no-devices exit if no device is attached\n"); 1031 printf("\t-e|--exit-on-no-devices exit if no device is attached\n");
1033 printf("\t-d|--drop-privileges drop privileges after startup\n"); 1032 printf("\t-d|--drop-privileges drop privileges after startup\n");
1034 printf("\t-u|--udev use udev mode of operations\n");
1035 printf("\n"); 1033 printf("\n");
1036} 1034}
1037 1035
@@ -1043,13 +1041,12 @@ static void parse_opts(int argc, char **argv)
1043 {"verbose", 0, NULL, 'v'}, 1041 {"verbose", 0, NULL, 'v'},
1044 {"exit-on-no-devices", 0, NULL, 'e'}, 1042 {"exit-on-no-devices", 0, NULL, 'e'},
1045 {"drop-privileges", 0, NULL, 'd'}, 1043 {"drop-privileges", 0, NULL, 'd'},
1046 {"udev", 0, NULL, 'u'},
1047 {NULL, 0, NULL, 0} 1044 {NULL, 0, NULL, 0}
1048 }; 1045 };
1049 int c; 1046 int c;
1050 1047
1051 while (1) { 1048 while (1) {
1052 c = getopt_long(argc, argv, "hfvedu", longopts, (int *) 0); 1049 c = getopt_long(argc, argv, "hfved", longopts, (int *) 0);
1053 if (c == -1) { 1050 if (c == -1) {
1054 break; 1051 break;
1055 } 1052 }
@@ -1070,17 +1067,11 @@ static void parse_opts(int argc, char **argv)
1070 case 'd': 1067 case 'd':
1071 drop_privileges = 1; 1068 drop_privileges = 1;
1072 break; 1069 break;
1073 case 'u':
1074 udev = 1;
1075 break;
1076 default: 1070 default:
1077 usage(); 1071 usage();
1078 exit(2); 1072 exit(2);
1079 } 1073 }
1080 } 1074 }
1081
1082 if (udev)
1083 foreground = 0;
1084} 1075}
1085 1076
1086/** 1077/**
@@ -1182,12 +1173,9 @@ int main(int argc, char **argv)
1182 fcntl(fileno(lfd), F_GETLK, &lock); 1173 fcntl(fileno(lfd), F_GETLK, &lock);
1183 fclose(lfd); 1174 fclose(lfd);
1184 if (lock.l_type != F_UNLCK) { 1175 if (lock.l_type != F_UNLCK) {
1185 if (!udev) { 1176 logmsg(LOG_NOTICE,
1186 logmsg(LOG_NOTICE, 1177 "another instance is already running. exiting.");
1187 "another instance is already running. exiting."); 1178 return -1;
1188 return -1;
1189 }
1190 return 0;
1191 } 1179 }
1192 } 1180 }
1193 1181
@@ -1277,7 +1265,6 @@ int main(int argc, char **argv)
1277 if (result <= 0) { 1265 if (result <= 0) {
1278 if (result == 0) { 1266 if (result == 0) {
1279 // cleanup 1267 // cleanup
1280 int num_children = 0;
1281 for (i = 0; i < children_capacity; i++) { 1268 for (i = 0; i < children_capacity; i++) {
1282 if (children[i]) { 1269 if (children[i]) {
1283 if (children[i]->dead != 0) { 1270 if (children[i]->dead != 0) {
@@ -1290,7 +1277,6 @@ int main(int argc, char **argv)
1290 children[i] = NULL; 1277 children[i] = NULL;
1291 cnt++; 1278 cnt++;
1292 } else { 1279 } else {
1293 num_children++;
1294 cnt = 0; 1280 cnt = 0;
1295 } 1281 }
1296 } else { 1282 } else {
@@ -1298,9 +1284,6 @@ int main(int argc, char **argv)
1298 } 1284 }
1299 } 1285 }
1300 1286
1301 if (num_children == 0 && udev)
1302 break;
1303
1304 if ((children_capacity > DEFAULT_CHILDREN_CAPACITY) 1287 if ((children_capacity > DEFAULT_CHILDREN_CAPACITY)
1305 && ((children_capacity - cnt) <= 1288 && ((children_capacity - cnt) <=
1306 DEFAULT_CHILDREN_CAPACITY)) { 1289 DEFAULT_CHILDREN_CAPACITY)) {