diff options
author | Daniel Mack <github@zonque.org> | 2015-10-01 22:58:02 +0200 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-10-01 22:58:02 +0200 |
commit | 3c2f5a543de9cc3d958920b3bd18dc8657dc201f (patch) | |
tree | dc69a329bd915b6fedd7079cc35808abcd3a2723 | |
parent | 5a6d44ed77f46c18aa2315e645de7302b88c34c8 (diff) | |
parent | 2c6c4ab2f5523940df64af205315612d89b818f0 (diff) |
Merge pull request #1439 from poettering/CODING_STYLE
Coding style
-rw-r--r-- | CODING_STYLE | 17 | ||||
-rw-r--r-- | src/basic/terminal-util.c | 21 | ||||
-rw-r--r-- | src/basic/terminal-util.h | 2 | ||||
-rw-r--r-- | src/login/logind-action.c | 1 |
4 files changed, 17 insertions, 24 deletions
diff --git a/CODING_STYLE b/CODING_STYLE index 98d99dcdaa..cf86de5f62 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -321,3 +321,20 @@ parse values the same way on all architectures and cannot expose off_t values over D-Bus. To avoid any confusion regarding conversion and ABIs, always use simply uint64_t directly. + +- Commit message subject lines should be prefixed with an appropriate + component name of some kind. For example "journal: ", "nspawn: " and + so on. + +- Do not use "Signed-Off-By:" in your commit messages. That's a kernel + thing we don't do in the systemd project. + +- Avoid leaving long-running child processes around, i.e. fork()s that + are not followed quickly by an execv() in the child. Resource + management is unclear in this case, and memory CoW will result in + penalties in the parent much much later on. + +- Don't block execution for arbitrary amounts of time using usleep() + or a similar call, unless you really know what you do. Just "giving + something some time", or so is a lazy excuse. Always wait for the + proper event, instead of doing time-based poll loops. diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index 287e0dfa13..22ee6ad83f 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -607,27 +607,6 @@ int vt_disallocate(const char *name) { return 0; } -void warn_melody(void) { - _cleanup_close_ int fd = -1; - - fd = open("/dev/console", O_WRONLY|O_CLOEXEC|O_NOCTTY); - if (fd < 0) - return; - - /* Yeah, this is synchronous. Kinda sucks. But well... */ - - (void) ioctl(fd, KIOCSOUND, (int)(1193180/440)); - usleep(125*USEC_PER_MSEC); - - (void) ioctl(fd, KIOCSOUND, (int)(1193180/220)); - usleep(125*USEC_PER_MSEC); - - (void) ioctl(fd, KIOCSOUND, (int)(1193180/220)); - usleep(125*USEC_PER_MSEC); - - (void) ioctl(fd, KIOCSOUND, 0); -} - int make_console_stdio(void) { int fd, r; diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h index a9e325ccb3..da2a5b8897 100644 --- a/src/basic/terminal-util.h +++ b/src/basic/terminal-util.h @@ -67,8 +67,6 @@ bool tty_is_console(const char *tty) _pure_; int vtnr_from_tty(const char *tty); const char *default_term_for_tty(const char *tty); -void warn_melody(void); - int make_stdio(int fd); int make_null_stdio(void); int make_console_stdio(void); diff --git a/src/login/logind-action.c b/src/login/logind-action.c index f635fb1b63..a44e369149 100644 --- a/src/login/logind-action.c +++ b/src/login/logind-action.c @@ -147,7 +147,6 @@ int manager_handle_action( offending->uid, strna(u), offending->pid, strna(comm)); - warn_melody(); return -EPERM; } |