[uCsimm] BIIIIG conceptual problem with ucLinux

From: Vadim Lebedev (vlebedev@aplio.fr)
Date: Thu Feb 03 2000 - 11:10:21 EST


Hello,

I've just stumbled on the follwoing problem with ucLinux
Lets say task A does:

        if (!vfork())
        {
                execxxx(...);
        }

        execlp fails....
        the code doing the system call will try to store the error code into
        the errno variable
      (well actiually the errno is defined as *get_errno_addr())
        but this varible is sitting in the data segment of the parent task!!!!

I have couple of ideas how to solve this problem

1.
introduce a new system call "spawnxxx" which combines internally vfork and
execxxx.....

or

2.
  2.1 declare a private data block in the kernel task structure,
      called:
        char crtdata[CRTDATASIZE];

  2.2 make following changets to crt0.s
        start: br next
        _get_thread_data:
                 jmp 0
      next:

  2.3 binfmt_flat loader will patch the jmp instruction with address
         of the kernel routine kernel_get_thread_data:

        void* kernel_get_thread_data()
        {
                return current->crtdata;
        }

  2.4 get_errno_addr becomes
        int* get_errno_addr()
        {
           (int*) get_thread_data();
        }

  This appoach will eventually allow as to build a multi-threaded ucLibc....

What do you think?

Vadim

This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/



This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:34 EST