minor improvements

This commit is contained in:
Unbit
2013-09-14 08:43:09 +02:00
parent 6056b51653
commit fba82c203c
5 changed files with 37 additions and 1 deletions
+18
View File
@@ -1958,3 +1958,21 @@ void uwsgi_tcp_nodelay(int fd) {
#endif
}
int uwsgi_accept(int server_fd) {
struct sockaddr_un client_src;
memset(&client_src, 0, sizeof(struct sockaddr_un));
socklen_t client_src_len = 0;
#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL)
return accept4(server_fd, (struct sockaddr *) &client_src, &client_src_len, SOCK_NONBLOCK);
#elif defined(__linux__)
int client_fd = accept(server_fd, (struct sockaddr *) &client_src, &client_src_len);
if (client_fd >= 0) {
uwsgi_socket_nb(client_fd);
}
return client_fd;
#else
return accept(server_fd, (struct sockaddr *) &client_src, &client_src_len);
#endif
}
+7
View File
@@ -543,6 +543,13 @@ void uwsgi_as_root() {
}
}
int i;
for (i = 0; i < uwsgi.gp_cnt; i++) {
if (uwsgi.gp[i]->post_jail) {
uwsgi.gp[i]->post_jail();
}
}
}
if (uwsgi.chroot && !uwsgi.reloads) {
+1 -1
View File
@@ -2374,7 +2374,7 @@ int uwsgi_start(void *v_argv) {
uwsgi_foreach(usl, uwsgi.call_in_jail) {
if (uwsgi_call_symbol(usl->value)) {
uwsgi_log("unaable to call function \"%s\"\n", usl->value);
uwsgi_log("unable to call function \"%s\"\n", usl->value);
exit(1);
}
}
+8
View File
@@ -118,6 +118,14 @@ static void *uwsgi_pty_loop(void *arg) {
if client is ready we have something to write to the master pty
*/
// block signals on this thread
sigset_t smask;
sigfillset(&smask);
#ifndef UWSGI_DEBUG
sigdelset(&smask, SIGSEGV);
#endif
pthread_sigmask(SIG_BLOCK, &smask, NULL);
for(;;) {
char buf[8192];
int interesting_fd = -1;
+3
View File
@@ -1003,6 +1003,7 @@ struct uwsgi_plugin {
uint16_t(*rpc) (void *, uint8_t, char **, uint16_t *, char *);
void (*jail) (int (*)(void *), char **);
void (*post_jail) (void);
void (*before_privileges_drop) (void);
int (*mule) (char *);
@@ -4293,6 +4294,8 @@ void uwsgi_log_encoders_register_embedded(void);
void uwsgi_register_log_encoder(char *, char *(*)(struct uwsgi_log_encoder *, char *, size_t, size_t *));
int uwsgi_accept(int);
#ifdef __cplusplus
}
#endif