tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Idea for *at system calls


I had an idea how to implement the *at system calls in a less nasty way.
We invent to new system calls:

        int push_thread_cwd(int filedes);
        int pop_thread_cwd();

With those system calls openat() could be implemented like this
(the "mode" bit isn't correct, but you might get the idea):

openat(int filedes, const char *path, int oflag, mode_t mode)
        int error, newfildes;

        error = push_thread_cwd(filedes);
        if (error != 0) {
                errno = error;
                return -1;

        newfiledes = open(path, oflag, mode);

        assert(pop_thread_cwd() == 0);

        return newfiledes;

This way we would only need two new system calls.

        Kind regards

Matthias Scheler                        

Home | Main Index | Thread Index | Old Index