Skip to content

Commit 2dca8b3

Browse files
authored
Merge pull request #17 from viveris/master
Upstream sync
2 parents f90ed0f + ef7a6fd commit 2dca8b3

File tree

8 files changed

+165
-134
lines changed

8 files changed

+165
-134
lines changed

.github/workflows/ccpp.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
name: C/C++ CI
22

3-
on: [push]
3+
on: [push, pull_request, workflow_dispatch]
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-latest
9-
108
steps:
119
- uses: actions/checkout@v1
1210
- name: make
13-
run: make
11+
run: |
12+
make
13+
make clean
14+
make DEBUG=1
15+
sudo apt-get install libsystemd-dev
16+
make clean
17+
make SYSTEMD=1
18+
make clean
19+
make USE_SYSLOG=1
20+
make clean
21+
make OLD_FUNCTIONFS_DESCRIPTORS=1

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
CFLAGS += -I./inc -lpthread -Wall
1+
CFLAGS += -I./inc -Wall
2+
LDFLAGS += -lpthread -lrt
23

34
sources := $(wildcard src/*.c)
45
objects := $(sources:src/%.c=obj/%.o)
@@ -29,7 +30,7 @@ endif
2930
all: umtprd
3031

3132
umtprd: $(objects) $(ops_objects)
32-
${CC} -o $@ $^ $(LDFLAGS) -lpthread
33+
${CC} -o $@ $^ $(LDFLAGS)
3334

3435
$(objects): obj/%.o: src/%.c | output_dir
3536
${CC} -o $@ $^ -c $(CPPFLAGS) $(CFLAGS)

inc/logs_out.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,42 +63,42 @@ void timestamp(char * timestr, int maxsize);
6363

6464
#else // Stdout usage
6565

66-
#define PRINT_MSG(fmt, args...) { \
66+
#define PRINT_MSG(fmt, args...) do { \
6767
char timestr[32]; \
6868
timestamp((char*)&timestr, sizeof(timestr)); \
6969
fprintf(stdout, \
7070
"[uMTPrd - %s - Info] " fmt "\n",(char*)&timestr, \
7171
## args); \
7272
fflush(stdout); \
73-
}
73+
} while (0)
7474

75-
#define PRINT_ERROR(fmt, args...) { \
75+
#define PRINT_ERROR(fmt, args...) do { \
7676
char timestr[32]; \
7777
timestamp((char*)&timestr, sizeof(timestr)); \
7878
fprintf(stderr, \
7979
"[uMTPrd - %s - Error] " fmt "\n",(char*)&timestr, \
8080
## args); \
8181
fflush(stderr); \
82-
}
82+
} while (0)
8383

84-
#define PRINT_WARN(fmt, args...) { \
84+
#define PRINT_WARN(fmt, args...) do { \
8585
char timestr[32]; \
8686
timestamp((char*)&timestr, sizeof(timestr)); \
8787
fprintf(stdout, \
8888
"[uMTPrd - %s - Warning] " fmt "\n",(char*)&timestr, \
8989
## args); \
9090
fflush(stdout); \
91-
}
91+
} while (0)
9292

9393
#ifdef DEBUG
94-
#define PRINT_DEBUG(fmt, args...) { \
94+
#define PRINT_DEBUG(fmt, args...) do { \
9595
char timestr[32]; \
9696
timestamp((char*)&timestr, sizeof(timestr)); \
9797
fprintf(stdout, \
9898
"[uMTPrd - %s - Debug] " fmt "\n",(char*)&timestr, \
9999
## args); \
100100
fflush(stdout); \
101-
}
101+
} while (0)
102102
#else
103103

104104
#define PRINT_DEBUG(fmt, args...)

inc/msgqueue.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#include <mqueue.h>
2+
13
int msgqueue_handler_init( mtp_ctx * ctx );
24
int msgqueue_handler_deinit( mtp_ctx * ctx );
3-
5+
mqd_t get_message_queue();
46
int send_message_queue( char * message );

src/inotify.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <pthread.h>
3131
#include <string.h>
3232
#include <sys/inotify.h>
33+
#include <sys/prctl.h>
3334
#include <unistd.h>
3435
#include <signal.h>
3536

@@ -88,12 +89,12 @@ static int get_file_info(mtp_ctx * ctx, const struct inotify_event *event, fs_en
8889
return 0;
8990
}
9091

91-
void *inotify_gotsig(int sig, siginfo_t *info, void *ucontext)
92+
static void *inotify_gotsig(int sig, siginfo_t *info, void *ucontext)
9293
{
9394
return NULL;
9495
}
9596

96-
void* inotify_thread(void* arg)
97+
static void* inotify_thread(void* arg)
9798
{
9899
mtp_ctx * ctx;
99100
int i, length;
@@ -109,6 +110,8 @@ void* inotify_thread(void* arg)
109110
const struct inotify_event *event;
110111
struct sigaction sa;
111112

113+
prctl(PR_SET_NAME, (unsigned long) __func__);
114+
112115
ctx = (mtp_ctx *)arg;
113116

114117
sa.sa_handler = NULL;

0 commit comments

Comments
 (0)