From patchwork Fri Aug 30 09:37:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Lapshin X-Patchwork-Id: 96765 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BFBE03858433 for ; Fri, 30 Aug 2024 09:38:10 +0000 (GMT) X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazlp170100000.outbound.protection.outlook.com [IPv6:2a01:111:f403:c400::]) by sourceware.org (Postfix) with ESMTPS id AA4713858C50 for ; Fri, 30 Aug 2024 09:37:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AA4713858C50 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=espressif.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=espressif.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AA4713858C50 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c400:: ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1725010668; cv=pass; b=Clg/vlL0FJZc0uslfdhKKJicSEHOEYFvZVoTt+4QzNZtB4xsR+/ItVHKxXWW+YjVW4/V7CrYBlsULxt2+FKQUFkluYIH9M8Ca2Rxh/jNm7njkTizynuvyLg7XtoDb0gVBBhjyomyiVImf1Ex2cVeWDQeasNNQYUT4bM2++PEt40= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1725010668; c=relaxed/simple; bh=9FIaDsempOqCsEUCJsYLnIh91G+At5/sJcashELljvs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=AD6Nl2MZkC+4iNsMUz3QS/xgIad6wibFFPjpFGHx5Hp2XvgT3QGa1FMp1Cc79D1Y9TN3ao3Z6m+D8XISzWdROfu3xlvfkaQHnKp2+QNAC8eYJp57+ygBRptrm6atvIXMDQQXLqEqi0I3kdpFZRe82oTv5V0FDkDoKkUtEAJE2c0= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Qmu1cEIb8Q6/zY/mXTrk3GfBlkITkjnYKCa2YRuU5YGya9a7bsgOMiukPyN8TZdTkHrjK9gxXBgFIC3lqkNbVXmn/y2y4KbvngLi/KCNMhtgAqeK20CeZ/DFaS0d0DBwh1ABSvSL9kjbewUq0z6ZPwHHB/G0hM+MLgLsWNaa83n/SXkUPcejG9NRy4mCMWRGK+PepBpVHkulOxByrGIVkHr8R0jWeCo7LIWcjKhx2TQwSUKyWvsoV+SwpmuVpOPTSNY1jPlgDxjWytpLPtwTtSF8nXwqvZlGYm9lxUrU9msvbo9DvbzOlI8z4yy3J5cRSLSOIXv7+bZ7boqM6nRRtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9FIaDsempOqCsEUCJsYLnIh91G+At5/sJcashELljvs=; b=osolshI+me65qYgVpdb8eHSTgHBiJWZrn++5U1l7AIdsFZtSE9TJtfeA6LkncWXZmCj5RqatunO54L2YGd4fQH055Z2hF5NcmcTDObWjz7S4jUF70nCdeJ8//qXgB27pQKRkQX2eRIHD0g8kIRPqz58o4yjWyR0Ja1msURfBt0x0vO3jLLtIFTwmAcf8IlRY3zvzuMlHFxAzXzh5JRa818IlPhOT9i5InPCujsPEw/2Bb73CarpYHJ6n6dzoh1Lh8+HnP+GOwzkZOcyD/Gp1rp0KYIwmyAO+EZWwB4N5GmEz6cqI53PjdT/5jQSSDjd0ezFG/6CkLpxWHpn93/sEkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=espressif.com; dmarc=pass action=none header.from=espressif.com; dkim=pass header.d=espressif.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=espressifsystems.onmicrosoft.com; s=selector1-espressifsystems-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9FIaDsempOqCsEUCJsYLnIh91G+At5/sJcashELljvs=; b=GWDB4MyZz2e/tMM5UDLgoUwnakCFVOWwh0TkSXTryody1JLArl+JnxzsHpyY9sV6T5olLW9vm109eQTgq81r7ev4g2veJ1zG908OwO3urA8MVKW9fKz6wSQoaPcOnOcTyQMoA8V7jMYnqZKi+X9AlXlG6qL25d0v2vYPfD3kWRs= Received: from SEZPR04MB5732.apcprd04.prod.outlook.com (2603:1096:101:74::7) by SG2PR04MB5987.apcprd04.prod.outlook.com (2603:1096:4:1ba::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.28; Fri, 30 Aug 2024 09:37:36 +0000 Received: from SEZPR04MB5732.apcprd04.prod.outlook.com ([fe80::28d2:dac0:5545:8ee8]) by SEZPR04MB5732.apcprd04.prod.outlook.com ([fe80::28d2:dac0:5545:8ee8%3]) with mapi id 15.20.7897.027; Fri, 30 Aug 2024 09:37:36 +0000 From: Alexey Lapshin To: "newlib@sourceware.org" CC: Alexey Gerenkov , "vinschen@redhat.com" Subject: [PATCH v2 2/2] newlib: esp: add dirent.h header file Thread-Topic: [PATCH v2 2/2] newlib: esp: add dirent.h header file Thread-Index: AQHa+sA/XYjMb93BhEaBxqZDCM6chQ== Date: Fri, 30 Aug 2024 09:37:36 +0000 Message-ID: <633dfc3db668b04ed654394e180e733875e17f13.camel@espressif.com> References: <56e73fe36a6758dede169882b54ff62b2188d04e.camel@espressif.com> In-Reply-To: <56e73fe36a6758dede169882b54ff62b2188d04e.camel@espressif.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=espressif.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SEZPR04MB5732:EE_|SG2PR04MB5987:EE_ x-ms-office365-filtering-correlation-id: 88a31a3c-e4fd-4545-dceb-08dcc8d7619b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|366016|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?r5A2feEeDvCXaj/x+hrCUeuk9HPJ8Kh?= =?utf-8?q?PI4qnvWXrzV9fDVeqzwKkiNNIykpSfJ8avaSPoak8jaxcve1Yy/XF+Dy3WcMKhyJW?= =?utf-8?q?nezh96Z82OmuXbLsF4ZzKFYIvOaKxhIu7kd2QovDlqVfynejphnX4qy9lUMiRNUId?= =?utf-8?q?iC0z7w83qYZ9u0NjQdYhu6Vg/J7OIUhaP5YlnNDXG/mABHIvKEBdmljRC8Joeaen8?= =?utf-8?q?mg7Eyi588O25OyjAkn0JA++ncq4kIZyMQk1Xykbyanf8UkqwyZUFX7GsOxDiNqgXT?= =?utf-8?q?LM7/bVPc2lKsel6IeRyypT1K1qe3IEnNzWarcFo4QUyXnWl940IzoWmbjFA1shiVa?= =?utf-8?q?eNhZ5BqeX9F2t7+fuC5r8Nb0t+9RrTqgxSEE+sUThVG7B2yd9iVlQVZQ3LBIgFZyT?= =?utf-8?q?64HlxBPbHENXIlsYu5Op6rtO4BBmXedpDMC34qvPtIh4KHrhXavaZd4S2eWwKlX7r?= =?utf-8?q?mAdX4RBm5CAeBzieJozY9ZeKHGGqXmOmIeiAJZ5d6omMJVKom/CJRzL+Mq+tg3Fu1?= =?utf-8?q?ut5hGHj+KdAIVDVBjkMxY9xdHN/Y/Dio63GJlemOFRbeMJNket0ME2LF5BkJOMp4M?= =?utf-8?q?E7B74HAQFtk7JS1lxDNA6zFhkTieQZLkX4oxLRb8UMYUFMEW4mgv+t1Q+nFWkFAhU?= =?utf-8?q?f53fQxBOQPmwKivhawNBILhZjfUcY/OB6SZP/RCavPHOEphNjjpvDRU9oUZtsKCL9?= =?utf-8?q?WFJqX5ltfyXWpa3gmvDeq32892mDyzkMA/FoWrimtG60nMXIBHsGz9OEuKx5KytoG?= =?utf-8?q?yjCyLcZmqwuUTcBhZdLSCNQxIAPRwFiL5CKlbDAWVJaGXpnqMrjuOIE68FB/95F4T?= =?utf-8?q?POvjpwhyDcaNRprXY3qoySFJpBv30/J7wwpbQjtvGXw6Mkjb+LdM60V8wvIqp/gTk?= =?utf-8?q?XlNB7cvDt2wEr/hWPvP/a84HcdcViFbzYZbta2WuGuhhabwdxYlUvxfZRKS4IdjlJ?= =?utf-8?q?O8VBobAcujk24K+Y0At8oFPhUPqz2Nyi5+ruGG6snaq55hmDGrG7TqOeoKwqed8QR?= =?utf-8?q?nGb1etI62t3d3qhTZrR7btfzKbgpdKfnhkVLzQS0ml9L+CoHPb2bcW7CSTGaY1RnO?= =?utf-8?q?8IDJlz6XtxDGio/5HY9rkCPTJKwmb6lRoGxFpOJH7ncw9CuIEl2uDgj74xjm7Ise9?= =?utf-8?q?xhhK4rKNQT3V/wpuC12msf7mzJSh+NsvH4vC/9fxB+QOUXxz0jmvkivWFfTyNiEdb?= =?utf-8?q?EfQiBKH7aO+ocHd3fiCQCByhMIfVaJAPK3GZKWKKQF/ahxpT5Uth3lPDRtmEEm7OU?= =?utf-8?q?IxSuU1YxXjJI0brwC8GMhKfpJMqaAz42ZLkCpqxfgInFCr0yR5h0285HCwv0eu4Xf?= =?utf-8?q?3RPO8wMMDkR+2AA35/2jhKt7IaqUJ5ofQg=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR04MB5732.apcprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024)(38070700018); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?hM9nL4YU7cB6hONut3NsVbMnzyGz?= =?utf-8?q?FTuEf68yXBTMBqfaslVTvmPO6U3keh59cdLg2XeS2Hmch0KGvugl/X/11O5WTd4V3?= =?utf-8?q?POohx+3y2hxupIfEe2YOrIk6fkJLHZO8CxDVrf1wL2Sunx3wMLyAus+5pOfsKZ+/G?= =?utf-8?q?yR9Bazb5PZhNsW2t3/DbxmWMWdEh56Rhfv8ePJv+NIS9jdEvt+V1CWJdPgiPntTKB?= =?utf-8?q?8ZpA/4KrQQxlXSeq93ZWeZ05itdmtJ5aHzRRJhbmFCYd34eKlhrVCZ5a/ZXCC745y?= =?utf-8?q?VIbSaXZNW6/guEjt9veV6PUzufVgCrTdEYo3D+nvbA0KgsFo2mntbSMkm3LbQTXtz?= =?utf-8?q?6BXvDERyy/ooOPK6cv58iGa8qPKPHhyh3hi7o1FGKnBmnnDVwhe05jueI/J0lGA0X?= =?utf-8?q?Jl0nxqVEDjKGwinWfCKbeQhaRoYH0u6FZLGINf/Pn9uepUYIbCedSAX3bNAvJZ5PJ?= =?utf-8?q?AAAjYkH0cx2nOku0TJt6336UFe8fV2GehtxmazyFK+TYKHyiOuoK+w5l8lwZaOeDx?= =?utf-8?q?hUCGIah1NIeOS4LWCnlkzH+rA5h3QJ5QjYD3RtCufr6V9P7/ws6RHswH7v83wyYwN?= =?utf-8?q?8KEtpm3ZInUvGEpwexj47FUQFMb3B83Qz63QTfE3r7za2XwbjlDY7Gy9FWhEnoklg?= =?utf-8?q?k2Wg73w1e9qHtDvIknXk61pNgtJkN9feF/kmdmHLlq5uk2mfvQdsmB9dT6pVKoSpf?= =?utf-8?q?r53PanCPlQYhrqt2+35MZY2cXCur5bXr0SWOxG6Em9H5NyxGcRbgGzZqvilCOtvTI?= =?utf-8?q?eflt8QeeYdmXCT63xB0F6CVe8iW5JkFjjxQ80XiEM99a9cRTeD6QwzbItP2q6oeaF?= =?utf-8?q?toWpMj6zfxuolYoSHRvGbHEi+9QgmmWROn0YYIe/wc9SCm6/7USNRqzmKHcfCJSvC?= =?utf-8?q?g80lPXlYoArbzqhk+U5MHTx6Zr8ca3Q7AlPpjJoFEYFr0lhDuW8BTzZ/ZljXzE7n9?= =?utf-8?q?E39lnd3iLAH/apx0+4eAQGEQWoVA0RQoBIVDklkspOCTfprlc+Uqk1z5tuR0xC0hy?= =?utf-8?q?03x3+04KE/GX1tV8gXWwVDwJYiWaqc1yZnMa3alORgDQxm6NflaFk45ZRqIt56te3?= =?utf-8?q?IB5kP0pT8AbacC7P/IGRwtEaiAwjO4WD/jFG4y22eB4BRc/Pd+ozTdZy49daCTvld?= =?utf-8?q?HPTaSbPRrxB0rmhZkj6QaivIFtPLCaMnmWiYNy9ZFcmIQ4Qjm1TkQAQc13X2SRj5g?= =?utf-8?q?vacF1kZsogZNq2q3J4cL08lIQ43luGSEENjb3nN1WEE98Hkj/n8NNP7GAnnXrSHMn?= =?utf-8?q?VZOvMRjoO12f/4N2T/DgLwQpg+c7cByY6I4O3l6XhQC0IuWAU/D2dgtniXKMOT7Cq?= =?utf-8?q?KTYQpfDVDPbyZRHUMPU3LA4/Rv47V2uU9GNJg+hz6AXHZE0eSVTcQO/h9lS5IWsWi?= =?utf-8?q?e6YkPYjugaoVCLXmcPCbk2RxAYSAvppVTCDik07vhQ5htvLJJowFlsWRvTN/7GEAb?= =?utf-8?q?5LcQmu41w4QdG/UoQI2NmYMAM9qqdnrv8PpT9AmMpxpqV5a133jbsLFOk8yQVsZs4?= =?utf-8?q?OHFH10rSYSrd2cOwRjfTpuz55D2tvvBQRg=3D=3D?= Content-ID: <5F88621743E7BE4F90082D3CE01EFC0A@apcprd04.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: espressif.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SEZPR04MB5732.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88a31a3c-e4fd-4545-dceb-08dcc8d7619b X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Aug 2024 09:37:36.0451 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5faf27fd-3557-4294-9545-8ea74a409f39 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /Y0bla0PUKdxnS8Z61zltsak8noCnblJ8Jq/rACbkDlO17JSl92/w5o7GbaIEGuWgGKzTvqbLGtQTB9TUNzlOGkETX6nNuXwbSwtJBzI/KU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR04MB5987 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: newlib-bounces~patchwork=sourceware.org@sourceware.org Support dirent in *-esp-* toolchains --- newlib/Makefile.am | 8 ++-- newlib/configure | 2 +- newlib/configure.host | 12 ++++-- newlib/libc/sys/esp/include/sys/dirent.h | 49 ++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 newlib/libc/sys/esp/include/sys/dirent.h -- 2.43.0 diff --git a/newlib/Makefile.am b/newlib/Makefile.am index 87a7f8597..00088b6c3 100644 --- a/newlib/Makefile.am +++ b/newlib/Makefile.am @@ -312,10 +312,10 @@ install-data-local: install-toollibLIBRARIES install-multi $(INSTALL_DATA_LOCAL) $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \ else true; fi ; \ done ; \ - for i in $(srcdir)/libc/machine/$(machine_dir)/include/*.h; do \ - if [ -f $$i ]; then \ - $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/`basename $$i`; \ - else true; fi ; \ + for i in $(call rwildcard,$(srcdir)/libc/machine/$(machine_dir)/include/,*.h); do \ + f=`echo $$i | sed s:^$(srcdir)/libc/machine/$(machine_dir)/::`; \ + $(MKDIR_P) $(DESTDIR)$(tooldir)/`dirname $$f`; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/`dirname $$f`; \ done ; \ for i in $(srcdir)/libc/sys/$(sys_dir)/sys/*.h; do \ if [ -f $$i ]; then \ diff --git a/newlib/configure b/newlib/configure index cb4747880..e7158c063 100755 --- a/newlib/configure +++ b/newlib/configure @@ -6263,7 +6263,7 @@ else /* end confdefs.h. */ #define _LIBM // targ-include does not exist yet, use relative path -#include "../sys/xtensa/include/xtensa/config/core-isa.h" +#include "../machine/xtensa/include/xtensa/config/core-isa.h" #if (!XCHAL_HAVE_FP_SQRT) # error "Have not XCHAL_HAVE_FP_SQRT" #endif diff --git a/newlib/configure.host b/newlib/configure.host index a8a73f9bf..ff2e51275 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -446,6 +446,15 @@ case "${host}" in sys_dir=tirtos have_crt0="no" ;; + *-esp-*) + sys_dir=esp + have_crt0="no" + posix_dir=posix + newlib_cflags="${newlib_cflags} -D_NO_GLOB -D_NO_EXECVE -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT" + newlib_cflags="${newlib_cflags} -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN" + newlib_cflags="${newlib_cflags} -DHAVE_FCNTL -DHAVE_BLKSIZE -DHAVE_OPENDIR -DHAVE_RENAME" + newlib_cflags="${newlib_cflags} -DGETREENT_PROVIDED -DSIGNAL_PROVIDED" + ;; a29k-*-*) sys_dir=a29khif signal_dir= @@ -579,9 +588,6 @@ case "${host}" in w65-*-*) sys_dir=w65 ;; - xtensa*-*-*) - sys_dir=xtensa - ;; z8k-*-coff) sys_dir=z8ksim ;; diff --git a/newlib/libc/sys/esp/include/sys/dirent.h b/newlib/libc/sys/esp/include/sys/dirent.h new file mode 100644 index 000000000..0e0c2f5fe --- /dev/null +++ b/newlib/libc/sys/esp/include/sys/dirent.h @@ -0,0 +1,49 @@ +#ifndef _SYS_DIRENT_H +#define _SYS_DIRENT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _INO_T_DECLARED +typedef __ino_t ino_t; +#define _INO_T_DECLARED +#endif + +struct dirent { + ino_t d_ino; /* file number */ + __uint8_t d_type; /* file type, see below */ + char d_name[255 + 1]; /* zero-terminated file name */ +}; + +typedef struct { + __uint16_t dd_vfs_idx; /*!< VFS index, not to be used by applications */ + __uint16_t dd_rsv; /*!< field reserved for future extension */ + /* remaining fields are defined by VFS implementation */ +} DIR; + +#if __BSD_VISIBLE +#define MAXNAMLEN 255 + +/* File types */ +#define DT_UNKNOWN 0 +#define DT_REG 1 +#define DT_DIR 2 + +/* File types which are not defined for ESP. + * But must be present to build libstd++ */ +#define DT_CHR 4 +#define DT_BLK 6 +#define DT_FIFO 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 +#endif + +#ifdef __cplusplus +} +#endif +#endif