~jamesodhunt/upstart/upstart-shutdown-temp

« back to all changes in this revision

Viewing changes to init/control.c

  • Committer: James Hunt
  • Date: 2013-01-25 20:08:49 UTC
  • Revision ID: james.hunt@ubuntu.com-20130125200849-4ltsasoqsy4qsk77
* dbus/com.ubuntu.Upstart.xml:
  - Added 'job_details' string array as first parameter for GetEnv,
    SetEnv, UnsetEnv, ListEnv and ResetEnv to allow methods to either
    act globally or on a specific job environment.
* init/control.c:
  - control_set_env():
  - control_unset_env():
  - control_get_env():
  - control_list_env():
  - control_reset_env():
    - Disallow setting for PID 1.
    - Operate globally or on specified job.
* init/control.h: control_get_job(): Macro to simplify extracting job
  from provided job details.
* init/job.c: job_find(): New function.
* init/job_class.c:
  - job_class_environment_set(): Delimiter handling now moved to
    control_set_env() so it can be shared by job and global logic.
  - job_class_find(): New function.
* init/state.c:
  - Removed state_get_job() and replaced calls with job_find().
* util/initctl.c:
  - Updated *_action() functions for new D-Bus parameters and made use
    of new function get_job_details().

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
#include "environ.h"
51
51
#include "session.h"
52
52
#include "job_class.h"
 
53
#include "job.h"
53
54
#include "blocked.h"
54
55
#include "conf.h"
55
56
#include "control.h"
1233
1234
                return -1;
1234
1235
        }
1235
1236
 
 
1237
        /* Lookup the job */
 
1238
        control_get_job (job, job_name, instance);
 
1239
 
1236
1240
        /* If variable does not contain a delimiter, add one to ensure
1237
1241
         * it gets entered into the job environment table. Without the
1238
1242
         * delimiter, the variable will be silently ignored unless it's
1335
1339
                return -1;
1336
1340
        }
1337
1341
 
 
1342
        /* Lookup the job */
 
1343
        control_get_job (job, job_name, instance);
 
1344
 
1338
1345
        if (job) {
1339
1346
                /* Modify job-specific environment */
1340
1347
 
1434
1441
                return -1;
1435
1442
        }
1436
1443
 
 
1444
        /* Lookup the job */
 
1445
        control_get_job (job, job_name, instance);
 
1446
 
1437
1447
        if (job) {
1438
1448
                tmp = environ_get (job->env, name);
1439
1449
                if (! tmp)
1526
1536
                return -1;
1527
1537
        }
1528
1538
 
 
1539
        /* Lookup the job */
 
1540
        control_get_job (job, job_name, instance);
 
1541
 
1529
1542
        if (job) {
1530
1543
                *env = nih_str_array_copy (job, NULL, job->env);
1531
1544
                if (! *env)
1613
1626
                return -1;
1614
1627
        }
1615
1628
 
 
1629
        /* Lookup the job */
 
1630
        control_get_job (job, job_name, instance);
 
1631
 
 
1632
 
1616
1633
        if (job) {
1617
1634
                size_t len;
1618
1635
                if (job->env) {