static int tcp_get_msgfds(CharDriverState *chr, int *fds, int num)
{
    TCPCharDriver *s = chr->opaque;
    int to_copy = (s->read_msgfds_num < num) ? s->read_msgfds_num : num;
    if (to_copy) {
        memcpy(fds, s->read_msgfds, to_copy * sizeof(int));
        g_free(s->read_msgfds);
        s->read_msgfds = 0;
        s->read_msgfds_num = 0;
    return to_copy;
static int tcp_get_msgfds(CharDriverState *chr, int *fds, int num)
{
    TCPCharDriver *s = chr->opaque;
    int to_copy = (s->read_msgfds_num < num) ? s->read_msgfds_num : num;
    if (to_copy) {
        memcpy(fds, s->read_msgfds, to_copy * sizeof(int));
        g_free(s->read_msgfds);
        s->read_msgfds = 0;
        s->read_msgfds_num = 0;
    return to_copy;
static int FUNC_0(CharDriverState *VAR_0, int *VAR_1, int VAR_2)
{
    TCPCharDriver *s = VAR_0->opaque;
    int VAR_3 = (s->read_msgfds_num < VAR_2) ? s->read_msgfds_num : VAR_2;
    if (VAR_3) {
        memcpy(VAR_1, s->read_msgfds, VAR_3 * sizeof(int));
        g_free(s->read_msgfds);
        s->read_msgfds = 0;
        s->read_msgfds_num = 0;
    return VAR_3;
static int FUNC_0(CharDriverState *VAR_0, int *VAR_1, int VAR_2)
{ TCPCharDriver *s = VAR_0->opaque; int VAR_3 = (s->read_msgfds_num < VAR_2) ? s->read_msgfds_num : VAR_2; if (VAR_3) { memcpy(VAR_1, s->read_msgfds, VAR_3 * sizeof(int)); g_free(s->read_msgfds); s->read_msgfds = 0; s->read_msgfds_num = 0; return VAR_3;