From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 2/6] [gdb/testsuite] Improve variable names in lock_file_{acquire, release}
Date: Tue, 29 Sep 2026 13:09:17 +0200 [thread overview]
Message-ID: <20260929110921.1910094-2-tdevries@suse.de> (raw)
In-Reply-To: <20260929110921.1910094-1-tdevries@suse.de>
In lock_file_acquire we assign the result of a call to proc open to a variable
called rc.
Use fh for file handle instead.
Then use the variable names fh and lockfile as used in lock_file_acquire in
lock_file_release.
---
gdb/testsuite/lib/gdb-utils.exp | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
index 5d6165f9ba3..56d8e80f152 100644
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -188,14 +188,14 @@ proc lock_file_acquire {lockfile} {
while {true} {
try {
open $lockfile {WRONLY CREAT EXCL}
- } on ok {rc} {
+ } on ok {fh} {
set msg "locked by $::subdir/${::gdb_test_file_name}.exp"
verbose -log "lock file: $msg"
# For debugging, put info in the lockfile about who owns
# it.
- puts $rc $msg
- flush $rc
- return [list $rc $lockfile]
+ puts $fh $msg
+ flush $fh
+ return [list $fh $lockfile]
} on error {} {
# Ignore and try again.
}
@@ -208,17 +208,20 @@ proc lock_file_acquire {lockfile} {
proc lock_file_release {info} {
verbose -log "releasing lock file: $::subdir/${::gdb_test_file_name}.exp"
+ set fh [lindex $info 0]
+ set lockfile [lindex $info 1]
+
try {
- fconfigure [lindex $info 0]
+ fconfigure $fh
} on error {} {
error "invalid lock"
}
try {
- close [lindex $info 0]
- file delete -force [lindex $info 1]
- } on error {rc} {
- error "Error releasing lockfile: '$rc'"
+ close $fh
+ file delete -force $lockfile
+ } on error {err_msg} {
+ error "Error releasing lockfile: '$err_msg'"
}
return ""
--
2.51.0
next prev parent reply other threads:[~2026-09-29 11:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 11:09 [PATCH v2 1/6] [gdb/testsuite] Add gdb.testsuite/lock.exp Tom de Vries
2026-09-29 11:09 ` Tom de Vries [this message]
2026-09-29 11:09 ` [PATCH v2 3/6] [gdb/testsuite] Simplify lock_file_acquire Tom de Vries
2026-09-29 11:09 ` [PATCH v2 4/6] [gdb/testsuite] Only retry on EEXIST in lock_file_acquire Tom de Vries
2026-09-29 11:09 ` [PATCH v2 5/6] [gdb/testsuite] Extend gdb.testsuite/lock.exp Tom de Vries
2026-09-29 11:09 ` [PATCH v2 6/6] [gdb/testsuite] Extend gdb.testsuite/lock.exp a bit more Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260929110921.1910094-2-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox