Fixed the sys_proc_create API to use const pointers (XCC)
authorDavide Libenzi <dlibenzi@google.com>
Wed, 2 Dec 2015 17:20:41 +0000 (09:20 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 16 Dec 2015 21:27:06 +0000 (16:27 -0500)
Fixed the sys_proc_create API to use const pointers.

Rebuild glibc.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
[XCC / rebuild notice]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
tests/childfdmap.c
tests/serialize_test.c
tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/serialize.c
user/parlib/include/parlib.h
user/parlib/include/serialize.h
user/parlib/syscall.c

index 494fafb..a7b412d 100644 (file)
@@ -59,7 +59,8 @@ int main(int argc, char *argv[])
        child_argv[1] = "1"; /* dummy arg, signal so we know they're the child */
        child_argv[2] = 0;
 
-       kid = sys_proc_create(filename, strlen(filename), child_argv, NULL, 0);
+       kid = sys_proc_create(filename, strlen(filename),
+                                                 (const char * const *) child_argv, NULL, 0);
        if (kid < 0) {
                perror("create failed");
                exit(1);
index 60c0f5c..128c618 100644 (file)
@@ -8,7 +8,9 @@
 
 int main(int argc, char **argv, char **envp)
 {
-       struct serialized_data *sd = serialize_argv_envp(argv, envp);
+       struct serialized_data *sd =
+               serialize_argv_envp((const char * const *) argv,
+                                                       (const char * const *) envp);
        size_t *kargc = (size_t*)sd->buf;
        size_t *kenvc = (size_t*)(sd->buf + sizeof(size_t));
        char **kargv = (char**)(sd->buf + 2*sizeof(size_t));
index 7530da0..ca630e9 100644 (file)
@@ -8,8 +8,8 @@
 #include <stddef.h>
 #include <stdint.h>
 
-struct serialized_data* serialize_argv_envp(char* const* argv,
-                                            char* const* envp)
+struct serialized_data *serialize_argv_envp(const char * const *argv,
+                                            const char * const *envp)
 {
        size_t bufsize = 0;
        size_t argc = 0, envc = 0;
index d8a9083..7cab4e8 100644 (file)
@@ -34,8 +34,9 @@ size_t      sys_getpcoreid(void);
 int         sys_getpid(void);
 int         sys_proc_destroy(int pid, int exitcode);
 void        sys_yield(bool being_nice);
-int         sys_proc_create(char *path, size_t path_l, char *argv[],
-                            char *envp[], int flags);
+int         sys_proc_create(const char *path, size_t path_l,
+                            const char * const *argv, const char * const *envp,
+                            int flags);
 int         sys_proc_run(int pid);
 ssize_t     sys_shared_page_alloc(void **addr, pid_t p2, 
                                   int p1_flags, int p2_flags);
index 7bdc39f..6e2b4cb 100644 (file)
@@ -10,6 +10,6 @@ struct serialized_data {
        size_t len;
        char buf[];
 };
-extern struct serialized_data* serialize_argv_envp(char* const* argv,
-                                                   char* const* envp);
-extern void free_serialized_data(struct serialized_datasd);
+extern struct serialized_data *serialize_argv_envp(const char * const *argv,
+                                                   const char * const *envp);
+extern void free_serialized_data(struct serialized_data *sd);
index be5af7d..a20cdc7 100644 (file)
@@ -57,8 +57,8 @@ void sys_yield(bool being_nice)
        ros_syscall(SYS_yield, being_nice, 0, 0, 0, 0, 0);
 }
 
-int sys_proc_create(char *path, size_t path_l, char *argv[], char *envp[],
-                    int flags)
+int sys_proc_create(const char *path, size_t path_l, const char * const *argv,
+                                       const char * const *envp, int flags)
 {
        struct serialized_data *sd = serialize_argv_envp(argv, envp);
        if (!sd) {