diff --git a/doc/man.md.j2 b/doc/man.md.j2 index 926a1cbb..13d3fa8e 100644 --- a/doc/man.md.j2 +++ b/doc/man.md.j2 @@ -163,7 +163,7 @@ file. **-U \| \--unique** : Conky won't start if another Conky process is already running. Implemented - only for Linux, FreeBSD, NetBSD and Haiku. + only for Linux, FreeBSD, NetBSD, OpenBSD and Haiku. **-v \| -V \| \--version** diff --git a/src/conky.cc b/src/conky.cc index d8ca6946..e7db9bb1 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -2112,9 +2112,9 @@ void set_current_config() { const char *getopt_string = "vVqdDSs:t:u:i:hc:p:" #if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__HAIKU__) || defined(__NetBSD__) + defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__) "U" -#endif /* Linux || FreeBSD || Haiku || NetBSD */ +#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */ #ifdef BUILD_X11 "x:y:w:a:X:m:f:" #ifdef OWN_WINDOW @@ -2146,9 +2146,9 @@ const struct option longopts[] = { {"text", 1, nullptr, 't'}, {"interval", 1, nullptr, 'u'}, {"pause", 1, nullptr, 'p'}, #if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__HAIKU__) || defined(__NetBSD__) + defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__) {"unique", 0, nullptr, 'U'}, -#endif /* Linux || FreeBSDi || Haiku || NetBSD */ +#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */ {nullptr, 0, nullptr, 0} }; diff --git a/src/data/os/openbsd.cc b/src/data/os/openbsd.cc index c45519fc..13c379da 100644 --- a/src/data/os/openbsd.cc +++ b/src/data/os/openbsd.cc @@ -444,3 +444,8 @@ void prepare_update() {} int get_entropy_avail(unsigned int *val) { return 1; } int get_entropy_poolsize(unsigned int *val) { return 1; } + +bool is_conky_already_running() { + return bsdcommon::is_conky_already_running(); +} + diff --git a/src/data/os/openbsd.h b/src/data/os/openbsd.h index b08c8756..6067b2ac 100644 --- a/src/data/os/openbsd.h +++ b/src/data/os/openbsd.h @@ -30,4 +30,6 @@ typedef struct apm_power_info *apm_info_t; int get_entropy_avail(unsigned int *); int get_entropy_poolsize(unsigned int *); +bool is_conky_already_running(); + #endif /*OPENBSD_H_*/ diff --git a/src/main.cc b/src/main.cc index 2a557100..002d4523 100644 --- a/src/main.cc +++ b/src/main.cc @@ -56,6 +56,10 @@ #include "data/os/netbsd.h" #endif /* NetBSD */ +#if defined(__OpenBSD__) +#include "data/os/openbsd.h" +#endif /* OpenBSD */ + #if defined(__HAIKU__) #include "data/os/haiku.h" #endif /* Haiku */ @@ -282,9 +286,9 @@ static void print_help(const char *prog_name) { " -p, --pause=SECS pause for SECS seconds at startup " "before doing anything\n" #if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__HAIKU__) || defined(__NetBSD__) + defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__) " -U, --unique only one conky process can be created\n" -#endif /* Linux || FreeBSD || Haiku || NetBSD */ +#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */ , prog_name); } @@ -368,23 +372,23 @@ int main(int argc, char **argv) { break; #endif /* BUILD_X11 */ #if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__HAIKU__) || defined(__NetBSD__) + defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__) case 'U': unique_process = true; break; -#endif /* Linux || FreeBSD || Haiku || NetBSD */ +#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */ case '?': return EXIT_FAILURE; } } #if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__HAIKU__) || defined(__NetBSD__) + defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__) if (unique_process && is_conky_already_running()) { NORM_ERR("already running"); return 0; } -#endif /* Linux || FreeBSD || Haiku */ +#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */ try { set_current_config();