ustfork: Fix warning about volatile qualifier
authorOlivier Dion <odion@efficios.com>
Tue, 15 Aug 2023 14:47:06 +0000 (10:47 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 15 Aug 2023 19:28:33 +0000 (15:28 -0400)
Clang is strict about the volatile qualifier on function pointers. It
also wants pointers to be passed to atomic builtins, even for
functions. Therefore, use the addresses of function pointers even if
unnecessary according to C standard.

Change-Id: I5d553a46671cc4bfbe8de5cec2425201459f60d2
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/lib/lttng-ust-fork/ustfork.c

index 9508cc7520eaeb23145814c9976cd24b6501a2a3..3c489fee9f2ff262f3beed4bc0a61668c0471207 100644 (file)
@@ -28,7 +28,7 @@ pid_t fork(void)
        pid_t retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "fork");
                if (func == NULL) {
@@ -61,7 +61,7 @@ int daemon(int nochdir, int noclose)
        int retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "daemon");
                if (func == NULL) {
@@ -94,7 +94,7 @@ int setuid(uid_t uid)
        int retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "setuid");
                if (func == NULL) {
@@ -122,7 +122,7 @@ int setgid(gid_t gid)
        int retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "setgid");
                if (func == NULL) {
@@ -150,7 +150,7 @@ int seteuid(uid_t euid)
        int retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "seteuid");
                if (func == NULL) {
@@ -178,7 +178,7 @@ int setegid(gid_t egid)
        int retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "setegid");
                if (func == NULL) {
@@ -206,7 +206,7 @@ int setreuid(uid_t ruid, uid_t euid)
        int retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "setreuid");
                if (func == NULL) {
@@ -234,7 +234,7 @@ int setregid(gid_t rgid, gid_t egid)
        int retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "setregid");
                if (func == NULL) {
@@ -297,7 +297,7 @@ int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...)
        ctid = va_arg(ap, pid_t *);
        va_end(ap);
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "clone");
                if (func == NULL) {
@@ -338,7 +338,7 @@ int setns(int fd, int nstype)
        int retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "setns");
                if (func == NULL) {
@@ -366,7 +366,7 @@ int unshare(int flags)
        int retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "unshare");
                if (func == NULL) {
@@ -394,7 +394,7 @@ int setresuid(uid_t ruid, uid_t euid, uid_t suid)
        int retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "setresuid");
                if (func == NULL) {
@@ -422,7 +422,7 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid)
        int retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "setresgid");
                if (func == NULL) {
@@ -453,7 +453,7 @@ pid_t rfork(int flags)
        pid_t retval;
        int saved_errno;
 
-       func = uatomic_read(plibc_func);
+       func = uatomic_read(&plibc_func);
        if (func == NULL) {
                func = dlsym(RTLD_NEXT, "rfork");
                if (func == NULL) {
This page took 0.02694 seconds and 4 git commands to generate.