Changeset 7171760 in mainline for uspace/app


Ignore:
Timestamp:
2011-08-18T12:05:00Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b33ec43
Parents:
866e627
Message:

Rework the way how open files are passed from parent task to child.

  • Instead of passing fdi_node_t's, pass handles directly using the IPC_M_STATE_CHANGE_AUTHORIZE mechanism.
  • Remove open_node(), fd_node(), fdi_node_t.
  • Replace fopen_node() with fopen_handle().
  • Replace fnode() with fhandle().
  • The child task does not synchronize with VFS yet.
Location:
uspace/app
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/exec.c

    r866e627 r7171760  
    100100        char *tmp;
    101101        int rc, retval, i;
    102         fdi_node_t file_nodes[3];
    103         fdi_node_t *file_nodes_p[4];
     102        int file_handles[3];
     103        int *file_handles_p[4];
    104104        FILE *files[3];
    105105
     
    112112       
    113113        for (i = 0; i < 3 && files[i] != NULL; i++) {
    114                 if (fnode(files[i], &file_nodes[i]) == EOK) {
    115                         file_nodes_p[i] = &file_nodes[i];
     114                if (fhandle(files[i], &file_handles[i]) == EOK) {
     115                        file_handles_p[i] = &file_handles[i];
    116116                }
    117117                else {
    118                         file_nodes_p[i] = NULL;
     118                        file_handles_p[i] = NULL;
    119119                }
    120120        }
    121         file_nodes_p[i] = NULL;
     121        file_handles_p[i] = NULL;
    122122
    123         rc = task_spawnvf(&tid, tmp, (const char **) argv, file_nodes_p);
     123        rc = task_spawnvf(&tid, tmp, (const char **) argv, file_handles_p);
    124124        free(tmp);
    125125
  • uspace/app/trace/trace.c

    r866e627 r7171760  
    587587
    588588        /* Send default files */
    589         fdi_node_t *files[4];
    590         fdi_node_t stdin_node;
    591         fdi_node_t stdout_node;
    592         fdi_node_t stderr_node;
    593        
    594         if ((stdin != NULL) && (fnode(stdin, &stdin_node) == EOK))
    595                 files[0] = &stdin_node;
     589        int *files[4];
     590        int fd_stdin;
     591        int fd_stdout;
     592        int fd_stderr;
     593       
     594        if ((stdin != NULL) && (fhandle(stdin, &fd_stdin) == EOK))
     595                files[0] = &fd_stdin;
    596596        else
    597597                files[0] = NULL;
    598598       
    599         if ((stdout != NULL) && (fnode(stdout, &stdout_node) == EOK))
    600                 files[1] = &stdout_node;
     599        if ((stdout != NULL) && (fhandle(stdout, &fd_stdout) == EOK))
     600                files[1] = &fd_stdout;
    601601        else
    602602                files[1] = NULL;
    603603       
    604         if ((stderr != NULL) && (fnode(stderr, &stderr_node) == EOK))
    605                 files[2] = &stderr_node;
     604        if ((stderr != NULL) && (fhandle(stderr, &fd_stderr) == EOK))
     605                files[2] = &fd_stderr;
    606606        else
    607607                files[2] = NULL;
     
    762762        o = oper_new("open", 2, arg_def, V_INT_ERRNO, 0, resp_def);
    763763        proto_add_oper(p, VFS_IN_OPEN, o);
    764         o = oper_new("open_node", 4, arg_def, V_INT_ERRNO, 0, resp_def);
    765         proto_add_oper(p, VFS_IN_OPEN_NODE, o);
    766764        o = oper_new("read", 1, arg_def, V_ERRNO, 1, resp_def);
    767765        proto_add_oper(p, VFS_IN_READ, o);
Note: See TracChangeset for help on using the changeset viewer.