Skip to content

Chaotic Chameleon.1 #123

Merged
merged 30 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
689e97c
gpu-setup: Use flock
donald Feb 17, 2022
4e41689
gpu-setup: Tolerate empty pid files and pid file removal
donald Feb 17, 2022
47ce327
mxqd: Set "group initialized" message to debug level
donald Feb 17, 2022
922a46b
mxqadmin: Add missing initialization
donald Feb 18, 2022
7bd4b22
mxqkill: Add missing initialization
donald Feb 18, 2022
e58f37c
mx_proc: Add missing initialization
donald Feb 18, 2022
76a8287
tree: Remove "inline" function attributes
donald Feb 21, 2022
69f9f1c
tree: Remove "extern" function attributes
donald Feb 21, 2022
2cbc3e8
mx_getopt: Remove dead code
donald Feb 21, 2022
50a8a3d
mx_mysql: Remove dead code
donald Feb 21, 2022
09da264
mx_daemon: Remove dead code
donald Feb 21, 2022
90f3a36
tree: Convert some functions into static
donald Feb 21, 2022
ea504b4
tree; Remove dead stores
donald Feb 21, 2022
3ce871a
tree: Apply cosmetics
donald Feb 21, 2022
76b7022
mx_flock: Don't call _flock_free to early
donald Feb 18, 2022
4f87991
mxqd: Only process parsable fspool files
donald Feb 18, 2022
523b995
mxqd: Remove capability to run as non-root
donald Feb 18, 2022
218e94a
mx_call_external: Change EPIPE to EPROTO
donald Feb 18, 2022
1690ccb
Doxfile: Update for Doxygen 1.8.18
donald Feb 19, 2022
05aaace
mxqd: Fix accidental doxygen comment
donald Feb 19, 2022
80c1e09
tree: Remove some dead stores
donald Feb 19, 2022
2b08bbd
mxqd: Fix uninitialized value in error message
donald Feb 19, 2022
049ef4d
mxqd: Fix use after free
donald Feb 19, 2022
ef54844
tree: Replace perror() with mx_log_err("... %m")
donald Feb 19, 2022
addc997
mxqd: Remove unused variable
donald Feb 20, 2022
e402066
mxqd: Remove dead stores
donald Feb 20, 2022
0de4433
mxqd: Move variables into block scope
donald Feb 20, 2022
3f2fe00
mxqd: Remove unnecessary cd(pwd)
donald Feb 20, 2022
c45a22e
mxqd: Simplify reexec
donald Feb 20, 2022
06562ea
mxqd: Remove pointless loop
donald Feb 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
254 changes: 181 additions & 73 deletions Doxyfile

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions helper/gpu-setup
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,11 @@ job_init() {
pid=$1
uid=$2

# we have no locking here, but mxqd is single-threaded

test -d /dev/shm/mxqd/gpu_devs || die "$0: Not initialized (no dir /dev/shm/mxqd/gpu_devs)"

shopt -s nullglob
for d in /dev/shm/mxqd/gpu_devs/???; do
if [ ! -e $d/pid ]; then
if pid=$pid f=$d/pid flock $d/pid -c 'test -s $f && exit 1; echo $pid>$f'; then
for f in $(cat $d/access-files); do
case $f in
/dev/nvidia-caps/nvidia-cap*)
Expand All @@ -198,7 +196,6 @@ job_init() {
;;
esac
done
echo $pid > $d/pid
cat $d/uuid
exit
fi
Expand All @@ -213,7 +210,7 @@ job_release() {
test -d /dev/shm/mxqd/gpu_devs || die "$0: Not initialized (no dir /dev/shm/mxqd/gpu_devs)"
for d in /dev/shm/mxqd/gpu_devs/???; do
if [ -e $d/pid ]; then
test_pid=$(cat $d/pid)
test_pid="$(cat $d/pid 2>/dev/null)"
if [ "$pid" = "$test_pid" ]; then
rm $d/pid
for f in $(cat $d/access-files); do
Expand Down
9 changes: 4 additions & 5 deletions mx_flock.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#define _GNU_SOURCE

#include <sys/types.h>
Expand All @@ -21,7 +20,7 @@
# define mx_free_null(a) do { free((a)); (a) = NULL; } while(0)
#endif

static inline int _flock_open(struct mx_flock *lock, mode_t mode)
static int _flock_open(struct mx_flock *lock, mode_t mode)
{
int fd;

Expand All @@ -39,7 +38,7 @@ static inline int _flock_open(struct mx_flock *lock, mode_t mode)
return fd;
}

static inline int _flock_close(struct mx_flock *lock)
static int _flock_close(struct mx_flock *lock)
{
int res;

Expand All @@ -53,7 +52,7 @@ static inline int _flock_close(struct mx_flock *lock)
return res;
}

static inline void _flock_free(struct mx_flock *lock)
static void _flock_free(struct mx_flock *lock)
{
if (!lock)
return;
Expand Down Expand Up @@ -90,7 +89,7 @@ struct mx_flock *mx_flock(int operation, char *fmt, ...)

if (res == -1) {
mx_log_err("vasprintf(): %m");
_flock_free(lock);
free(lock);
return NULL;
}

Expand Down
20 changes: 1 addition & 19 deletions mx_getopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ void mx_getopt_pop_current_argument(struct mx_getopt_ctl *optctl)
optctl->_argc--;
}

void mx_getopt_pop_all_arguments(struct mx_getopt_ctl *optctl)
static void mx_getopt_pop_all_arguments(struct mx_getopt_ctl *optctl)
{
while(optctl->optind < optctl->_argc)
mx_getopt_pop_current_argument(optctl);
Expand Down Expand Up @@ -396,11 +396,6 @@ static int _mx_getopt_long(struct mx_getopt_ctl *optctl, int *optindex)
return handle_option(optctl, idx);
}

int mx_getopt_long(struct mx_getopt_ctl *optctl, int *optindex)
{
return _mx_getopt_long(optctl, optindex);
}

int mx_getopt(struct mx_getopt_ctl *optctl, int *optindex)
{
int opt;
Expand Down Expand Up @@ -455,16 +450,3 @@ int mx_getopt(struct mx_getopt_ctl *optctl, int *optindex)

return opt;
}

void mx_getopt_print_quoted(char *s)
{
putchar('\'');
while (*s) {
if (*s == '\'')
printf("'\\''");
else
putchar(*s);
s++;
}
putchar('\'');
}
4 changes: 0 additions & 4 deletions mx_getopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,5 @@ struct mx_getopt_ctl {
void mx_getopt_pop_current_argument(struct mx_getopt_ctl *optctl);

int mx_getopt_init(struct mx_getopt_ctl *ctl, int argc, char **argv, struct mx_option *optv);
int mx_getopt_long(struct mx_getopt_ctl *optctl, int *optindex);
int mx_getopt(struct mx_getopt_ctl *optctl, int *optindex);

void mx_getopt_print_quoted(char *s);

#endif
6 changes: 1 addition & 5 deletions mx_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ int mx_log_printf(const char *fmt, ...)
{
int len;
int len2;
int res;
char *msg = NULL;
va_list ap;

Expand All @@ -84,15 +83,12 @@ int mx_log_printf(const char *fmt, ...)
}

len2 = fprintf(stderr, "%s\n", msg);
res = fflush(stderr);
fflush(stderr);
mx_free_null(msg);

if (len2 != len+1)
return -(errno=EIO);

if (!res)
res = 0;

return len;
}

Expand Down
2 changes: 1 addition & 1 deletion mx_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int mx_log_level_get(void);
int mx_log_level_mxlog_to_syslog(int level);
int mx_log_level_syslog_to_mxlog(int level);

int mx_log_do(int level, char *file, unsigned long line, const char *func, const char *fmt, ...) __attribute__ ((format(printf, 5, 6)));;
int mx_log_do(int level, char *file, unsigned long line, const char *func, const char *fmt, ...) __attribute__ ((format(printf, 5, 6)));
int mx_log_printf(const char *fmt, ...);

int mx_log_finish(void);
Expand Down
Loading