NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Why is locking this process with a only pthread



I am debuging a problem with the X server, and it deadlocks with a
printf that I have added. gdb shows only on thread running.

Do you know how is it possible? My programming knowledge about
pthreads programming is near to zero (it coulde be a simple mistake).

The process is taking all the cpu.

(gdb) info threads
  Id   Target Id         Frame
* 1    LWP 1             0x00007f7ff4a0b456 in ?? () from
/usr/lib/libpthread.so.1
(gdb) bt
#0  0x00007f7ff4a0b456 in ?? () from /usr/lib/libpthread.so.1
#1  0x00007f7ff4a0b497 in ?? () from /usr/lib/libpthread.so.1
#2  0x00007f7ff4a0b73b in ?? () from /usr/lib/libpthread.so.1
#3  0x00007f7ff4a0aa53 in pthread_setcancelstate () from
/usr/lib/libpthread.so.1
#4  0x00007f7ff430de2a in __flockfile_internal () from /usr/lib/libc.so.12
#5  0x00007f7ff42bcea2 in vfprintf () from /usr/lib/libc.so.12
#6  0x00007f7ff42c117a in fprintf () from /usr/lib/libc.so.12
#7  0x00007f7ff5805761 in drmIoctl () from /usr/X11R7/lib/libdrm.so.3
#8  0x00007f7ff5803ff2 in drmModeMoveCursor () from /usr/X11R7/lib/libdrm.so.3
#9  0x0000000000496e2a in ?? ()
#10 0x00000000004d1ea5 in ?? ()
#11 0x00000000004d28f0 in miPointerSetPosition ()
#12 0x0000000000440dd2 in GetPointerEvents ()
#13 0x000000000047de4f in xf86PostMotionEventM ()
#14 0x000000000047dfdc in xf86PostMotionEvent ()
#15 0x00007f7fef606a05 in ?? () from /usr/X11R7/lib/modules/drivers/mouse_drv.so
#16 0x00007f7fef6070a9 in ?? () from /usr/X11R7/lib/modules/drivers/mouse_drv.so
#17 0x00007f7fef607a2f in ?? () from /usr/X11R7/lib/modules/drivers/mouse_drv.so
#18 0x0000000000471086 in ?? ()
#19 0x000000000048a4e0 in ?? ()
#20 0x00007f7ff429f440 in opendir () from /usr/lib/libc.so.12
#21 0x00007fff00000017 in ?? ()
#22 0x0000000000000000 in ?? ()
(gdb)

And this is the relevant code: (it is inside of libdrm library, file xf86drm.c):
( I added some printfs
int
drmIoctl(int fd, unsigned long request, void *arg)
{
    int ret;
    FILE *fd_log;
    int try,try_eintr,try_eagain;
    int by_ten;

    try=0;
    try_eintr=0;
    try_eagain=0;
    by_ten=1;

    fd_log=fopen("/log.ioctl","a");
    fprintf(fd_log,"fd: %d, request: %lu",fd,request);
    fflush(fd_log);
    do {
        ret = ioctl(fd, request, arg);
        if (ret == -1 && (errno == EINTR || errno == EAGAIN))
        {
                try++;
                if (errno == EINTR ) try_eintr++;
                if (errno == EAGAIN ) try_eagain++;
                if (try == by_ten) {
                        fprintf(fd_log," ei:%d,ea:%d",try_eintr,try_eagain);
                        fflush(fd_log);
                        by_ten=by_ten*10;
                }
        }
    } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
    fprintf(fd_log,"\n");
    fclose(fd_log);
    return ret;
}


Home | Main Index | Thread Index | Old Index