| ... | @@ -1657,6 +1657,14 @@ Error os_self_exe_shared_libs(ZigList<Buf *> &paths) { | ... | @@ -1657,6 +1657,14 @@ Error os_self_exe_shared_libs(ZigList<Buf *> &paths) { |
| 1657 | paths.resize(0); | 1657 | paths.resize(0); |
| 1658 | dl_iterate_phdr(self_exe_shared_libs_callback, &paths); | 1658 | dl_iterate_phdr(self_exe_shared_libs_callback, &paths); |
| 1659 | return ErrorNone; | 1659 | return ErrorNone; |
| | 1660 | #elif defined(ZIG_OS_DARWIN) |
| | 1661 | paths.resize(0); |
| | 1662 | uint32_t img_count = _dyld_image_count(); |
| | 1663 | for (uint32_t i = 0; i != img_count; i += 1) { |
| | 1664 | const char *name = _dyld_get_image_name(i); |
| | 1665 | paths.append(buf_create_from_str(name)); |
| | 1666 | } |
| | 1667 | return ErrorNone; |
| 1660 | #else | 1668 | #else |
| 1661 | #error "unimplemented" | 1669 | #error "unimplemented" |
| 1662 | #endif | 1670 | #endif |
| ... | @@ -1750,7 +1758,7 @@ Error os_file_open_lock_rw(Buf *full_path, OsFile *out_file) { | ... | @@ -1750,7 +1758,7 @@ Error os_file_open_lock_rw(Buf *full_path, OsFile *out_file) { |
| 1750 | Error os_file_mtime(OsFile file, OsTimeStamp *mtime) { | 1758 | Error os_file_mtime(OsFile file, OsTimeStamp *mtime) { |
| 1751 | #if defined(ZIG_OS_WINDOWS) | 1759 | #if defined(ZIG_OS_WINDOWS) |
| 1752 | #error unimplemented | 1760 | #error unimplemented |
| 1753 | #else | 1761 | #elif defined(ZIG_OS_LINUX) |
| 1754 | struct stat statbuf; | 1762 | struct stat statbuf; |
| 1755 | if (fstat(file, &statbuf) == -1) | 1763 | if (fstat(file, &statbuf) == -1) |
| 1756 | return ErrorFileSystem; | 1764 | return ErrorFileSystem; |
| ... | @@ -1758,6 +1766,16 @@ Error os_file_mtime(OsFile file, OsTimeStamp *mtime) { | ... | @@ -1758,6 +1766,16 @@ Error os_file_mtime(OsFile file, OsTimeStamp *mtime) { |
| 1758 | mtime->sec = statbuf.st_mtim.tv_sec; | 1766 | mtime->sec = statbuf.st_mtim.tv_sec; |
| 1759 | mtime->nsec = statbuf.st_mtim.tv_nsec; | 1767 | mtime->nsec = statbuf.st_mtim.tv_nsec; |
| 1760 | return ErrorNone; | 1768 | return ErrorNone; |
| | 1769 | #elif defined(ZIG_OS_DARWIN) |
| | 1770 | struct stat statbuf; |
| | 1771 | if (fstat(file, &statbuf) == -1) |
| | 1772 | return ErrorFileSystem; |
| | 1773 | |
| | 1774 | mtime->sec = statbuf.st_mtimespec.tv_sec; |
| | 1775 | mtime->nsec = statbuf.st_mtimespec.tv_nsec; |
| | 1776 | return ErrorNone; |
| | 1777 | #else |
| | 1778 | #error unimplemented |
| 1761 | #endif | 1779 | #endif |
| 1762 | } | 1780 | } |
| 1763 | | 1781 | |