projectatomic / oci-systemd-hook

OCI hook to enable running systemd in a container
GNU General Public License v3.0
64 stars 26 forks source link

Use Jansson API instead of YAJL #103

Open lsm5 opened 6 years ago

lsm5 commented 6 years ago

YAJL upstream has been pretty much dead for a while now.

Signed-off-by: Lokesh Mandvekar lsm5@fedoraproject.org

modified: Makefile.am modified: configure.ac modified: src/systemdhook.c

@mrunalp @rhatdan I'm able to run containers with this commit. Let me know if there's any other testing needed.

rhatdan commented 6 years ago

Can you clean up some of the compiler warnings?

src/systemdhook.c: In function ‘main’:
src/systemdhook.c:842:25: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  char *container_uuid = json_string_value(v_id);
                         ^~~~~~~~~~~~~~~~~
src/systemdhook.c:860:11: warning: unused variable ‘v_bundle_path’ [-Wunused-variable]
   json_t *v_bundle_path = json_object_get(node, "bundlePath");
           ^~~~~~~~~~~~~
src/systemdhook.c:907:20: warning: initialization of ‘json_t *’ {aka ‘struct json_t *’} from ‘size_t’ {aka ‘long unsigned int’} makes pointer from integer without a cast [-Wint-conversion]
    json_t *v_env = json_array_size(v_envs);
                    ^~~~~~~~~~~~~~~
src/systemdhook.c:908:16: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
    char *str = json_string_value(v_env);
                ^~~~~~~~~~~~~~~~~
src/systemdhook.c:936:26: warning: passing argument 1 of ‘json_string_value’ makes pointer from integer without a cast [-Wint-conversion]
  cmd = json_string_value(v_arg0_value);
                          ^~~~~~~~~~~~
In file included from src/systemdhook.c:21:
/usr/include/jansson.h:266:13: note: expected ‘const json_t *’ {aka ‘const struct json_t *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’}
 const char *json_string_value(const json_t *string);
             ^~~~~~~~~~~~~~~~~
src/systemdhook.c:936:6: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  cmd = json_string_value(v_arg0_value);
      ^
src/systemdhook.c:956:17: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  char *rootfs = json_string_value(v_root);
                 ^~~~~~~~~~~~~~~~~
src/systemdhook.c:990:43: warning: passing argument 1 of ‘json_object_get’ makes pointer from integer without a cast [-Wint-conversion]
   json_t *v_destination = json_object_get(v_mounts_values, "destination");
                                           ^~~~~~~~~~~~~~~
In file included from src/systemdhook.c:21:
/usr/include/jansson.h:188:9: note: expected ‘const json_t *’ {aka ‘const struct json_t *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’}
 json_t *json_object_get(const json_t *object, const char *key);
         ^~~~~~~~~~~~~~~
src/systemdhook.c:1017:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   mount_label = v_mount ? json_string_value(v_mount) : "";
               ^
src/systemdhook.c:1039:45: warning: passing argument 1 of ‘json_object_get’ makes pointer from integer without a cast [-Wint-conversion]
     json_t *v_containerId = json_object_get(v_gidMappings_values, "containerID");
                                             ^~~~~~~~~~~~~~~~~~~~
In file included from src/systemdhook.c:21:
/usr/include/jansson.h:188:9: note: expected ‘const json_t *’ {aka ‘const struct json_t *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’}
 json_t *json_object_get(const json_t *object, const char *key);
         ^~~~~~~~~~~~~~~
src/systemdhook.c:1041:38: warning: passing argument 1 of ‘json_object_get’ makes pointer from integer without a cast [-Wint-conversion]
      json_t *v_gid = json_object_get(v_gidMappings_values, "hostID");
                                      ^~~~~~~~~~~~~~~~~~~~
In file included from src/systemdhook.c:21:
/usr/include/jansson.h:188:9: note: expected ‘const json_t *’ {aka ‘const struct json_t *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’}
 json_t *json_object_get(const json_t *object, const char *key);
         ^~~~~~~~~~~~~~~
src/systemdhook.c:1069:45: warning: passing argument 1 of ‘json_object_get’ makes pointer from integer without a cast [-Wint-conversion]
     json_t *v_containerId = json_object_get(v_uidMappings_values, "containerID");
                                             ^~~~~~~~~~~~~~~~~~~~
In file included from src/systemdhook.c:21:
/usr/include/jansson.h:188:9: note: expected ‘const json_t *’ {aka ‘const struct json_t *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’}
 json_t *json_object_get(const json_t *object, const char *key);
         ^~~~~~~~~~~~~~~
src/systemdhook.c:1071:38: warning: passing argument 1 of ‘json_object_get’ makes pointer from integer without a cast [-Wint-conversion]
      json_t *v_uid = json_object_get(v_uidMappings_values, "hostID");
                                      ^~~~~~~~~~~~~~~~~~~~
In file included from src/systemdhook.c:21:
/usr/include/jansson.h:188:9: note: expected ‘const json_t *’ {aka ‘const struct json_t *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’}
 json_t *json_object_get(const json_t *object, const char *key);
         ^~~~~~~~~~~~~~~
mv -f src/.deps/oci_systemd_hook-systemdhook.Tpo src/.deps/oci_systemd_hook-systemdhook.Po
gcc -Wall -Wextra -std=c99   -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid  -g -O2   -o oci-systemd-hook src/oci_systemd_hook-systemdhook.o -ljansson  -lselinux  -lmount  
make[1]: Leaving directory '/home/dwalsh/oci/oci-systemd-hook'
lsm5 commented 6 years ago

ha, will do :)

rhatdan commented 6 years ago

@lsm5 Any progress on this?

lsm5 commented 6 years ago

Yup, but still need some more testing, kinda busy with modules atm, but I'll get back to this asap

On Wed, Aug 08, 2018 at 05:58:59AM -0700, Daniel J Walsh wrote:

@lsm5 Any progress on this?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/projectatomic/oci-systemd-hook/pull/103#issuecomment-411396102

-- Lokesh IRC: lsm5 GPG: 0xC7C3A0DD https://keybase.io/lsm5