2017-11-18 19:09:20 +03:00
/* SPDX-License-Identifier: LGPL-2.1+ */
2010-08-20 05:26:37 +04:00
2015-06-18 10:00:01 +03:00
# include <signal.h>
2015-11-17 00:09:36 +03:00
# include <stdlib.h>
exit-status: list BSD exit codes too
Let's optionally translate BSD exit codes to error strings too.
My first approach on adding this was to turn ExitStatusLevel into a
bitmask rather than a linear level, with one bit for the various feature
bits. However, the exit code ranges are generally not defined
independently from each other, i.e. our own ones are defined with the
LSB ones in mind, and most sets are defined with the ISO C ones.
Hence, instead I changed the existing hierarchy of MINIMAL, SYSTEMD, LSB
with an alias of FULL == LSB, only slightly by seperating FULL and LSB
into two separate levels, so that there's now:
1. MINIMAL (only EXIT_SUCCESS/EXIT_FAILURE)
2. SYSTEMD (incorporating our own exit codes)
3. LSB (like SYSTEMD but adding in LSB service exit codes)
4. FULL (like FULL but adding BSD exit codes)
Note that across the codebase only FULL, SYSTEMD, and MINIMAL are used,
depending on context, how much we know about the process and whether we
are logging for debugging purposes or not. This means the LSB level
wouldn't really have to be separate, but it appeared careless to me to
fold it into FULL along with the BSD exit codes.
Note that this commit doesn't change much for regular codepaths: the
FULL exit status level is only used during debug logging, as a helper to
the user reading the debug logs.
2018-04-23 20:26:25 +03:00
# include <sysexits.h>
2010-08-20 05:26:37 +04:00
# include "exit-status.h"
2012-08-13 15:58:01 +04:00
# include "macro.h"
2019-07-28 11:19:53 +03:00
# include "parse-util.h"
2015-11-17 00:09:36 +03:00
# include "set.h"
2019-07-28 11:19:53 +03:00
# include "string-util.h"
2010-08-20 05:26:37 +04:00
2019-07-28 11:13:21 +03:00
const ExitStatusMapping exit_status_mappings [ 256 ] = {
exit-status: list BSD exit codes too
Let's optionally translate BSD exit codes to error strings too.
My first approach on adding this was to turn ExitStatusLevel into a
bitmask rather than a linear level, with one bit for the various feature
bits. However, the exit code ranges are generally not defined
independently from each other, i.e. our own ones are defined with the
LSB ones in mind, and most sets are defined with the ISO C ones.
Hence, instead I changed the existing hierarchy of MINIMAL, SYSTEMD, LSB
with an alias of FULL == LSB, only slightly by seperating FULL and LSB
into two separate levels, so that there's now:
1. MINIMAL (only EXIT_SUCCESS/EXIT_FAILURE)
2. SYSTEMD (incorporating our own exit codes)
3. LSB (like SYSTEMD but adding in LSB service exit codes)
4. FULL (like FULL but adding BSD exit codes)
Note that across the codebase only FULL, SYSTEMD, and MINIMAL are used,
depending on context, how much we know about the process and whether we
are logging for debugging purposes or not. This means the LSB level
wouldn't really have to be separate, but it appeared careless to me to
fold it into FULL along with the BSD exit codes.
Note that this commit doesn't change much for regular codepaths: the
FULL exit status level is only used during debug logging, as a helper to
the user reading the debug logs.
2018-04-23 20:26:25 +03:00
/* Exit status ranges:
*
* 0 … 1 │ ISO C , EXIT_SUCCESS + EXIT_FAILURE
* 2 … 7 │ LSB exit codes for init scripts
* 8 … 63 │ ( Currently unmapped )
* 64 … 78 │ BSD defined exit codes
* 79 … 199 │ ( Currently unmapped )
2019-08-05 17:37:53 +03:00
* 200 … 242 │ systemd ' s private error codes ( might be extended to 254 in future development )
* 243 … 254 │ ( Currently unmapped , but see above )
2018-11-20 18:55:51 +03:00
*
* 255 │ EXIT_EXCEPTION ( We use this to propagate exit - by - signal events . It ' s frequently used by others apps ( like bash )
* │ to indicate exit reason that cannot really be expressed in a single exit status value — such as a propagated
* │ signal or such , and we follow that logic here . )
exit-status: list BSD exit codes too
Let's optionally translate BSD exit codes to error strings too.
My first approach on adding this was to turn ExitStatusLevel into a
bitmask rather than a linear level, with one bit for the various feature
bits. However, the exit code ranges are generally not defined
independently from each other, i.e. our own ones are defined with the
LSB ones in mind, and most sets are defined with the ISO C ones.
Hence, instead I changed the existing hierarchy of MINIMAL, SYSTEMD, LSB
with an alias of FULL == LSB, only slightly by seperating FULL and LSB
into two separate levels, so that there's now:
1. MINIMAL (only EXIT_SUCCESS/EXIT_FAILURE)
2. SYSTEMD (incorporating our own exit codes)
3. LSB (like SYSTEMD but adding in LSB service exit codes)
4. FULL (like FULL but adding BSD exit codes)
Note that across the codebase only FULL, SYSTEMD, and MINIMAL are used,
depending on context, how much we know about the process and whether we
are logging for debugging purposes or not. This means the LSB level
wouldn't really have to be separate, but it appeared careless to me to
fold it into FULL along with the BSD exit codes.
Note that this commit doesn't change much for regular codepaths: the
FULL exit status level is only used during debug logging, as a helper to
the user reading the debug logs.
2018-04-23 20:26:25 +03:00
*/
2019-07-29 20:05:25 +03:00
[ EXIT_SUCCESS ] = { " SUCCESS " , EXIT_STATUS_LIBC } ,
[ EXIT_FAILURE ] = { " FAILURE " , EXIT_STATUS_LIBC } ,
2019-07-28 11:13:21 +03:00
[ EXIT_CHDIR ] = { " CHDIR " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_NICE ] = { " NICE " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_FDS ] = { " FDS " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_EXEC ] = { " EXEC " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_MEMORY ] = { " MEMORY " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_LIMITS ] = { " LIMITS " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_OOM_ADJUST ] = { " OOM_ADJUST " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_SIGNAL_MASK ] = { " SIGNAL_MASK " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_STDIN ] = { " STDIN " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_STDOUT ] = { " STDOUT " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_CHROOT ] = { " CHROOT " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_IOPRIO ] = { " IOPRIO " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_TIMERSLACK ] = { " TIMERSLACK " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_SECUREBITS ] = { " SECUREBITS " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_SETSCHEDULER ] = { " SETSCHEDULER " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_CPUAFFINITY ] = { " CPUAFFINITY " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_GROUP ] = { " GROUP " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_USER ] = { " USER " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_CAPABILITIES ] = { " CAPABILITIES " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_CGROUP ] = { " CGROUP " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_SETSID ] = { " SETSID " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_CONFIRM ] = { " CONFIRM " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_STDERR ] = { " STDERR " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_PAM ] = { " PAM " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_NETWORK ] = { " NETWORK " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_NAMESPACE ] = { " NAMESPACE " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_NO_NEW_PRIVILEGES ] = { " NO_NEW_PRIVILEGES " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_SECCOMP ] = { " SECCOMP " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_SELINUX_CONTEXT ] = { " SELINUX_CONTEXT " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_PERSONALITY ] = { " PERSONALITY " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_APPARMOR_PROFILE ] = { " APPARMOR " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_ADDRESS_FAMILIES ] = { " ADDRESS_FAMILIES " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_RUNTIME_DIRECTORY ] = { " RUNTIME_DIRECTORY " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_CHOWN ] = { " CHOWN " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_SMACK_PROCESS_LABEL ] = { " SMACK_PROCESS_LABEL " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_KEYRING ] = { " KEYRING " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_STATE_DIRECTORY ] = { " STATE_DIRECTORY " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_CACHE_DIRECTORY ] = { " CACHE_DIRECTORY " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_LOGS_DIRECTORY ] = { " LOGS_DIRECTORY " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_CONFIGURATION_DIRECTORY ] = { " CONFIGURATION_DIRECTORY " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_NUMA_POLICY ] = { " NUMA_POLICY " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_EXCEPTION ] = { " EXCEPTION " , EXIT_STATUS_SYSTEMD } ,
[ EXIT_INVALIDARGUMENT ] = { " INVALIDARGUMENT " , EXIT_STATUS_LSB } ,
[ EXIT_NOTIMPLEMENTED ] = { " NOTIMPLEMENTED " , EXIT_STATUS_LSB } ,
[ EXIT_NOPERMISSION ] = { " NOPERMISSION " , EXIT_STATUS_LSB } ,
[ EXIT_NOTINSTALLED ] = { " NOTINSTALLED " , EXIT_STATUS_LSB } ,
[ EXIT_NOTCONFIGURED ] = { " NOTCONFIGURED " , EXIT_STATUS_LSB } ,
[ EXIT_NOTRUNNING ] = { " NOTRUNNING " , EXIT_STATUS_LSB } ,
[ EX_USAGE ] = { " USAGE " , EXIT_STATUS_BSD } ,
[ EX_DATAERR ] = { " DATAERR " , EXIT_STATUS_BSD } ,
[ EX_NOINPUT ] = { " NOINPUT " , EXIT_STATUS_BSD } ,
[ EX_NOUSER ] = { " NOUSER " , EXIT_STATUS_BSD } ,
[ EX_NOHOST ] = { " NOHOST " , EXIT_STATUS_BSD } ,
[ EX_UNAVAILABLE ] = { " UNAVAILABLE " , EXIT_STATUS_BSD } ,
[ EX_SOFTWARE ] = { " SOFTWARE " , EXIT_STATUS_BSD } ,
[ EX_OSERR ] = { " OSERR " , EXIT_STATUS_BSD } ,
[ EX_OSFILE ] = { " OSFILE " , EXIT_STATUS_BSD } ,
[ EX_CANTCREAT ] = { " CANTCREAT " , EXIT_STATUS_BSD } ,
[ EX_IOERR ] = { " IOERR " , EXIT_STATUS_BSD } ,
[ EX_TEMPFAIL ] = { " TEMPFAIL " , EXIT_STATUS_BSD } ,
[ EX_PROTOCOL ] = { " PROTOCOL " , EXIT_STATUS_BSD } ,
[ EX_NOPERM ] = { " NOPERM " , EXIT_STATUS_BSD } ,
[ EX_CONFIG ] = { " CONFIG " , EXIT_STATUS_BSD } ,
} ;
const char * exit_status_to_string ( int code , ExitStatusClass class ) {
if ( code < 0 | | ( size_t ) code > = ELEMENTSOF ( exit_status_mappings ) )
return NULL ;
2019-08-05 17:36:45 +03:00
return class & exit_status_mappings [ code ] . class ? exit_status_mappings [ code ] . name : NULL ;
2019-07-28 11:13:21 +03:00
}
exit-status: list BSD exit codes too
Let's optionally translate BSD exit codes to error strings too.
My first approach on adding this was to turn ExitStatusLevel into a
bitmask rather than a linear level, with one bit for the various feature
bits. However, the exit code ranges are generally not defined
independently from each other, i.e. our own ones are defined with the
LSB ones in mind, and most sets are defined with the ISO C ones.
Hence, instead I changed the existing hierarchy of MINIMAL, SYSTEMD, LSB
with an alias of FULL == LSB, only slightly by seperating FULL and LSB
into two separate levels, so that there's now:
1. MINIMAL (only EXIT_SUCCESS/EXIT_FAILURE)
2. SYSTEMD (incorporating our own exit codes)
3. LSB (like SYSTEMD but adding in LSB service exit codes)
4. FULL (like FULL but adding BSD exit codes)
Note that across the codebase only FULL, SYSTEMD, and MINIMAL are used,
depending on context, how much we know about the process and whether we
are logging for debugging purposes or not. This means the LSB level
wouldn't really have to be separate, but it appeared careless to me to
fold it into FULL along with the BSD exit codes.
Note that this commit doesn't change much for regular codepaths: the
FULL exit status level is only used during debug logging, as a helper to
the user reading the debug logs.
2018-04-23 20:26:25 +03:00
2019-07-28 11:13:21 +03:00
const char * exit_status_class ( int code ) {
if ( code < 0 | | ( size_t ) code > = ELEMENTSOF ( exit_status_mappings ) )
return NULL ;
switch ( exit_status_mappings [ code ] . class ) {
2019-07-29 20:05:25 +03:00
case EXIT_STATUS_LIBC :
return " libc " ;
2019-07-28 11:13:21 +03:00
case EXIT_STATUS_SYSTEMD :
return " systemd " ;
case EXIT_STATUS_LSB :
return " LSB " ;
case EXIT_STATUS_BSD :
return " BSD " ;
default : return NULL ;
exit-status: list BSD exit codes too
Let's optionally translate BSD exit codes to error strings too.
My first approach on adding this was to turn ExitStatusLevel into a
bitmask rather than a linear level, with one bit for the various feature
bits. However, the exit code ranges are generally not defined
independently from each other, i.e. our own ones are defined with the
LSB ones in mind, and most sets are defined with the ISO C ones.
Hence, instead I changed the existing hierarchy of MINIMAL, SYSTEMD, LSB
with an alias of FULL == LSB, only slightly by seperating FULL and LSB
into two separate levels, so that there's now:
1. MINIMAL (only EXIT_SUCCESS/EXIT_FAILURE)
2. SYSTEMD (incorporating our own exit codes)
3. LSB (like SYSTEMD but adding in LSB service exit codes)
4. FULL (like FULL but adding BSD exit codes)
Note that across the codebase only FULL, SYSTEMD, and MINIMAL are used,
depending on context, how much we know about the process and whether we
are logging for debugging purposes or not. This means the LSB level
wouldn't really have to be separate, but it appeared careless to me to
fold it into FULL along with the BSD exit codes.
Note that this commit doesn't change much for regular codepaths: the
FULL exit status level is only used during debug logging, as a helper to
the user reading the debug logs.
2018-04-23 20:26:25 +03:00
}
2010-08-20 05:26:37 +04:00
}
2011-01-20 20:22:03 +03:00
2019-07-28 11:19:53 +03:00
int exit_status_from_string ( const char * s ) {
uint8_t val ;
int r ;
for ( size_t i = 0 ; i < ELEMENTSOF ( exit_status_mappings ) ; i + + )
if ( streq_ptr ( s , exit_status_mappings [ i ] . name ) )
return i ;
r = safe_atou8 ( s , & val ) ;
if ( r < 0 )
return r ;
return val ;
}
shared/exit-status: use Bitmap instead of Sets
I opted to embed the Bitmap structure directly in the ExitStatusSet.
This means that memory usage is a bit higher for units which don't define
this setting:
Service changes:
/* size: 2720, cachelines: 43, members: 73 */
/* sum members: 2680, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
/* last cacheline: 32 bytes */
/* size: 2816, cachelines: 44, members: 73 */
/* sum members: 2776, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
But this way the code is simpler and we do less pointer chasing.
2019-07-28 12:14:46 +03:00
bool is_clean_exit ( int code , int status , ExitClean clean , const ExitStatusSet * success_status ) {
2011-01-20 20:22:03 +03:00
if ( code = = CLD_EXITED )
2012-08-13 15:58:01 +04:00
return status = = 0 | |
( success_status & &
shared/exit-status: use Bitmap instead of Sets
I opted to embed the Bitmap structure directly in the ExitStatusSet.
This means that memory usage is a bit higher for units which don't define
this setting:
Service changes:
/* size: 2720, cachelines: 43, members: 73 */
/* sum members: 2680, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
/* last cacheline: 32 bytes */
/* size: 2816, cachelines: 44, members: 73 */
/* sum members: 2776, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
But this way the code is simpler and we do less pointer chasing.
2019-07-28 12:14:46 +03:00
bitmap_isset ( & success_status - > status , status ) ) ;
2011-01-20 20:22:03 +03:00
shared/exit-status: use Bitmap instead of Sets
I opted to embed the Bitmap structure directly in the ExitStatusSet.
This means that memory usage is a bit higher for units which don't define
this setting:
Service changes:
/* size: 2720, cachelines: 43, members: 73 */
/* sum members: 2680, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
/* last cacheline: 32 bytes */
/* size: 2816, cachelines: 44, members: 73 */
/* sum members: 2776, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
But this way the code is simpler and we do less pointer chasing.
2019-07-28 12:14:46 +03:00
/* If a daemon does not implement handlers for some of the signals, we do not consider this an
unclean shutdown */
2011-01-20 20:22:03 +03:00
if ( code = = CLD_KILLED )
2016-10-10 23:07:30 +03:00
return
( clean = = EXIT_CLEAN_DAEMON & & IN_SET ( status , SIGHUP , SIGINT , SIGTERM , SIGPIPE ) ) | |
2012-08-13 15:58:01 +04:00
( success_status & &
shared/exit-status: use Bitmap instead of Sets
I opted to embed the Bitmap structure directly in the ExitStatusSet.
This means that memory usage is a bit higher for units which don't define
this setting:
Service changes:
/* size: 2720, cachelines: 43, members: 73 */
/* sum members: 2680, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
/* last cacheline: 32 bytes */
/* size: 2816, cachelines: 44, members: 73 */
/* sum members: 2776, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
But this way the code is simpler and we do less pointer chasing.
2019-07-28 12:14:46 +03:00
bitmap_isset ( & success_status - > signal , status ) ) ;
2011-01-20 20:22:03 +03:00
return false ;
}
2014-07-03 14:47:40 +04:00
void exit_status_set_free ( ExitStatusSet * x ) {
assert ( x ) ;
shared/exit-status: use Bitmap instead of Sets
I opted to embed the Bitmap structure directly in the ExitStatusSet.
This means that memory usage is a bit higher for units which don't define
this setting:
Service changes:
/* size: 2720, cachelines: 43, members: 73 */
/* sum members: 2680, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
/* last cacheline: 32 bytes */
/* size: 2816, cachelines: 44, members: 73 */
/* sum members: 2776, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
But this way the code is simpler and we do less pointer chasing.
2019-07-28 12:14:46 +03:00
bitmap_clear ( & x - > status ) ;
bitmap_clear ( & x - > signal ) ;
2014-07-03 14:47:40 +04:00
}
2014-07-03 17:50:31 +04:00
shared/exit-status: use Bitmap instead of Sets
I opted to embed the Bitmap structure directly in the ExitStatusSet.
This means that memory usage is a bit higher for units which don't define
this setting:
Service changes:
/* size: 2720, cachelines: 43, members: 73 */
/* sum members: 2680, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
/* last cacheline: 32 bytes */
/* size: 2816, cachelines: 44, members: 73 */
/* sum members: 2776, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
But this way the code is simpler and we do less pointer chasing.
2019-07-28 12:14:46 +03:00
bool exit_status_set_is_empty ( const ExitStatusSet * x ) {
2014-07-03 17:50:31 +04:00
if ( ! x )
return true ;
shared/exit-status: use Bitmap instead of Sets
I opted to embed the Bitmap structure directly in the ExitStatusSet.
This means that memory usage is a bit higher for units which don't define
this setting:
Service changes:
/* size: 2720, cachelines: 43, members: 73 */
/* sum members: 2680, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
/* last cacheline: 32 bytes */
/* size: 2816, cachelines: 44, members: 73 */
/* sum members: 2776, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
But this way the code is simpler and we do less pointer chasing.
2019-07-28 12:14:46 +03:00
return bitmap_isclear ( & x - > status ) & & bitmap_isclear ( & x - > signal ) ;
2014-07-03 17:50:31 +04:00
}
2015-04-28 19:24:20 +03:00
shared/exit-status: use Bitmap instead of Sets
I opted to embed the Bitmap structure directly in the ExitStatusSet.
This means that memory usage is a bit higher for units which don't define
this setting:
Service changes:
/* size: 2720, cachelines: 43, members: 73 */
/* sum members: 2680, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
/* last cacheline: 32 bytes */
/* size: 2816, cachelines: 44, members: 73 */
/* sum members: 2776, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
But this way the code is simpler and we do less pointer chasing.
2019-07-28 12:14:46 +03:00
bool exit_status_set_test ( const ExitStatusSet * x , int code , int status ) {
if ( code = = CLD_EXITED & & bitmap_isset ( & x - > status , status ) )
2015-04-28 19:24:20 +03:00
return true ;
shared/exit-status: use Bitmap instead of Sets
I opted to embed the Bitmap structure directly in the ExitStatusSet.
This means that memory usage is a bit higher for units which don't define
this setting:
Service changes:
/* size: 2720, cachelines: 43, members: 73 */
/* sum members: 2680, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
/* last cacheline: 32 bytes */
/* size: 2816, cachelines: 44, members: 73 */
/* sum members: 2776, holes: 9, sum holes: 39 */
/* sum bitfield members: 7 bits, bit holes: 1, sum bit holes: 1 bits */
But this way the code is simpler and we do less pointer chasing.
2019-07-28 12:14:46 +03:00
if ( IN_SET ( code , CLD_KILLED , CLD_DUMPED ) & & bitmap_isset ( & x - > signal , status ) )
2015-04-28 19:24:20 +03:00
return true ;
return false ;
}