Scott James Remnant | 6b667b1 | 2011-02-17 15:38:40 -0800 | [diff] [blame] | 1 | 1.x series: |
Scott James Remnant | fd8a043 | 2008-07-05 17:30:04 +0100 | [diff] [blame] | 2 | |
| 3 | * going into runlevel S from !S, need to stty console |
| 4 | * going into 6, 0 or 1, need to stty console |
| 5 | * reset console before S process |
| 6 | |
Scott James Remnant | 9f17521 | 2009-07-14 18:45:47 +0100 | [diff] [blame] | 7 | * we should mark fds and sockets close-on-exec when we create them, rather |
| 8 | than later |
| 9 | * the fork() pipe should be close-on-exec rather than closing it in the |
| 10 | child |
| 11 | |
Scott James Remnant | bf7399d | 2009-07-09 00:14:49 +0100 | [diff] [blame] | 12 | * init needs to grow "utmp XXX", which maintains INIT_PROCESS and |
| 13 | DEAD_PROCESS entries for the given ut_id (3 chars max), used for getty |
Scott James Remnant | fd8a043 | 2008-07-05 17:30:04 +0100 | [diff] [blame] | 14 | |
Scott James Remnant | bf7399d | 2009-07-09 00:14:49 +0100 | [diff] [blame] | 15 | For that we'll probably need to support ${..#...} so that we can do |
| 16 | utmp ${TTY#tty} |
Scott James Remnant | d25ffae | 2008-06-08 02:12:10 +0100 | [diff] [blame] | 17 | |
| 18 | * There's a lot of complicated code that's pretty much duplicated between |
| 19 | event_pending_handle_jobs(), job_class_start(), job_class_stop(), |
Scott James Remnant | b40e4dd | 2008-06-08 03:26:36 +0100 | [diff] [blame] | 20 | job_class_restart(), job_class_get_instance() and to a lesser extent, |
| 21 | job_start(), job_stop() and job_restart(). We should make an effort to |
| 22 | reduce this to common functions, which may become easier as we rationalise |
| 23 | the behaviour anyway. |
Scott James Remnant | ab132da | 2007-02-07 15:48:02 +0000 | [diff] [blame] | 24 | |
Scott James Remnant | e22f7a2 | 2008-06-07 01:36:43 +0100 | [diff] [blame] | 25 | * It may be useful to not just have failed=TRUE/FALSE for job_finished() but a |
Scott James Remnant | 75f6fae | 2008-05-01 01:39:27 +0100 | [diff] [blame] | 26 | more detailed reason about why the job is being unblocked, so the command |
| 27 | could exit saying "ok", "failed", "stopped by event", etc. |
| 28 | |
Scott James Remnant | e22f7a2 | 2008-06-07 01:36:43 +0100 | [diff] [blame] | 29 | * It would also be nice, in the case of a job having failed, to be able |
| 30 | to include the event-like information in the error. This should be |
| 31 | possible, it just needs a marshalling function? (Maybe we should be able |
| 32 | to generate those) |
| 33 | |
Scott James Remnant | bf7399d | 2009-07-09 00:14:49 +0100 | [diff] [blame] | 34 | * Information about what caused a job to stop (failed information or event) |
| 35 | should be available to other jobs, and to the job's post-stop script. |
| 36 | |
Scott James Remnant | 75f6fae | 2008-05-01 01:39:27 +0100 | [diff] [blame] | 37 | * I'm still not convinced that just clearing blocking is the right approach, |
| 38 | and still think we need some kind of next_blocking list of things that |
| 39 | will still be blocked next time around. Restores some of the older |
| 40 | behaviour in that "start" will block until stopped, and fail with the |
| 41 | fact it was stopped. |
| 42 | |
Scott James Remnant | 75f6fae | 2008-05-01 01:39:27 +0100 | [diff] [blame] | 43 | * Need to add dependencies to jobs, which are files that must exist before |
| 44 | the job can be started (because Debian/Ubuntu like to litter config files |
| 45 | like jobs) |
Scott James Remnant | cd15761 | 2007-03-03 17:09:09 +0000 | [diff] [blame] | 46 | |
Scott James Remnant | 75f6fae | 2008-05-01 01:39:27 +0100 | [diff] [blame] | 47 | * Resources, "uses cpu 1.0" -- where cpu has a defined max (default 1.0); |
| 48 | which state do we keep it in while it's waiting? |
| 49 | |
| 50 | |
| 51 | Later: |
| 52 | |
Scott James Remnant | 02ee200 | 2008-06-05 22:07:43 +0100 | [diff] [blame] | 53 | * Restore serialisation of state between upstart processes, I guess we'll |
| 54 | use a D-Bus API to do this. Most sense would be a peer-to-peer D-Bus |
| 55 | connection so don't need the bus (think initramfs), but we also need |
| 56 | to pass over the bus connection so we don't drop that. |
| 57 | |
| 58 | - Pass the Event queue first since Jobs refer to it |
| 59 | - Register each ConfSource, ConfFile, JobClass and Job, setting |
| 60 | the status of each |
| 61 | - Join up the Event queue and Job structures |
| 62 | |
| 63 | - What about commends blocked on event emissions or jobs? |
| 64 | |
Scott James Remnant | 75f6fae | 2008-05-01 01:39:27 +0100 | [diff] [blame] | 65 | |
| 66 | Anytime: |
| 67 | |
Scott James Remnant | cd15761 | 2007-03-03 17:09:09 +0000 | [diff] [blame] | 68 | * Iterating through every Job's start and stop events is messy; we should |
| 69 | have some kind of match lookup table to make it easier. |
| 70 | |
| 71 | * Likewise iterating through all the Jobs to find a pid is messy; we |
Scott James Remnant | 75f6fae | 2008-05-01 01:39:27 +0100 | [diff] [blame] | 72 | should have a lookup table for these too. Ideally we'd have a JobProcess |
| 73 | structure combining type, pid and a link to the job -- then all the |
| 74 | job_process_* functions would just accept those |
Scott James Remnant | cd15761 | 2007-03-03 17:09:09 +0000 | [diff] [blame] | 75 | |
Scott James Remnant | 75f6fae | 2008-05-01 01:39:27 +0100 | [diff] [blame] | 76 | * system_setup_console is due for an overhaul as well; especially if |
Scott James Remnant | e72695c | 2007-02-10 17:11:26 +0000 | [diff] [blame] | 77 | we want to be able to pass file descriptors in. Am somewhat tempted |
| 78 | to add a magic CONSOLE_DEFAULT option which tries fd, logging, null, |
Scott James Remnant | d25ffae | 2008-06-08 02:12:10 +0100 | [diff] [blame] | 79 | etc. |
Scott James Remnant | e72695c | 2007-02-10 17:11:26 +0000 | [diff] [blame] | 80 | |
| 81 | * We always want /dev/fd/NNN to be /dev/fd/3, we should have some way |
| 82 | to instruct process_spawn to do that. |
| 83 | |
Scott James Remnant | cd15761 | 2007-03-03 17:09:09 +0000 | [diff] [blame] | 84 | * We may need to KILL scripts, e.g. post-start; especially when the goal |
| 85 | changes. Or perhaps just after a timeout? |
| 86 | |
| 87 | * May need a way to force ignoring of the KILL signal, and assuming that |
| 88 | a job that won't die really has. |
| 89 | |
Scott James Remnant | fef12b5 | 2006-08-25 16:16:45 +0200 | [diff] [blame] | 90 | * Get the LANG environment variable somehow. |
Scott James Remnant | ddc3e28 | 2006-08-18 18:49:50 +0100 | [diff] [blame] | 91 | |
Scott James Remnant | 5fa1567 | 2006-08-09 23:23:17 +0100 | [diff] [blame] | 92 | |
Scott James Remnant | fef12b5 | 2006-08-25 16:16:45 +0200 | [diff] [blame] | 93 | Future Features: |
Scott James Remnant | 5fa1567 | 2006-08-09 23:23:17 +0100 | [diff] [blame] | 94 | |
Scott James Remnant | 62f2d86 | 2008-03-03 02:13:19 +0000 | [diff] [blame] | 95 | * Roles; services define roles that they can perform ("web server") and |
| 96 | can be found by their role. Other jobs could require that a role be |
| 97 | performed for them to start (creeping into deps here). Use affinity |
| 98 | tags to work out which of many services to start. |
Scott James Remnant | d961948 | 2007-06-10 22:11:42 +0100 | [diff] [blame] | 99 | |
Scott James Remnant | fef12b5 | 2006-08-25 16:16:45 +0200 | [diff] [blame] | 100 | * Per-user services; will need to use PAM to set up the session. |
| 101 | We want to do this for "root-user services" but not for jobs/tasks |
Scott James Remnant | 5fa1567 | 2006-08-09 23:23:17 +0100 | [diff] [blame] | 102 | |
Scott James Remnant | 62f2d86 | 2008-03-03 02:13:19 +0000 | [diff] [blame] | 103 | * Passing of file descriptors from event over control socket. |
Scott James Remnant | fef12b5 | 2006-08-25 16:16:45 +0200 | [diff] [blame] | 104 | |
Scott James Remnant | dc6b5e4 | 2007-06-12 14:57:14 +0100 | [diff] [blame] | 105 | * Register jobs over the control socket, ideal way is to register some kind |
| 106 | of automatic source and attach them to that. |
Scott James Remnant | fef12b5 | 2006-08-25 16:16:45 +0200 | [diff] [blame] | 107 | |
| 108 | * Temporal events ("15m after startup") |
| 109 | |
| 110 | * Scheduled times ("every day at 3:00") |
| 111 | |
| 112 | * Load average checking, maybe have separate CPU, Network and I/O |
Scott James Remnant | 62f2d86 | 2008-03-03 02:13:19 +0000 | [diff] [blame] | 113 | stats? See also resources. |
Scott James Remnant | 853cc77 | 2006-08-16 13:34:51 +0100 | [diff] [blame] | 114 | |
Scott James Remnant | adfcc3f | 2007-02-03 12:24:07 +0000 | [diff] [blame] | 115 | * Actions: "reload" and optional replacements for "stop", "start", etc. |
Scott James Remnant | 3ee512d | 2007-03-08 14:30:21 +0000 | [diff] [blame] | 116 | |
| 117 | This is mostly just a matter of deciding policy for when they can be run, |
| 118 | and adding "user processes" onto the end of the job->process array. |
| 119 | |
| 120 | * Alternative script interpreters; "start script python". |
| 121 | |
| 122 | Would be done by making script a char *, and putting the interpreter into |
| 123 | command? |
Scott James Remnant | d055a9d | 2007-03-11 17:58:15 +0000 | [diff] [blame] | 124 | |
Scott James Remnant | fea1e9c | 2007-05-18 15:42:25 +0100 | [diff] [blame] | 125 | * Watershed jobs (this actually might apply to events, since you might |
| 126 | want to try starting again if a particular event has come in since you |
| 127 | were last started) |