1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
|
/* Create listening socket */
fd = filed_listen(bind_addr, port);
if (fd < 0) {
perror("filed_listen");
return(1);
}
/* Chroot, if appropriate */
if (newroot) {
chdir_ret = chdir(newroot);
if (chdir_ret != 0) {
perror("chdir");
|
>
>
>
>
>
>
>
>
>
>
|
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
|
/* Create listening socket */
fd = filed_listen(bind_addr, port);
if (fd < 0) {
perror("filed_listen");
return(1);
}
/* Become a daemon */
if (daemon_enabled) {
init_ret = filed_daemonize();
if (init_ret != 0) {
perror("filed_daemonize");
return(6);
}
}
/* Chroot, if appropriate */
if (newroot) {
chdir_ret = chdir(newroot);
if (chdir_ret != 0) {
perror("chdir");
|
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
|
if (setuid_ret != 0) {
perror("setuid");
return(1);
}
}
/* Become a daemon */
if (daemon_enabled) {
filed_daemonize();
}
/* Initialize */
init_ret = filed_init(cache_size);
if (init_ret != 0) {
perror("filed_init");
return(3);
}
|
<
<
<
<
<
|
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
|
if (setuid_ret != 0) {
perror("setuid");
return(1);
}
}
/* Initialize */
init_ret = filed_init(cache_size);
if (init_ret != 0) {
perror("filed_init");
return(3);
}
|
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
|
}
/* Create worker threads */
init_ret = filed_worker_threads_init(fd, thread_count);
if (init_ret != 0) {
perror("filed_worker_threads_init");
return(4);
}
/* Wait for threads to exit */
/* XXX:TODO: Monitor thread usage */
while (1) {
sleep(60);
}
/* Return in failure */
return(2);
}
|
|
|
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
|
}
/* Create worker threads */
init_ret = filed_worker_threads_init(fd, thread_count);
if (init_ret != 0) {
perror("filed_worker_threads_init");
return(5);
}
/* Wait for threads to exit */
/* XXX:TODO: Monitor thread usage */
while (1) {
sleep(60);
}
/* Return in failure */
return(2);
}
|