From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3E6B419312 for ; Tue, 30 Jun 2026 13:24:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782825876; cv=none; b=TFpkhSLLUUoIxPSWywKNEIDcQYR0L8911/A2K7VLihOcS9yYgxY25SgVmC5sZsxD/GBtUGIAS2fTC9GVzQKkQa5Dfw+2jN0kunSucZoDL9PF3eb0FM3gUi7GlrLumkAeBn73yFndntWGdFRAAHRFTy38n2uyjET59xuDu2aQXHE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782825876; c=relaxed/simple; bh=q5hH54lpPfVMWCmlHOmf8+AnloVKvozexzjneEFb1yQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QNeaOySQf8zGHySDiV+7tI8PhHXDBH7x8YwKPbqvfMJSHfBpEamVqaNJxHm4CvCxM6dGXT9A/12D1uLufGZTFAqw/cnKyVELK/Th6StjYn0YIcPaPB76hmCV4MnDllvW+hU9o6ooL1kUYUJvIQlyXbgdayC5i9BepRLbnqdSth0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=thingy.jp; spf=pass smtp.mailfrom=0x0f.com; dkim=pass (1024-bit key) header.d=thingy.jp header.i=@thingy.jp header.b=np1FpjXu; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=thingy.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=0x0f.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=thingy.jp header.i=@thingy.jp header.b="np1FpjXu" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2c9c9913ddaso2932365ad.0 for ; Tue, 30 Jun 2026 06:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thingy.jp; s=google; t=1782825874; x=1783430674; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=buIyflxmn8X5DEIOee4DfotZA/ewreA5TG6PcbCN1EM=; b=np1FpjXuzhx0NjOxBf873CT66JPoHw2d4rpjw5cDCJyNRsTkn4bHum+f1OxIpsCW01 8WumEiu3Au6hAcOB2Isbtuv+5qyyQU0UHO8mBpV/XnsJX2oYus7usdCeVS3QsYypHAa7 09y0zIVDWlXY8VFRBBeIl1JwEgCdpVX52yoNw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782825874; x=1783430674; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=buIyflxmn8X5DEIOee4DfotZA/ewreA5TG6PcbCN1EM=; b=MtbPoCNbJjrqhF5Nv5DjqQoMGx3NxHcqQZBomRDOzoa0p9AqTJUl+0zKbOiLEP5h1B +KLwgGzdHFsvxp2lYNHJkjBelDF8mvp3w9TGZFtGK68BPn4jGjYPcIwD6tPTbtMZm3Q8 eF9U7JMjb+fxQOepF2qrxfECZL/nAr9QoqOzJ/aD7Ek0siJUc77jB8dMWm0cfF4C9zaB ry9utZwDZxk/2ocRu6+xnp5hg47nA+SOjIpljey2uyNplM0v2opEohkoUTf0rTT+hqRy kJMLgN5mL0TP0Q9gX1LwkgxmGOjsMwZD781wIfwihIrq8xdxl1oJgw4yqij3pO8ZBZ6N Rcqg== X-Gm-Message-State: AOJu0Yy8FYKyKRtygRjQ6W9NcU8O3tJfJuDwVvZ3JWm+wGTNAyvwE1p+ VT6D2Z2zzryYPrKwKLEkJ/PUrYOtlo0p5mF22j6Js3Msn12islODkQBLNb6onnLX8hdfkhBIxcB w4WSg X-Gm-Gg: AfdE7cm36jSsw9Tkur9iDkUdpMujKJNSx4ssszBxwF65gu1D+VklOklE/ZOcNo0N2BV FI/A/vBfDQEDY/Ol61julVay+CNd96k4eka/u9z+lLfVaxaVg8E4q19ChI9OpzIEHqlDVm9R83u fUG1nSyvJmc/fTRN7+WP/XynLbgeL7YoovGW+3BV6NmsBXUUW+Yqgu282U+vTMpb5YFVSxY9GGp jMAYF0OsGv3HUQCvRCJMfN+6tt1PcSk9fMvLkiRFGdBq/IfPu+tw2Eb2KUe22kX8O2GY8KoPN4V Pxkd7J32kK+0AYu46MBgP/omKfgYNwPOloS+J1La2u/foV8jDFZTB5/FRlEV5EoTT0TUd8/YBJl Z48m0Fw/d+TFIsPSIsa9zEjZWMWKaHVSB9in87hF+U2oR8YyEMImBoc0fxhLb7xxZ9X3qLM5qYt mrIdE26VpRjngumTfp+ggYSVhikg== X-Received: by 2002:a17:902:fd8d:b0:2c6:c9e0:2c17 with SMTP id d9443c01a7336-2ca448a7d59mr12423155ad.8.1782825874195; Tue, 30 Jun 2026 06:24:34 -0700 (PDT) Received: from kinako.work.home.arpa ([2400:4162:2428:2ffe:a973:53e4:1a28:8545]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-2ca382abefdsm14716155ad.59.2026.06.30.06.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2026 06:24:33 -0700 (PDT) From: Daniel Palmer To: w@1wt.eu, linux@weissschuh.net Cc: linux-kernel@vger.kernel.org, Daniel Palmer Subject: [PATCH v2 2/3] tools/nolibc: unistd: Add readlink() Date: Tue, 30 Jun 2026 22:24:18 +0900 Message-ID: <20260630132419.2523890-3-daniel@thingy.jp> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260630132419.2523890-1-daniel@thingy.jp> References: <20260630132419.2523890-1-daniel@thingy.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add readlink(). This is needed to test getcwd(). Signed-off-by: Daniel Palmer --- tools/include/nolibc/unistd.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/include/nolibc/unistd.h b/tools/include/nolibc/unistd.h index 057fc3a94179..794727bf4e63 100644 --- a/tools/include/nolibc/unistd.h +++ b/tools/include/nolibc/unistd.h @@ -126,6 +126,22 @@ int msleep(unsigned int msecs) return 0; } +/* + * ssize_t readlink(const char *path, char *buf, size_t bufsiz); + */ + +static __attribute__((unused)) +ssize_t _sys_readlink(const char *path, char *buf, size_t bufsiz) +{ + return __nolibc_syscall4(__NR_readlinkat, AT_FDCWD, path, buf, bufsiz); +} + +static __attribute__((unused)) +ssize_t readlink(const char *path, char *buf, size_t bufsiz) +{ + return __sysret(_sys_readlink(path, buf, bufsiz)); +} + static __attribute__((unused)) unsigned int sleep(unsigned int seconds) { -- 2.53.0