diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-06-18 11:59:57 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-06-18 11:59:57 +0000 |
commit | ed85740167a5bc8acf2718fb54b40d206de13b81 (patch) | |
tree | ecd3a983045bd6da577bb03895cd1638cff9e555 /src | |
parent | c4c08b52cfb51dee330402c44a5dbdeacab3b1a8 (diff) | |
download | gnunet-ed85740167a5bc8acf2718fb54b40d206de13b81.tar.gz gnunet-ed85740167a5bc8acf2718fb54b40d206de13b81.zip |
-allow 'years' in time units, indentation and doxygen fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/util/os_priority.c | 45 | ||||
-rw-r--r-- | src/util/strings.c | 2 |
2 files changed, 33 insertions, 14 deletions
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 065009ae5..e3f80b859 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -268,7 +268,10 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig) | |||
268 | } | 268 | } |
269 | return 0; | 269 | return 0; |
270 | #else | 270 | #else |
271 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending signal %d to pid: %u via system call\n", sig, proc->pid); | 271 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
272 | "Sending signal %d to pid: %u via system call\n", | ||
273 | sig, | ||
274 | proc->pid); | ||
272 | return PLIBC_KILL (proc->pid, sig); | 275 | return PLIBC_KILL (proc->pid, sig); |
273 | #endif | 276 | #endif |
274 | default: | 277 | default: |
@@ -307,7 +310,7 @@ GNUNET_OS_process_destroy (struct GNUNET_OS_Process *proc) | |||
307 | if (NULL != proc->control_pipe) | 310 | if (NULL != proc->control_pipe) |
308 | GNUNET_DISK_file_close (proc->control_pipe); | 311 | GNUNET_DISK_file_close (proc->control_pipe); |
309 | #if defined (WINDOWS) | 312 | #if defined (WINDOWS) |
310 | if (proc->handle != NULL) | 313 | if (NULL != proc->handle) |
311 | CloseHandle (proc->handle); | 314 | CloseHandle (proc->handle); |
312 | #endif | 315 | #endif |
313 | GNUNET_free (proc); | 316 | GNUNET_free (proc); |
@@ -1062,7 +1065,9 @@ start_process (int pipe_control, | |||
1062 | if (NULL == (wcmd = u8_to_u16 ((uint8_t *) cmd, 1 + strlen (cmd), NULL, &wcmd_len))) | 1065 | if (NULL == (wcmd = u8_to_u16 ((uint8_t *) cmd, 1 + strlen (cmd), NULL, &wcmd_len))) |
1063 | { | 1066 | { |
1064 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1067 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1065 | "Failed to convert `%s' from UTF-8 to UTF-16: %d\n", cmd, errno); | 1068 | "Failed to convert `%s' from UTF-8 to UTF-16: %d\n", |
1069 | cmd, | ||
1070 | errno); | ||
1066 | GNUNET_free (env_block); | 1071 | GNUNET_free (env_block); |
1067 | GNUNET_free (cmd); | 1072 | GNUNET_free (cmd); |
1068 | free (wpath); | 1073 | free (wpath); |
@@ -1100,7 +1105,11 @@ start_process (int pipe_control, | |||
1100 | SetHandleInformation (stdeh, HANDLE_FLAG_INHERIT, stdef); | 1105 | SetHandleInformation (stdeh, HANDLE_FLAG_INHERIT, stdef); |
1101 | 1106 | ||
1102 | if (!bresult) | 1107 | if (!bresult) |
1103 | LOG (GNUNET_ERROR_TYPE_ERROR, "CreateProcess(%s, %s) failed: %lu\n", path, cmd, error_code); | 1108 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1109 | "CreateProcess(%s, %s) failed: %lu\n", | ||
1110 | path, | ||
1111 | cmd, | ||
1112 | error_code); | ||
1104 | 1113 | ||
1105 | GNUNET_free (env_block); | 1114 | GNUNET_free (env_block); |
1106 | GNUNET_free (cmd); | 1115 | GNUNET_free (cmd); |
@@ -1517,7 +1526,7 @@ GNUNET_OS_start_process_s (int pipe_control, | |||
1517 | * @param proc process ID | 1526 | * @param proc process ID |
1518 | * @param type status type | 1527 | * @param type status type |
1519 | * @param code return code/signal number | 1528 | * @param code return code/signal number |
1520 | * @return GNUNET_OK on success, GNUNET_NO if the process is still running, GNUNET_SYSERR otherwise | 1529 | * @return #GNUNET_OK on success, #GNUNET_NO if the process is still running, #GNUNET_SYSERR otherwise |
1521 | */ | 1530 | */ |
1522 | int | 1531 | int |
1523 | GNUNET_OS_process_status (struct GNUNET_OS_Process *proc, | 1532 | GNUNET_OS_process_status (struct GNUNET_OS_Process *proc, |
@@ -1612,10 +1621,14 @@ GNUNET_OS_process_status (struct GNUNET_OS_Process *proc, | |||
1612 | 1621 | ||
1613 | 1622 | ||
1614 | /** | 1623 | /** |
1615 | * Wait for a process | 1624 | * Wait for a process to terminate. The return code is discarded. |
1625 | * You must not use #GNUNET_OS_process_status() on the same process | ||
1626 | * after calling this function! This function is blocking and should | ||
1627 | * thus only be used if the child process is known to have terminated | ||
1628 | * or to terminate very soon. | ||
1616 | * | 1629 | * |
1617 | * @param proc pointer to process structure | 1630 | * @param proc pointer to process structure |
1618 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | 1631 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise |
1619 | */ | 1632 | */ |
1620 | int | 1633 | int |
1621 | GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc) | 1634 | GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc) |
@@ -1628,7 +1641,8 @@ GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc) | |||
1628 | (EINTR == errno) ) ; | 1641 | (EINTR == errno) ) ; |
1629 | if (pid != ret) | 1642 | if (pid != ret) |
1630 | { | 1643 | { |
1631 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "waitpid"); | 1644 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, |
1645 | "waitpid"); | ||
1632 | return GNUNET_SYSERR; | 1646 | return GNUNET_SYSERR; |
1633 | } | 1647 | } |
1634 | return GNUNET_OK; | 1648 | return GNUNET_OK; |
@@ -1638,7 +1652,8 @@ GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc) | |||
1638 | h = proc->handle; | 1652 | h = proc->handle; |
1639 | if (NULL == h) | 1653 | if (NULL == h) |
1640 | { | 1654 | { |
1641 | LOG (GNUNET_ERROR_TYPE_WARNING, "Invalid process information {%d, %08X}\n", | 1655 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1656 | "Invalid process information {%d, %08X}\n", | ||
1642 | proc->pid, h); | 1657 | proc->pid, h); |
1643 | return GNUNET_SYSERR; | 1658 | return GNUNET_SYSERR; |
1644 | } | 1659 | } |
@@ -1682,7 +1697,7 @@ struct GNUNET_OS_CommandHandle | |||
1682 | GNUNET_OS_LineProcessor proc; | 1697 | GNUNET_OS_LineProcessor proc; |
1683 | 1698 | ||
1684 | /** | 1699 | /** |
1685 | * Closure for 'proc'. | 1700 | * Closure for @e proc. |
1686 | */ | 1701 | */ |
1687 | void *proc_cls; | 1702 | void *proc_cls; |
1688 | 1703 | ||
@@ -1694,7 +1709,7 @@ struct GNUNET_OS_CommandHandle | |||
1694 | /** | 1709 | /** |
1695 | * Task reading from pipe. | 1710 | * Task reading from pipe. |
1696 | */ | 1711 | */ |
1697 | struct GNUNET_SCHEDULER_Task * rtask; | 1712 | struct GNUNET_SCHEDULER_Task *rtask; |
1698 | 1713 | ||
1699 | /** | 1714 | /** |
1700 | * When to time out. | 1715 | * When to time out. |
@@ -1790,15 +1805,17 @@ cmd_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1790 | * for each line of the output. | 1805 | * for each line of the output. |
1791 | * | 1806 | * |
1792 | * @param proc function to call for each line of the output | 1807 | * @param proc function to call for each line of the output |
1793 | * @param proc_cls closure for proc | 1808 | * @param proc_cls closure for @a proc |
1794 | * @param timeout when to time out | 1809 | * @param timeout when to time out |
1795 | * @param binary command to run | 1810 | * @param binary command to run |
1796 | * @param ... arguments to command | 1811 | * @param ... arguments to command |
1797 | * @return NULL on error | 1812 | * @return NULL on error |
1798 | */ | 1813 | */ |
1799 | struct GNUNET_OS_CommandHandle * | 1814 | struct GNUNET_OS_CommandHandle * |
1800 | GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc, void *proc_cls, | 1815 | GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc, |
1801 | struct GNUNET_TIME_Relative timeout, const char *binary, | 1816 | void *proc_cls, |
1817 | struct GNUNET_TIME_Relative timeout, | ||
1818 | const char *binary, | ||
1802 | ...) | 1819 | ...) |
1803 | { | 1820 | { |
1804 | struct GNUNET_OS_CommandHandle *cmd; | 1821 | struct GNUNET_OS_CommandHandle *cmd; |
diff --git a/src/util/strings.c b/src/util/strings.c index 407a135d1..51a9fd3dc 100644 --- a/src/util/strings.c +++ b/src/util/strings.c | |||
@@ -314,6 +314,8 @@ GNUNET_STRINGS_fancy_time_to_relative (const char *fancy_time, | |||
314 | { "days", 24 * 60 * 60 * 1000LL * 1000LL}, | 314 | { "days", 24 * 60 * 60 * 1000LL * 1000LL}, |
315 | { "week", 7 * 24 * 60 * 60 * 1000LL * 1000LL}, | 315 | { "week", 7 * 24 * 60 * 60 * 1000LL * 1000LL}, |
316 | { "weeks", 7 * 24 * 60 * 60 * 1000LL * 1000LL}, | 316 | { "weeks", 7 * 24 * 60 * 60 * 1000LL * 1000LL}, |
317 | { "year", 31536000000000LL /* year */ }, | ||
318 | { "years", 31536000000000LL /* year */ }, | ||
317 | { "a", 31536000000000LL /* year */ }, | 319 | { "a", 31536000000000LL /* year */ }, |
318 | { NULL, 0} | 320 | { NULL, 0} |
319 | }; | 321 | }; |