Changeset 368ee04 in mainline for uspace/app/bdsh


Ignore:
Timestamp:
2017-04-05T18:10:39Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
93ad8166
Parents:
39f892a9 (diff), 2166728 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jakub/helenos/vfs-2.5-cherrypick

This merge cherry-picks some of the changesets from Jiri Zarevucky's:

lp:~zarevucky-jiri/helenos/vfs-2.5

and then continues independently, yet sometime in a similar vein.

Roughly speaking, Jiri's branch is merged entirely up to its revision
1926 and then cherry-picked on and off until its revision 1965. Among
these changes are:

  • relativization of the API,
  • client-side roots,
  • server-side mounts,
  • inbox for passing arbitrary files from parent to child,
  • some streamlining and cleanup.

Additional changes include:

  • addressing issues introduced by the above changes,
  • client-side I/O cursors (file positions),
  • all HelenOS file system APIs begin with the vfs_ prefix and can be used after including vfs/vfs.h,
  • removal of some POSIX-ish headers and definitions,
  • additional cleanup.
Location:
uspace/app/bdsh
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/builtins/cd/cd.c

    r39f892a9 r368ee04  
    2929#include <stdio.h>
    3030#include <stdlib.h>
    31 #include <unistd.h>
    3231#include <str.h>
    3332#include <errno.h>
     33#include <vfs/vfs.h>
    3434
    3535#include "util.h"
     
    5151static bool previous_directory_set = false;
    5252
    53 static int chdir_and_remember(const char *new_dir) {
     53static int chdir_and_remember(const char *new_dir)
     54{
    5455
    55         char *ok = getcwd(previous_directory_tmp, PATH_MAX);
    56         previous_directory_valid = ok != NULL;
     56        int rc = vfs_cwd_get(previous_directory_tmp, PATH_MAX);
     57        previous_directory_valid = (rc == EOK);
    5758        previous_directory_set = true;
    5859
    59         if (chdir(new_dir) != 0)
    60                 return errno;
     60        rc = vfs_cwd_set(new_dir);
     61        if (rc != EOK)
     62                return rc;
    6163
    6264        str_cpy(previous_directory, PATH_MAX, previous_directory_tmp);
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    r39f892a9 r368ee04  
    3333#include <getopt.h>
    3434#include <str.h>
    35 #include <fcntl.h>
    3635#include <io/console.h>
    3736#include <io/color.h>
     
    187186        size_t offset = 0, copied_bytes = 0;
    188187        off64_t file_size = 0, length = 0;
     188        aoff64_t pos = 0;
    189189
    190190        bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0);
     
    195195                blen = STR_BOUNDS(1);
    196196        } else
    197                 fd = open(fname, O_RDONLY);
     197                fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ);
    198198       
    199199        if (fd < 0) {
     
    203203
    204204        if (NULL == (buff = (char *) malloc(blen + 1))) {
    205                 close(fd);
     205                vfs_put(fd);
    206206                printf("Unable to allocate enough memory to read %s\n",
    207                         fname);
     207                    fname);
    208208                return 1;
    209209        }
    210210
    211211        if (tail != CAT_FULL_FILE) {
    212                 file_size = lseek(fd, 0, SEEK_END);
     212                struct stat st;
     213
     214                if (vfs_stat(fd, &st) != EOK) {
     215                        vfs_put(fd);
     216                        free(buff);
     217                        printf("Unable to vfs_stat %d\n", fd);
     218                        return 1;
     219                }
     220                file_size = st.size;
    213221                if (head == CAT_FULL_FILE) {
    214222                        head = file_size;
     
    223231
    224232                if (tail_first) {
    225                         lseek(fd, (tail >= file_size) ? 0 : (file_size - tail), SEEK_SET);
     233                        pos = (tail >= file_size) ? 0 : (file_size - tail);
    226234                } else {
    227                         lseek(fd, ((head - tail) >= file_size) ? 0 : (head - tail), SEEK_SET);
     235                        pos = ((head - tail) >= file_size) ? 0 : (head - tail);
    228236                }
    229237        } else
     
    243251                }
    244252               
    245                 bytes = read(fd, buff + copied_bytes, bytes_to_read);
     253                bytes = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read);
    246254                copied_bytes = 0;
    247255
     
    279287        } while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));
    280288
    281         close(fd);
     289        vfs_put(fd);
    282290        if (bytes == -1) {
    283291                printf("Error reading %s\n", fname);
  • uspace/app/bdsh/cmds/modules/cmp/cmp.c

    r39f892a9 r368ee04  
    2828
    2929#include <errno.h>
    30 #include <fcntl.h>
    3130#include <getopt.h>
    3231#include <mem.h>
     
    7978        char buffer[2][CMP_BUFLEN];
    8079        ssize_t offset[2];
     80        aoff64_t pos[2] = {};
    8181
    8282        for (int i = 0; i < 2; i++) {
    83                 fd[i] = open(fn[i], O_RDONLY);
     83                fd[i] = vfs_lookup_open(fn[i], WALK_REGULAR, MODE_READ);
    8484                if (fd[i] < 0) {
    85                         rc = errno;
     85                        rc = fd[i];
    8686                        printf("Unable to open %s\n", fn[i]);
    8787                        goto end;
     
    9494                        ssize_t size;
    9595                        do {
    96                                 size = read(fd[i], buffer[i] + offset[i],
     96                                size = vfs_read(fd[i], &pos[i],
     97                                    buffer[i] + offset[i],
    9798                                    CMP_BUFLEN - offset[i]);
    9899                                if (size < 0) {
    99                                         rc = errno;
     100                                        rc = size;
    100101                                        printf("Error reading from %s\n",
    101102                                            fn[i]);
     
    115116end:
    116117        if (fd[0] >= 0)
    117                 close(fd[0]);
     118                vfs_put(fd[0]);
    118119        if (fd[1] >= 0)
    119                 close(fd[1]);
     120                vfs_put(fd[1]);
    120121        return rc;
    121122}
  • uspace/app/bdsh/cmds/modules/cp/cp.c

    r39f892a9 r368ee04  
    3535#include <getopt.h>
    3636#include <str.h>
    37 #include <fcntl.h>
    38 #include <sys/stat.h>
     37#include <vfs/vfs.h>
    3938#include <dirent.h>
    4039#include "config.h"
     
    8382        struct stat s;
    8483
    85         int r = stat(path, &s);
    86 
    87         if (r != 0)
     84        int r = vfs_stat_path(path, &s);
     85
     86        if (r != EOK)
    8887                return TYPE_NONE;
    8988        else if (s.is_directory)
     
    235234                         */
    236235                        if (force && !interactive) {
    237                                 if (unlink(dest_path) != 0) {
     236                                if (vfs_unlink_path(dest_path) != EOK) {
    238237                                        printf("Unable to remove %s\n",
    239238                                            dest_path);
     
    246245                                if (overwrite) {
    247246                                        printf("Overwriting file: %s\n", dest_path);
    248                                         if (unlink(dest_path) != 0) {
     247                                        if (vfs_unlink_path(dest_path) != EOK) {
    249248                                                printf("Unable to remove %s\n", dest_path);
    250249                                                goto exit;
     
    295294                                merge_paths(dest_path, PATH_MAX, src_dirname);
    296295
    297                                 if (mkdir(dest_path, 0) != 0) {
     296                                if (vfs_link_path(dest_path, KIND_DIRECTORY,
     297                                    NULL) != EOK) {
    298298                                        printf("Unable to create "
    299299                                            "dest directory %s\n", dest_path);
     
    309309                         * e.g. cp -r /src /data/new_dir_src
    310310                         */
    311                         if (mkdir(dest_path, 0) != 0) {
     311                        if (vfs_link_path(dest_path, KIND_DIRECTORY,
     312                            NULL) != EOK) {
    312313                                printf("Unable to create "
    313314                                    "dest directory %s\n", dest_path);
     
    341342
    342343                        /* Check if we are copying a directory into itself */
    343                         stat(src_dent, &src_s);
    344                         stat(dest_path, &dest_s);
     344                        vfs_stat_path(src_dent, &src_s);
     345                        vfs_stat_path(dest_path, &dest_s);
    345346
    346347                        if (dest_s.index == src_s.index &&
     
    377378        int64_t copied = 0;
    378379        char *buff = NULL;
     380        aoff64_t posr = 0, posw = 0;
     381        struct stat st;
    379382
    380383        if (vb)
    381384                printf("Copying %s to %s\n", src, dest);
    382385
    383         if (-1 == (fd1 = open(src, O_RDONLY))) {
     386        fd1 = vfs_lookup_open(src, WALK_REGULAR, MODE_READ);
     387        if (fd1 < 0) {
    384388                printf("Unable to open source file %s\n", src);
    385389                return -1;
    386390        }
    387391
    388         if (-1 == (fd2 = open(dest, O_CREAT))) {
     392        fd2 = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE);
     393        if (fd2 < 0) {
    389394                printf("Unable to open destination file %s\n", dest);
    390                 close(fd1);
     395                vfs_put(fd1);
    391396                return -1;
    392397        }
    393398
    394         total = lseek(fd1, 0, SEEK_END);
    395 
     399        if (vfs_stat(fd1, &st) != EOK) {
     400                printf("Unable to fstat %d\n", fd1);
     401                vfs_put(fd1);
     402                vfs_put(fd2);
     403                return -1;     
     404        }
     405
     406        total = st.size;
    396407        if (vb)
    397408                printf("%" PRIu64 " bytes to copy\n", total);
    398 
    399         lseek(fd1, 0, SEEK_SET);
    400409
    401410        if (NULL == (buff = (char *) malloc(blen))) {
     
    406415        }
    407416
    408         while ((bytes = read(fd1, buff, blen)) > 0) {
    409                 if ((bytes = write(fd2, buff, bytes)) < 0)
     417        while ((bytes = vfs_read(fd1, &posr, buff, blen)) > 0) {
     418                if ((bytes = vfs_write(fd2, &posw, buff, bytes)) < 0)
    410419                        break;
    411420                copied += bytes;
     
    413422
    414423        if (bytes < 0) {
    415                 printf("\nError copying %s, (%d)\n", src, errno);
     424                printf("\nError copying %s, (%d)\n", src, bytes);
    416425                copied = bytes;
    417426        }
    418427
    419428out:
    420         close(fd1);
    421         close(fd2);
     429        vfs_put(fd1);
     430        vfs_put(fd2);
    422431        if (buff)
    423432                free(buff);
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    r39f892a9 r368ee04  
    3434#include <stdio.h>
    3535#include <stdlib.h>
    36 #include <unistd.h>
    3736#include <dirent.h>
    38 #include <fcntl.h>
    3937#include <getopt.h>
    4038#include <sys/types.h>
    41 #include <sys/stat.h>
     39#include <vfs/vfs.h>
    4240#include <str.h>
    4341#include <sort.h>
     
    185183                buff[len] = '\0';
    186184
    187                 rc = stat(buff, &tosort[nbdirs++].s);
    188                 if (rc != 0) {
     185                rc = vfs_stat_path(buff, &tosort[nbdirs++].s);
     186                if (rc != EOK) {
    189187                        printf("ls: skipping bogus node %s\n", buff);
    190                         printf("error=%d\n", errno);
     188                        printf("error=%d\n", rc);
    191189                        goto out;
    192190                }
     
    315313static unsigned int ls_scope(const char *path, struct dir_elem_t *de)
    316314{
    317         if (stat(path, &de->s) != 0) {
     315        if (vfs_stat_path(path, &de->s) != EOK) {
    318316                cli_error(CL_ENOENT, "%s", path);
    319317                return LS_BOGUS;
     
    388386
    389387        if (argc == 0) {
    390                 if (getcwd(de.name, PATH_MAX) == NULL) {
     388                if (vfs_cwd_get(de.name, PATH_MAX) != EOK) {
    391389                        cli_error(CL_EFAIL, "%s: Failed determining working "
    392390                            "directory", cmdname);
  • uspace/app/bdsh/cmds/modules/ls/ls.h

    r39f892a9 r368ee04  
    11#ifndef LS_H
    22#define LS_H
     3
     4#include <vfs/vfs.h>
    35
    46/* Various values that can be returned by ls_scope() */
  • uspace/app/bdsh/cmds/modules/mkdir/mkdir.c

    r39f892a9 r368ee04  
    3030#include <stdlib.h>
    3131#include <dirent.h>
    32 #include <fcntl.h>
    3332#include <sys/types.h>
    34 #include <sys/stat.h>
    3533#include <getopt.h>
    3634#include <stdarg.h>
     
    9896
    9997        if (!create_parents) {
    100                 if (mkdir(path, 0) != 0) {
     98                ret = vfs_link_path(path, KIND_DIRECTORY, NULL);
     99                if (ret != EOK) {
    101100                        cli_error(CL_EFAIL, "%s: could not create %s (%s)",
    102                             cmdname, path, str_error(errno));
     101                            cmdname, path, str_error(ret));
    103102                        ret = 1;
    104103                }
     
    136135                        path[prev_off] = 0;
    137136
    138                         if (mkdir(path, 0) != 0 && errno != EEXIST) {
     137                        ret = vfs_link_path(path, KIND_DIRECTORY, NULL);
     138                        if (ret != EOK && ret != EEXIST) {
    139139                                cli_error(CL_EFAIL, "%s: could not create %s (%s)",
    140                                     cmdname, path, str_error(errno));
     140                                    cmdname, path, str_error(ret));
    141141                                ret = 1;
    142142                                goto leave;
     
    146146                }
    147147                /* Create the final directory. */
    148                 if (mkdir(path, 0) != 0) {
     148                ret = vfs_link_path(path, KIND_DIRECTORY, NULL);
     149                if (ret != EOK) {
    149150                        cli_error(CL_EFAIL, "%s: could not create %s (%s)",
    150                             cmdname, path, str_error(errno));
     151                            cmdname, path, str_error(ret));
    151152                        ret = 1;
    152153                }
     
    207208
    208209        if (follow && (argv[optind] != NULL)) {
    209                 if (chdir(argv[optind]) != 0)
     210                if (vfs_cwd_set(argv[optind]) != EOK)
    210211                        printf("%s: Error switching to directory.", cmdname);
    211212        }
  • uspace/app/bdsh/cmds/modules/mkfile/mkfile.c

    r39f892a9 r368ee04  
    3131#include <stdlib.h>
    3232#include <dirent.h>
    33 #include <fcntl.h>
    3433#include <sys/types.h>
    35 #include <sys/stat.h>
    3634#include <macros.h>
    3735#include <getopt.h>
     
    3937#include <str.h>
    4038#include <ctype.h>
     39#include <vfs/vfs.h>
    4140
    4241#include "config.h"
     
    121120        void *buffer;
    122121        bool create_sparse = false;
     122        aoff64_t pos = 0;
    123123
    124124        file_size = 0;
     
    156156        file_name = argv[optind];
    157157
    158         fd = open(file_name, O_CREAT | O_EXCL | O_WRONLY, 0666);
     158        fd = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MUST_CREATE, MODE_WRITE);
    159159        if (fd < 0) {
    160160                printf("%s: failed to create file %s.\n", cmdname, file_name);
     
    164164        if (create_sparse && file_size > 0) {
    165165                const char byte = 0x00;
    166 
    167                 if ((rc2 = lseek(fd, file_size - 1, SEEK_SET)) < 0) {
    168                         close(fd);
    169                         goto error;
    170                 }
    171 
    172                 rc2 = write(fd, &byte, sizeof(char));
     166               
     167                pos = file_size - 1;
     168                rc2 = vfs_write(fd, &pos, &byte, sizeof(char));
    173169                if (rc2 < 0) {
    174                         close(fd);
     170                        vfs_put(fd);
    175171                        goto error;
    176172                }
     
    187183        while (total_written < file_size) {
    188184                to_write = min(file_size - total_written, BUFFER_SIZE);
    189                 rc = write(fd, buffer, to_write);
     185                rc = vfs_write(fd, &pos, buffer, to_write);
    190186                if (rc <= 0) {
    191187                        printf("%s: Error writing file (%d).\n", cmdname, errno);
    192                         close(fd);
     188                        vfs_put(fd);
    193189                        free(buffer);
    194190                        return CMD_FAILURE;
     
    199195        free(buffer);
    200196
    201         if (close(fd) < 0)
     197        if (vfs_put(fd) < 0)
    202198                goto error;
    203199
  • uspace/app/bdsh/cmds/modules/mount/mount.c

    r39f892a9 r368ee04  
    3232#include <str_error.h>
    3333#include <vfs/vfs.h>
     34#include <vfs/vfs_mtab.h>
    3435#include <adt/list.h>
    3536#include <errno.h>
     
    8283
    8384                printf("%s", mtab_ent->fs_name);
    84                 if (mtab_ent->instance)
    85                         printf("/%d", mtab_ent->instance);
    8685
    8786                printf(" %s", mtab_ent->mp);
     
    9493                        printf(" (%" PRIun ")", mtab_ent->service_id);
    9594                }
    96 
    97                 if (str_size(mtab_ent->opts) > 0)
    98                         printf(" (%s)", mtab_ent->opts);
    9995
    10096                putchar('\n');
     
    151147                mopts = t_argv[4];
    152148
    153         rc = vfs_mount(t_argv[1], t_argv[2], dev, mopts, 0, instance);
     149        rc = vfs_mount_path(t_argv[2], t_argv[1], dev, mopts, 0, instance);
    154150        if (rc != EOK) {
    155151                printf("Unable to mount %s filesystem to %s on %s (rc=%s)\n",
    156                     t_argv[1], t_argv[2], t_argv[3], str_error(rc));
     152                    t_argv[2], t_argv[1], t_argv[3], str_error(rc));
    157153                return CMD_FAILURE;
    158154        }
  • uspace/app/bdsh/cmds/modules/mv/mv.c

    r39f892a9 r368ee04  
    3030#include <stdlib.h>
    3131#include <errno.h>
     32#include <vfs/vfs.h>
    3233#include "config.h"
    3334#include "util.h"
     
    5960        }
    6061
    61         rc = rename(argv[1], argv[2]);
    62         if (rc != 0) {
     62        rc = vfs_rename_path(argv[1], argv[2]);
     63        if (rc != EOK) {
    6364                printf("Unable to rename %s to %s (error=%d)\n",
    64                     argv[1], argv[2], errno);
     65                    argv[1], argv[2], rc);
    6566                return CMD_FAILURE;
    6667        }
  • uspace/app/bdsh/cmds/modules/pwd/pwd.c

    r39f892a9 r368ee04  
    3030#include <stdlib.h>
    3131#include <mem.h>
     32#include <vfs/vfs.h>
     33#include <abi/errno.h>
    3234
    3335#include "config.h"
     
    5759        memset(buff, 0, PATH_MAX);
    5860
    59         if (getcwd(buff, PATH_MAX) == NULL) {
     61        if (vfs_cwd_get(buff, PATH_MAX) != EOK) {
    6062                cli_error(CL_EFAIL,
    6163                        "Unable to determine the current working directory");
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    r39f892a9 r368ee04  
    3030#include <stdio.h>
    3131#include <stdlib.h>
    32 #include <unistd.h>
    33 #include <fcntl.h>
    3432#include <dirent.h>
    3533#include <getopt.h>
    3634#include <mem.h>
    3735#include <str.h>
     36#include <vfs/vfs.h>
    3837
    3938#include "config.h"
     
    110109        memset(rm->cwd, 0, PATH_MAX);
    111110
    112         chdir(".");
    113 
    114         if (NULL == (getcwd(rm->owd, PATH_MAX)))
     111        vfs_cwd_set(".");
     112
     113        if (EOK != vfs_cwd_get(rm->owd, PATH_MAX))
    115114                return 0;
    116115
     
    132131static unsigned int rm_single(const char *path)
    133132{
    134         if (unlink(path) != 0) {
     133        if (vfs_unlink_path(path) != EOK) {
    135134                cli_error(CL_EFAIL, "rm: could not remove file %s", path);
    136135                return 1;
     
    150149        }
    151150
    152         fd = open(path, O_RDONLY);
     151        fd = vfs_lookup(path, WALK_REGULAR);
    153152        if (fd >= 0) {
    154                 close(fd);
     153                vfs_put(fd);
    155154                return RM_FILE;
    156155        }
     
    201200
    202201        /* First see if it will just go away */
    203         rc = rmdir(path);
    204         if (rc == 0)
     202        rc = vfs_unlink_path(path);
     203        if (rc == EOK)
    205204                return 0;
    206205
     
    209208
    210209        /* Delete directory */
    211         rc = rmdir(path);
    212         if (rc == 0)
    213                 return errno;
     210        rc = vfs_unlink_path(path);
     211        if (rc == EOK)
     212                return EOK;
    214213
    215214        cli_error(CL_ENOTSUP, "Can not remove %s", path);
  • uspace/app/bdsh/cmds/modules/touch/touch.c

    r39f892a9 r368ee04  
    3535#include <stdlib.h>
    3636#include <unistd.h>
    37 #include <fcntl.h>
    3837#include <dirent.h>
    3938#include <sys/types.h>
    4039#include <str.h>
    4140#include <getopt.h>
    42 #include <sys/stat.h>
    4341#include <errno.h>
     42#include <vfs/vfs.h>
    4443
    4544#include "config.h"
     
    123122               
    124123                /* Check whether file exists if -c (--no-create) option is given */
    125                 if ((!no_create) || ((no_create) && (stat(buff, &file_stat) == 0)))
    126                         fd = open(buff, O_RDWR | O_CREAT);
     124                if ((!no_create) ||
     125                    ((no_create) && (vfs_stat_path(buff, &file_stat) == EOK))) {
     126                        fd = vfs_lookup(buff, WALK_REGULAR | WALK_MAY_CREATE);
     127                }
    127128               
    128129                if (fd < 0) {
     
    132133                        continue;
    133134                } else {
    134                         close(fd);
     135                        vfs_put(fd);
    135136                        fd = -1;
    136137                }
  • uspace/app/bdsh/cmds/modules/unmount/unmount.c

    r39f892a9 r368ee04  
    6666        }
    6767
    68         rc = vfs_unmount(argv[1]);
     68        rc = vfs_unmount_path(argv[1]);
    6969        if (rc != EOK) {
    7070                printf("Unable to unmount %s (rc=%d)\n", argv[1], rc);
  • uspace/app/bdsh/compl.c

    r39f892a9 r368ee04  
    3333#include <macros.h>
    3434#include <stdlib.h>
    35 #include <sys/stat.h>
     35#include <vfs/vfs.h>
    3636
    3737#include "cmds/cmds.h"
     
    360360                                asprintf(&ent_path, "%s/%s", *cs->path, dent->d_name);
    361361                                struct stat ent_stat;
    362                                 if (stat(ent_path, &ent_stat) != 0) {
     362                                if (vfs_stat_path(ent_path, &ent_stat) != EOK) {
    363363                                        /* Error */
    364364                                        free(ent_path);
  • uspace/app/bdsh/exec.c

    r39f892a9 r368ee04  
    3737#include <unistd.h>
    3838#include <str.h>
    39 #include <fcntl.h>
    4039#include <str_error.h>
    4140#include <errno.h>
     
    6059        int fd;
    6160
    62         fd = open(f, O_RDONLY);
     61        fd = vfs_lookup_open(f, WALK_REGULAR, MODE_READ);
    6362        if (fd >= 0) {
    64                 close(fd);
     63                vfs_put(fd);
    6564                return 0;
    6665        } else
     
    101100        char *tmp;
    102101        int rc, retval, i;
    103         int file_handles[3];
    104         int *file_handles_p[4];
     102        int file_handles[3] = { -1, -1, -1 };
    105103        FILE *files[3];
    106104
     
    113111       
    114112        for (i = 0; i < 3 && files[i] != NULL; i++) {
    115                 if (vfs_fhandle(files[i], &file_handles[i]) == EOK) {
    116                         file_handles_p[i] = &file_handles[i];
    117                 }
    118                 else {
    119                         file_handles_p[i] = NULL;
    120                 }
     113                vfs_fhandle(files[i], &file_handles[i]);
    121114        }
    122         file_handles_p[i] = NULL;
    123115
    124         rc = task_spawnvf(&tid, &twait, tmp, (const char **) argv, file_handles_p);
     116        rc = task_spawnvf(&tid, &twait, tmp, (const char **) argv,
     117            file_handles[0], file_handles[1], file_handles[2]);
    125118        free(tmp);
    126119
  • uspace/app/bdsh/util.c

    r39f892a9 r368ee04  
    3131#include <stdarg.h>
    3232#include <stdlib.h>
     33#include <vfs/vfs.h>
     34#include <abi/errno.h>
    3335
    3436#include "config.h"
     
    5860                return 1;
    5961        }
    60         if (!getcwd(usr->cwd, PATH_MAX))
     62        if (vfs_cwd_get(usr->cwd, PATH_MAX) != EOK)
    6163                snprintf(usr->cwd, PATH_MAX, "(unknown)");
    6264
Note: See TracChangeset for help on using the changeset viewer.