Overview
Comment: | Implement extended attributes on Solaris |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
72254c077721556fce6fe0202ba53eae |
User & Date: | js on 2024-08-23 23:10:56 |
Other Links: | manifest | tags |
References
2024-08-23
| ||
23:14 | • Fixed ticket [d5099cf0b0]: Support extended file attributes on Solaris plus 4 other changes artifact: 3b663ef640 user: js | |
Context
2024-08-23
| ||
23:23 | Move platforms from wiki back to PLATFORMS.md check-in: 6eb65587bc user: js tags: trunk | |
23:10 | Implement extended attributes on Solaris check-in: 72254c0777 user: js tags: trunk | |
2024-08-21
| ||
20:18 | OFSystemInfoTests: Show AltiVec support on PPC64 check-in: 62f3c342ab user: js tags: trunk | |
Changes
Modified src/OFFileIRIHandler.m from [ae11241b71] to [3b38bf74b9].
︙ | ︙ | |||
759 760 761 762 763 764 765 766 767 768 769 770 771 772 | while ((dirent = fs_read_attr_dir(dir)) != NULL) [names addObject: [OFString stringWithCString: dirent->d_name encoding: encoding]]; } @finally { fs_close_attr_dir(dir); } # endif [names makeImmutable]; [attributes setObject: names forKey: OFFileExtendedAttributesNames]; } #endif | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 | while ((dirent = fs_read_attr_dir(dir)) != NULL) [names addObject: [OFString stringWithCString: dirent->d_name encoding: encoding]]; } @finally { fs_close_attr_dir(dir); } # elif defined(OF_SOLARIS) int fd; DIR *dir; if ((fd = attropen(cPath, ".", O_RDONLY)) == -1) return; if ((dir = fdopendir(fd)) == NULL) { close(fd); return; } # ifdef OF_HAVE_THREADS @try { [readdirMutex lock]; } @catch (id e) { closedir(dir); close(fd); @throw e; } # endif @try { names = [OFMutableArray array]; for (;;) { struct dirent *dirent; OFString *name; errno = 0; if ((dirent = readdir(dir)) == NULL) { if (errno == 0) break; else return; } if (strcmp(dirent->d_name, ".") == 0 || strcmp(dirent->d_name, "..") == 0) continue; name = [[OFString alloc] initWithCString: dirent->d_name encoding: encoding]; @try { [names addObject: name]; } @finally { [name release]; } } } @finally { # ifdef OF_HAVE_THREADS [readdirMutex unlock]; # endif closedir(dir); close(fd); } # endif [names makeImmutable]; [attributes setObject: names forKey: OFFileExtendedAttributesNames]; } #endif |
︙ | ︙ | |||
1706 1707 1708 1709 1710 1711 1712 | forName: (OFString *)name ofItemAtIRI: (OFIRI *)IRI { void *pool = objc_autoreleasePoolPush(); OFString *path = IRI.fileSystemRepresentation; OFStringEncoding encoding = [OFLocale encoding]; const char *cPath = [path cStringWithEncoding: encoding]; | < > | 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 | forName: (OFString *)name ofItemAtIRI: (OFIRI *)IRI { void *pool = objc_autoreleasePoolPush(); OFString *path = IRI.fileSystemRepresentation; OFStringEncoding encoding = [OFLocale encoding]; const char *cPath = [path cStringWithEncoding: encoding]; # if defined(OF_LINUX) || defined(OF_MACOS) const char *cName = [name cStringWithEncoding: encoding]; void *value = NULL; # if defined(OF_LINUX) ssize_t size = lgetxattr(cPath, cName, NULL, 0); # elif defined(OF_MACOS) ssize_t size = getxattr(cPath, cName, NULL, 0, 0, XATTR_NOFOLLOW); # endif if (size < 0) |
︙ | ︙ | |||
1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 | if (type != NULL) *type = nil; # elif defined(OF_FREEBSD) || defined(OF_NETBSD) int namespace; const char *cName; ssize_t size; parseAttributeName(&name, &namespace); cName = [name cStringWithEncoding: encoding]; if ((size = extattr_get_link(cPath, namespace, cName, NULL, 0)) < 0) @throw [OFGetItemAttributesFailedException exceptionWithIRI: IRI | > | 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 | if (type != NULL) *type = nil; # elif defined(OF_FREEBSD) || defined(OF_NETBSD) int namespace; const char *cName; ssize_t size; void *value = NULL; parseAttributeName(&name, &namespace); cName = [name cStringWithEncoding: encoding]; if ((size = extattr_get_link(cPath, namespace, cName, NULL, 0)) < 0) @throw [OFGetItemAttributesFailedException exceptionWithIRI: IRI |
︙ | ︙ | |||
1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 | if (type != NULL) *type = nil; # elif defined(OF_HAIKU) const char *cName = [name cStringWithEncoding: encoding]; int fd = open(cPath, O_RDONLY); struct attr_info info; if (fd == -1) @throw [OFGetItemAttributesFailedException exceptionWithIRI: IRI errNo: errno]; @try { | > | 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 | if (type != NULL) *type = nil; # elif defined(OF_HAIKU) const char *cName = [name cStringWithEncoding: encoding]; int fd = open(cPath, O_RDONLY); struct attr_info info; void *value = NULL; if (fd == -1) @throw [OFGetItemAttributesFailedException exceptionWithIRI: IRI errNo: errno]; @try { |
︙ | ︙ | |||
1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 | if (type != NULL) *type = [OFNumber numberWithUnsignedLong: info.type]; } @finally { OFFreeMemory(value); close(fd); } # endif [*data retain]; if (type != NULL) [*type retain]; objc_autoreleasePoolPop(pool); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 | if (type != NULL) *type = [OFNumber numberWithUnsignedLong: info.type]; } @finally { OFFreeMemory(value); close(fd); } # elif defined(OF_SOLARIS) const char *cName = [name cStringWithEncoding: encoding]; int fd; if ((fd = attropen(cPath, cName, O_RDONLY)) == -1) @throw [OFGetItemAttributesFailedException exceptionWithIRI: IRI errNo: errno]; @try { OFMutableData *mutableData = [OFMutableData data]; char buffer[512]; ssize_t length; while ((length = read(fd, buffer, 512)) > 0) [mutableData addItems: buffer count: length]; if (length < 0) @throw [OFGetItemAttributesFailedException exceptionWithIRI: IRI errNo: errno]; [mutableData makeImmutable]; *data = mutableData; } @finally { close(fd); } if (type != NULL) *type = nil; # endif [*data retain]; if (type != NULL) [*type retain]; objc_autoreleasePoolPop(pool); |
︙ | ︙ | |||
1837 1838 1839 1840 1841 1842 1843 | void *pool = objc_autoreleasePoolPush(); OFString *path = IRI.fileSystemRepresentation; OFStringEncoding encoding = [OFLocale encoding]; const char *cPath = [path cStringWithEncoding: encoding]; size_t size = data.count * data.itemSize; # if defined(OF_LINUX) || defined(OF_MACOS) | | > | 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 | void *pool = objc_autoreleasePoolPush(); OFString *path = IRI.fileSystemRepresentation; OFStringEncoding encoding = [OFLocale encoding]; const char *cPath = [path cStringWithEncoding: encoding]; size_t size = data.count * data.itemSize; # if defined(OF_LINUX) || defined(OF_MACOS) const char *cName; if (type != nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; cName = [name cStringWithEncoding: encoding]; # if defined(OF_LINUX) if (lsetxattr(cPath, cName, data.items, size, 0) != 0) { # elif defined(OF_MACOS) if (setxattr(cPath, cName, data.items, size, 0, XATTR_NOFOLLOW) != 0) { # endif int errNo = errno; |
︙ | ︙ | |||
1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 | attributes: [OFDictionary dictionary] failedAttribute: @"" errNo: errNo]; } } @finally { close(fd); } # endif objc_autoreleasePoolPop(pool); } - (void)removeExtendedAttributeForName: (OFString *)name ofItemAtIRI: (OFIRI *)IRI | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 | attributes: [OFDictionary dictionary] failedAttribute: @"" errNo: errNo]; } } @finally { close(fd); } # elif defined(OF_SOLARIS) const char *cName; int fd; if (type != nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; cName = [name cStringWithEncoding: encoding]; fd = attropen(cPath, cName, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (fd == -1) /* TODO: Add an attribute (prefix?) for extended attributes? */ @throw [OFSetItemAttributesFailedException exceptionWithIRI: IRI attributes: [OFDictionary dictionary] failedAttribute: @"" errNo: errno]; @try { if (write(fd, data.items, size) != (ssize_t)size) /* * TODO: Add an attribute (prefix?) for extended * attributes? */ @throw [OFSetItemAttributesFailedException exceptionWithIRI: IRI attributes: [OFDictionary dictionary] failedAttribute: @"" errNo: errno]; } @finally { close(fd); } # endif objc_autoreleasePoolPop(pool); } - (void)removeExtendedAttributeForName: (OFString *)name ofItemAtIRI: (OFIRI *)IRI |
︙ | ︙ | |||
2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 | exceptionWithIRI: IRI attributes: [OFDictionary dictionary] failedAttribute: @"" errNo: errNo]; } } @finally { close(fd); } # endif objc_autoreleasePoolPop(pool); } #endif @end | > > > > > > > > > > > > > > > > > > > > > > > > > > | 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 | exceptionWithIRI: IRI attributes: [OFDictionary dictionary] failedAttribute: @"" errNo: errNo]; } } @finally { close(fd); } # elif defined(OF_SOLARIS) const char *cName = [name cStringWithEncoding: encoding]; int fd; if ((fd = attropen(cPath, ".", O_RDONLY)) < 0) /* TODO: Add an attribute (prefix?) for extended attributes? */ @throw [OFSetItemAttributesFailedException exceptionWithIRI: IRI attributes: [OFDictionary dictionary] failedAttribute: @"" errNo: errno]; @try { if (unlinkat(fd, cName, 0) != 0) /* * TODO: Add an attribute (prefix?) for extended * attributes? */ @throw [OFSetItemAttributesFailedException exceptionWithIRI: IRI attributes: [OFDictionary dictionary] failedAttribute: @"" errNo: errno]; } @finally { close(fd); } # endif objc_autoreleasePoolPop(pool); } #endif @end |
Modified src/OFFileManager.h from [68c96015fc] to [b2060b25e9].
︙ | ︙ | |||
36 37 38 39 40 41 42 | # define OF_FILE_MANAGER_SUPPORTS_LINKS # endif # if (defined(OF_HAVE_SYMLINK) && !defined(OF_AMIGAOS)) || \ defined(OF_WINDOWS) || defined(DOXYGEN) # define OF_FILE_MANAGER_SUPPORTS_SYMLINKS # endif # if defined(OF_LINUX) || defined(OF_MACOS) || defined(OF_FREEBSD) || \ | | > | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | # define OF_FILE_MANAGER_SUPPORTS_LINKS # endif # if (defined(OF_HAVE_SYMLINK) && !defined(OF_AMIGAOS)) || \ defined(OF_WINDOWS) || defined(DOXYGEN) # define OF_FILE_MANAGER_SUPPORTS_SYMLINKS # endif # if defined(OF_LINUX) || defined(OF_MACOS) || defined(OF_FREEBSD) || \ defined(OF_NETBSD) || defined(OF_HAIKU) || defined(OF_SOLARIS) || \ defined(DOXYGEN) # define OF_FILE_MANAGER_SUPPORTS_EXTENDED_ATTRIBUTES # endif #endif @class OFArray OF_GENERIC(ObjectType); @class OFConstantString; @class OFDate; |
︙ | ︙ |