qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 02/10] bsd-user: Implement symlink, symlinkat, readlink and r


From: Warner Losh
Subject: Re: [PATCH 02/10] bsd-user: Implement symlink, symlinkat, readlink and readlinkat
Date: Mon, 20 Jun 2022 14:17:23 -0600



On Mon, Jun 20, 2022 at 12:28 PM Richard Henderson <richard.henderson@linaro.org> wrote:
On 6/20/22 10:42, Warner Losh wrote:
> +static abi_long do_bsd_readlink(CPUArchState *env, abi_long arg1,
> +        abi_long arg2, abi_long arg3)
> +{
> +    abi_long ret;
> +    void *p1, *p2;
> +
> +    LOCK_PATH(p1, arg1);
> +    p2 = lock_user(VERIFY_WRITE, arg2, arg3, 0);
> +    if (p2 == NULL) {
> +        UNLOCK_PATH(p1, arg1);
> +        return -TARGET_EFAULT;
> +    }
> +#ifdef __FreeBSD__
> +    if (strcmp(p1, "/proc/curproc/file") == 0) {
> +        CPUState *cpu = env_cpu(env);
> +        TaskState *ts = (TaskState *)cpu->opaque;
> +        strncpy(p2, ts->bprm->fullpath, arg3);
> +        ret = MIN((abi_long)strlen(ts->bprm->fullpath), arg3);
> +    } else
> +#endif

Unfortunate ifdef.  Do we really need it while the other bsds are presumably still
non-functional?  I see that HOST_DEFAULT_BSD_TYPE isn't hooked up either...

I can remove the ifdef for now and add it to the TODO file as something to check
when we try to support NetBSD/OpenBSD again. 

Warner

reply via email to

[Prev in Thread] Current Thread [Next in Thread]