-
-/*
-
- LOCAL FUNCTION
-
- save_inferior_pid - Save inferior_pid on the cleanup list
- restore_inferior_pid - Restore inferior_pid from the cleanup list
-
- SYNOPSIS
-
- struct cleanup *save_inferior_pid (void);
- void restore_inferior_pid (void *saved_pid);
-
- DESCRIPTION
-
- These two functions act in unison to restore inferior_pid in
- case of an error.
-
- NOTES
-
- inferior_pid is a global variable that needs to be changed by many
- of these routines before calling functions in procfs.c. In order
- to guarantee that inferior_pid gets restored (in case of errors),
- you need to call save_inferior_pid before changing it. At the end
- of the function, you should invoke do_cleanups to restore it.
-
- */
-
-static struct cleanup *
-save_inferior_pid (void)
-{
-#if TARGET_PTR_BIT > TARGET_INT_BIT
- return make_cleanup (restore_inferior_pid, (void *) ((long) inferior_pid));
-#else
- return make_cleanup (restore_inferior_pid, (void *) inferior_pid);
-#endif
-}
-
-static void
-restore_inferior_pid (void *saved_pid)
-{
-#if TARGET_PTR_BIT > TARGET_INT_BIT
- inferior_pid = (int) ((long) saved_pid);
-#else
- inferior_pid = (int) saved_pid;
-#endif
-}
-