@@ -3176,18 +3176,9 @@ int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs) {
31763176 assert (fds );
31773177
31783178 if (unit_can_serialize (u )) {
3179- ExecRuntime * rt ;
3180-
31813179 r = UNIT_VTABLE (u )-> serialize (u , f , fds );
31823180 if (r < 0 )
31833181 return r ;
3184-
3185- rt = unit_get_exec_runtime (u );
3186- if (rt ) {
3187- r = exec_runtime_serialize (u , rt , f , fds );
3188- if (r < 0 )
3189- return r ;
3190- }
31913182 }
31923183
31933184 dual_timestamp_serialize (f , "state-change-timestamp" , & u -> state_change_timestamp );
@@ -3333,18 +3324,12 @@ void unit_serialize_item_format(Unit *u, FILE *f, const char *key, const char *f
33333324}
33343325
33353326int unit_deserialize (Unit * u , FILE * f , FDSet * fds ) {
3336- ExecRuntime * * rt = NULL ;
3337- size_t offset ;
33383327 int r ;
33393328
33403329 assert (u );
33413330 assert (f );
33423331 assert (fds );
33433332
3344- offset = UNIT_VTABLE (u )-> exec_runtime_offset ;
3345- if (offset > 0 )
3346- rt = (ExecRuntime * * ) ((uint8_t * ) u + offset );
3347-
33483333 for (;;) {
33493334 char line [LINE_MAX ], * l , * v ;
33503335 CGroupIPAccountingMetric m ;
@@ -3604,18 +3589,16 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
36043589 }
36053590
36063591 if (unit_can_serialize (u )) {
3607- if (rt ) {
3608- r = exec_runtime_deserialize_item (u , rt , l , v , fds );
3609- if (r < 0 ) {
3610- log_unit_warning (u , "Failed to deserialize runtime parameter '%s', ignoring." , l );
3611- continue ;
3612- }
3613-
3614- /* Returns positive if key was handled by the call */
3615- if (r > 0 )
3616- continue ;
3592+ r = exec_runtime_deserialize_compat (u , l , v , fds );
3593+ if (r < 0 ) {
3594+ log_unit_warning (u , "Failed to deserialize runtime parameter '%s', ignoring." , l );
3595+ continue ;
36173596 }
36183597
3598+ /* Returns positive if key was handled by the call */
3599+ if (r > 0 )
3600+ continue ;
3601+
36193602 r = UNIT_VTABLE (u )-> deserialize_item (u , l , v , fds );
36203603 if (r < 0 )
36213604 log_unit_warning (u , "Failed to deserialize unit parameter '%s', ignoring." , l );
@@ -4684,6 +4667,7 @@ int unit_setup_exec_runtime(Unit *u) {
46844667 Unit * other ;
46854668 Iterator i ;
46864669 void * v ;
4670+ int r ;
46874671
46884672 offset = UNIT_VTABLE (u )-> exec_runtime_offset ;
46894673 assert (offset > 0 );
@@ -4695,15 +4679,12 @@ int unit_setup_exec_runtime(Unit *u) {
46954679
46964680 /* Try to get it from somebody else */
46974681 HASHMAP_FOREACH_KEY (v , other , u -> dependencies [UNIT_JOINS_NAMESPACE_OF ], i ) {
4698-
4699- * rt = unit_get_exec_runtime (other );
4700- if (* rt ) {
4701- exec_runtime_ref (* rt );
4702- return 0 ;
4703- }
4682+ r = exec_runtime_acquire (u -> manager , NULL , other -> id , false, rt );
4683+ if (r == 1 )
4684+ return 1 ;
47044685 }
47054686
4706- return exec_runtime_make ( rt , unit_get_exec_context (u ), u -> id );
4687+ return exec_runtime_acquire ( u -> manager , unit_get_exec_context (u ), u -> id , true, rt );
47074688}
47084689
47094690int unit_setup_dynamic_creds (Unit * u ) {
0 commit comments