gdb/259: Thread receives Interrupted System Call error while waiting on message queue.

lkiss@deltaprime.com lkiss@deltaprime.com
Fri Oct 26 05:18:00 GMT 2001


>Number:         259
>Category:       gdb
>Synopsis:       Thread receives Interrupted System Call error while waiting on message queue.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 14 09:58:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Laszlo Kiss
>Release:        gdb-5.1-1
>Organization:
>Environment:
Red Hat 7.2
All updates applied as of 12/12/01.
>Description:
If a thread is waiting on a message queue and another thread
is created (say in the main thread) the msgrcv() function
returns with an error code of EINTR.

This appears to be the case only while the program is under
gdb's control.
>How-To-Repeat:
Compile enclosed file with:
cc -g -Wall -Wno-unused -o qtest qtest.c -lpthread

Run from command line.
Run from within gdb.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="qtest.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="qtest.c"

I2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHVuaXN0ZC5o
PgojaW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDxwdGhyZWFkLmg+CiNpbmNsdWRlIDxlcnJu
by5oPgojaW5jbHVkZSA8dGhyZWFkX2RiLmg+CiNpbmNsdWRlIDxzaWduYWwuaD4KI2luY2x1ZGUg
PHN5cy9pcGMuaD4KI2luY2x1ZGUgPHN5cy9tc2cuaD4KCgppbnQgSW5wdXRRdWVLZXk7CmNoYXIg
SW5wdXRRdWVLZXlUb2tlbiA9ICdwJzsKaW50IElucHV0UXVlOwoKdm9pZCAqIHQxKCB2b2lkICph
cmcgKQp7CiAgIHN0cnVjdCBfbXNnIHsKICAgICAgaW50IG10eXBlOwogICAgICBjaGFyIG10ZXh0
WzFdOwogICB9IG1zZzsKCiAgIGludCBzdGF0dXM7CgogICBtc2cubXR5cGUgPSAxOwogICBzdGF0
dXMgPSBtc2dzbmQoIElucHV0UXVlLCAmbXNnLCBzaXplb2YoIG1zZyApLCAwICk7CiAgIGlmICgg
c3RhdHVzIDwgMCApCiAgIHsKICAgICAgcHJpbnRmKCJ0MSBmYWlsZWQgc2VuZFxuIik7CiAgICAg
IHByaW50ZigiZXJybm8gPSAlZCwgJXNcbiIsZXJybm8sIHN0cmVycm9yKCBlcnJubyApICk7CiAg
ICAgIHJldHVybiAwOwogICB9CiAgICAgIAogICByZXR1cm4gTlVMTDsKfQoKCnZvaWQgKiB0Migg
dm9pZCAqYXJnICkKewogICBzdHJ1Y3QgX21zZyB7CiAgICAgIGludCBtdHlwZTsKICAgICAgY2hh
ciBtdGV4dFsxXTsKICAgfSBtc2c7CgogICBpbnQgc3RhdHVzOwogICBpbnQgc2lnOwoKICByZXRy
eToKICAgc3RhdHVzID0gbXNncmN2KCBJbnB1dFF1ZSwgJm1zZywgc2l6ZW9mKCBtc2cgKSwgMCwg
MCApOwogICBpZiAoIHN0YXR1cyA8IDAgKQogIHsKICAgICAgcHJpbnRmKCJ0MiBmYWlsZWQgcmVj
dlxuIik7CiAgICAgIHByaW50ZigiZXJybm8gPSAlZCwgJXNcbiIsZXJybm8sIHN0cmVycm9yKCBl
cnJubyApICk7CiAgICAgIGlmICggZXJybm8gPT0gRUlOVFIgKQogICAgICB7CiAgICAgICAgIHBy
aW50ZigicmV0cnlpbmcuLi5cbiIpOwogICAgICAgICBnb3RvIHJldHJ5OwogICAgICB9CiAgICAg
IHJldHVybiAwOwogICB9CiAgIGVsc2UKICAgewogICAgICBwcmludGYoIioqKiBtZXNzYWdlIHJl
Y2VpdmVkICoqKlxuIik7CiAgIH0KCiAgIHJldHVybiBOVUxMOwp9CgoKaW50Cm1haW4oIGludCBh
cmdjLCBjaGFyICoqYXJndiApCnsKICAgc3RhdGljIGNvbnN0IGNoYXIgKmZ1bmN0aW9uID0gIl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tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tCiAgICAgICovCiAgIGlmICgoIHJlc3VsdCA9IHB0aHJlYWRfY3JlYXRlKCZUMSwwLHQx
LE5VTEwpKSAhPSAwICkgewogICAgICBmcHJpbnRmKHN0ZGVyciwiJTIwczogVDEgRmFpbGVkXG4i
LCBmdW5jdGlvbiApOwogICAgICBmcHJpbnRmKHN0ZGVyciwiJTIwczogRXhpdGluZy5cbiIsIGZ1
bmN0aW9uICk7CiAgICAgIGV4aXQoMCk7CiAgIH0KCiAgIHNsZWVwKCAyICk7CgoKICAgLyogQ2xv
c2UgdGhlIG1lc3NhZ2UgcWlkIGRlc2NyaXB0b3JzICoqKioqKioqKioqKioqKioqKioqKioqKi8K
ICAgY2xvc2UoIElucHV0UXVlICk7CgogICAvKiBFeGl0IHRoaXMgcHJvY2VzcyAqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwogICByZXR1cm4gMDsKfQoKCg==



More information about the Gdb-prs mailing list