|
| From: | Richard Henderson |
| Subject: | Re: [PATCH 02/10] bsd-user: Implement symlink, symlinkat, readlink and readlinkat |
| Date: | Mon, 20 Jun 2022 11:28:03 -0700 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
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...
r~
| [Prev in Thread] | Current Thread | [Next in Thread] |