This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb.base/info-os.c: clean up SysV IPC on error
- From: "Maciej W. Rozycki" <macro at linux-mips dot org>
- To: Don Breazeal <donb at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 31 Jan 2015 11:55:57 +0000 (GMT)
- Subject: Re: [PATCH] gdb.base/info-os.c: clean up SysV IPC on error
- Authentication-results: sourceware.org; auth=none
- References: <1422637464-20419-1-git-send-email-donb at codesourcery dot com>
Don,
> We have noticed here that over time some of our test systems accumulate
> stale System V IPC resources. At least some of this is due to a GDB test
> program, gdb.base/info-os.c. The program doesn't clean up any allocated
> IPC objects when an error occurs. System V IPC objects will stay around
> forever unless they are explicitly removed (or until a reboot).
>
> This patch puts the IPC cleanup code into a function and calls the
> function everywhere that a fatal error can occur, as well as at
> successful termination.
Use `atexit' to run `ipc_cleanup' automagically instead maybe? This way
you won't have to run the function manually at each exit point and also it
won't be missed on any future updates.
Just a thought if you want to experiment with it, there's nothing really
wrong with your proposal as it stands.
Maciej