mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Support daemon(fork twice) for Darwin/OSX. v5.0.18
This commit is contained in:
parent
7fd5e8607c
commit
596dd8c523
3 changed files with 22 additions and 1 deletions
20
trunk/3rdparty/st-srs/event.c
vendored
20
trunk/3rdparty/st-srs/event.c
vendored
|
@ -98,6 +98,7 @@ static struct _st_kqdata {
|
||||||
int dellist_size;
|
int dellist_size;
|
||||||
int dellist_cnt;
|
int dellist_cnt;
|
||||||
int kq;
|
int kq;
|
||||||
|
pid_t pid;
|
||||||
} *_st_kq_data;
|
} *_st_kq_data;
|
||||||
|
|
||||||
#ifndef ST_KQ_MIN_EVTLIST_SIZE
|
#ifndef ST_KQ_MIN_EVTLIST_SIZE
|
||||||
|
@ -463,6 +464,7 @@ ST_HIDDEN int _st_kq_init(void)
|
||||||
goto cleanup_kq;
|
goto cleanup_kq;
|
||||||
}
|
}
|
||||||
fcntl(_st_kq_data->kq, F_SETFD, FD_CLOEXEC);
|
fcntl(_st_kq_data->kq, F_SETFD, FD_CLOEXEC);
|
||||||
|
_st_kq_data->pid = getpid();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate file descriptor data array.
|
* Allocate file descriptor data array.
|
||||||
|
@ -698,6 +700,7 @@ ST_HIDDEN void _st_kq_dispatch(void)
|
||||||
tsp = &timeout;
|
tsp = &timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retry_kevent:
|
||||||
/* Check for I/O operations */
|
/* Check for I/O operations */
|
||||||
nfd = kevent(_st_kq_data->kq,
|
nfd = kevent(_st_kq_data->kq,
|
||||||
_st_kq_data->addlist, _st_kq_data->addlist_cnt,
|
_st_kq_data->addlist, _st_kq_data->addlist_cnt,
|
||||||
|
@ -791,6 +794,23 @@ ST_HIDDEN void _st_kq_dispatch(void)
|
||||||
osfd = _st_kq_data->evtlist[i].ident;
|
osfd = _st_kq_data->evtlist[i].ident;
|
||||||
_ST_KQ_REVENTS(osfd) = 0;
|
_ST_KQ_REVENTS(osfd) = 0;
|
||||||
}
|
}
|
||||||
|
} else if (nfd < 0) {
|
||||||
|
if (errno == EBADF && _st_kq_data->pid != getpid()) {
|
||||||
|
/* We probably forked, reinitialize kqueue */
|
||||||
|
if ((_st_kq_data->kq = kqueue()) < 0) {
|
||||||
|
/* There is nothing we can do here, will retry later */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fcntl(_st_kq_data->kq, F_SETFD, FD_CLOEXEC);
|
||||||
|
_st_kq_data->pid = getpid();
|
||||||
|
/* Re-register all descriptors on ioq with new kqueue */
|
||||||
|
memset(_st_kq_data->fd_data, 0, _st_kq_data->fd_data_size * sizeof(_kq_fd_data_t));
|
||||||
|
for (q = _ST_IOQ.next; q != &_ST_IOQ; q = q->next) {
|
||||||
|
pq = _ST_POLLQUEUE_PTR(q);
|
||||||
|
_st_kq_pollset_add(pq->pds, pq->npds);
|
||||||
|
}
|
||||||
|
goto retry_kevent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ The changelog for SRS.
|
||||||
|
|
||||||
## SRS 5.0 Changelog
|
## SRS 5.0 Changelog
|
||||||
|
|
||||||
|
* v5.0, 2021-10-17, Support daemon(fork twice) for Darwin/OSX [ST#23](https://github.com/ossrs/state-threads/issues/23). v5.0.18
|
||||||
* v5.0, 2021-10-16, DVR: support mp3 audio codec. (#2593) v5.0.17
|
* v5.0, 2021-10-16, DVR: support mp3 audio codec. (#2593) v5.0.17
|
||||||
* v5.0, 2021-10-03, OpenWRT: Disable mprotect of ST. 5.0.16
|
* v5.0, 2021-10-03, OpenWRT: Disable mprotect of ST. 5.0.16
|
||||||
* v5.0, 2021-10-03, Actions: Create source tar lik srs-server-5.0.14.tar.gz
|
* v5.0, 2021-10-03, Actions: Create source tar lik srs-server-5.0.14.tar.gz
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
|
|
||||||
#define VERSION_MAJOR 5
|
#define VERSION_MAJOR 5
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 17
|
#define VERSION_REVISION 18
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue