mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 06:50:10 +01:00
libnm-glib-aux: add nm_utils_get_process_exit_status_desc()
(cherry picked from commit 517852dccd)
This commit is contained in:
parent
3c96d4bb59
commit
227c5ca305
2 changed files with 21 additions and 0 deletions
|
|
@ -6306,3 +6306,20 @@ nm_crypto_md5_hash(const guint8 *salt,
|
|||
g_checksum_update(ctx, digest.ptr, NM_UTILS_CHECKSUM_LENGTH_MD5);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
char *
|
||||
nm_utils_get_process_exit_status_desc(int status)
|
||||
{
|
||||
if (WIFEXITED(status))
|
||||
return g_strdup_printf("exited with status %d", WEXITSTATUS(status));
|
||||
else if (WIFSIGNALED(status))
|
||||
return g_strdup_printf("killed by signal %d", WTERMSIG(status));
|
||||
else if (WIFSTOPPED(status))
|
||||
return g_strdup_printf("stopped by signal %d", WSTOPSIG(status));
|
||||
else if (WIFCONTINUED(status))
|
||||
return g_strdup("resumed by SIGCONT)");
|
||||
else
|
||||
return g_strdup_printf("exited with unknown status 0x%x", status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2932,4 +2932,8 @@ void nm_crypto_md5_hash(const guint8 *salt,
|
|||
guint8 * buffer,
|
||||
gsize buflen);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
char *nm_utils_get_process_exit_status_desc(int status);
|
||||
|
||||
#endif /* __NM_SHARED_UTILS_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue