forked from Bananymous/banan-os
				
			LibC: add function declarations to sys/stat.h
This commit is contained in:
		
							parent
							
								
									d9be14e1fb
								
							
						
					
					
						commit
						729ff267d7
					
				| 
						 | 
					@ -20,7 +20,7 @@ namespace LibELF
 | 
				
			||||||
			int fd = TRY(Kernel::Process::current().open(file_path, O_RDONLY));
 | 
								int fd = TRY(Kernel::Process::current().open(file_path, O_RDONLY));
 | 
				
			||||||
			BAN::ScopeGuard _([fd] { MUST(Kernel::Process::current().close(fd)); });
 | 
								BAN::ScopeGuard _([fd] { MUST(Kernel::Process::current().close(fd)); });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			stat st;
 | 
								struct stat st;
 | 
				
			||||||
			TRY(Kernel::Process::current().fstat(fd, &st));
 | 
								TRY(Kernel::Process::current().fstat(fd, &st));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			TRY(data.resize(st.st_size));
 | 
								TRY(data.resize(st.st_size));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,8 +46,8 @@ namespace Kernel
 | 
				
			||||||
		BAN::ErrorOr<size_t> write(int fd, const void* buffer, size_t offset, size_t count);
 | 
							BAN::ErrorOr<size_t> write(int fd, const void* buffer, size_t offset, size_t count);
 | 
				
			||||||
		BAN::ErrorOr<void> creat(BAN::StringView name, mode_t);
 | 
							BAN::ErrorOr<void> creat(BAN::StringView name, mode_t);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		BAN::ErrorOr<void> fstat(int fd, stat*);
 | 
							BAN::ErrorOr<void> fstat(int fd, struct stat*);
 | 
				
			||||||
		BAN::ErrorOr<void> stat(BAN::StringView path, stat*);
 | 
							BAN::ErrorOr<void> stat(BAN::StringView path, struct stat*);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		BAN::ErrorOr<void> mount(BAN::StringView source, BAN::StringView target);
 | 
							BAN::ErrorOr<void> mount(BAN::StringView source, BAN::StringView target);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@ namespace Kernel
 | 
				
			||||||
		int fd = TRY(Process::current().open(path, O_RDONLY));
 | 
							int fd = TRY(Process::current().open(path, O_RDONLY));
 | 
				
			||||||
		BAN::ScopeGuard _([fd] { MUST(Process::current().close(fd)); });
 | 
							BAN::ScopeGuard _([fd] { MUST(Process::current().close(fd)); });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		stat st;
 | 
							struct stat st;
 | 
				
			||||||
		TRY(Process::current().fstat(fd, &st));
 | 
							TRY(Process::current().fstat(fd, &st));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		BAN::Vector<uint8_t> file_data;
 | 
							BAN::Vector<uint8_t> file_data;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -522,7 +522,7 @@ argument_done:
 | 
				
			||||||
			TRY(entry_prefix.push_back('/'));
 | 
								TRY(entry_prefix.push_back('/'));
 | 
				
			||||||
			for (const auto& entry : all_entries)
 | 
								for (const auto& entry : all_entries)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				stat st;
 | 
									struct stat st;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				BAN::String entry_path;
 | 
									BAN::String entry_path;
 | 
				
			||||||
				TRY(entry_path.append(entry_prefix));
 | 
									TRY(entry_path.append(entry_prefix));
 | 
				
			||||||
| 
						 | 
					@ -572,7 +572,7 @@ argument_done:
 | 
				
			||||||
				return {};
 | 
									return {};
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			stat st;
 | 
								struct stat st;
 | 
				
			||||||
			TRY(Process::current().stat(arguments[1], &st));
 | 
								TRY(Process::current().stat(arguments[1], &st));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			Inode::Mode mode { st.st_mode };
 | 
								Inode::Mode mode { st.st_mode };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,12 +3,12 @@
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__BEGIN_DECLS
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define st_atime st_atim.tv_sec
 | 
					#define st_atime st_atim.tv_sec
 | 
				
			||||||
#define st_ctime st_ctim.tv_sec
 | 
					#define st_ctime st_ctim.tv_sec
 | 
				
			||||||
#define st_mtime st_mtim.tv_sec
 | 
					#define st_mtime st_mtim.tv_sec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					__BEGIN_DECLS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct stat
 | 
					struct stat
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	dev_t st_dev;
 | 
						dev_t st_dev;
 | 
				
			||||||
| 
						 | 
					@ -26,4 +26,21 @@ struct stat
 | 
				
			||||||
	blkcnt_t st_blocks;
 | 
						blkcnt_t st_blocks;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int		chmod(const char*, mode_t);
 | 
				
			||||||
 | 
					int		fchmod(int, mode_t);
 | 
				
			||||||
 | 
					int		fchmodat(int, const char*, mode_t, int);
 | 
				
			||||||
 | 
					int		fstat(int, struct stat*);
 | 
				
			||||||
 | 
					int		fstatat(int, const char*, struct stat*, int);
 | 
				
			||||||
 | 
					int		futimens(int, const struct timespec[2]);
 | 
				
			||||||
 | 
					int		lstat(const char*, struct stat*);
 | 
				
			||||||
 | 
					int		mkdir(const char*, mode_t);
 | 
				
			||||||
 | 
					int		mkdirat(int, const char*, mode_t);
 | 
				
			||||||
 | 
					int		mkfifo(const char*, mode_t);
 | 
				
			||||||
 | 
					int		mkfifoat(int, const char*, mode_t);
 | 
				
			||||||
 | 
					int		mknod(const char*, mode_t, dev_t);
 | 
				
			||||||
 | 
					int		mknodat(int, const char*, mode_t, dev_t);
 | 
				
			||||||
 | 
					int		stat(const char*, struct stat*);
 | 
				
			||||||
 | 
					mode_t	umask(mode_t);
 | 
				
			||||||
 | 
					int		utimensat(int, const char*, const struct timespec[2], int);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__END_DECLS
 | 
					__END_DECLS
 | 
				
			||||||
		Loading…
	
		Reference in New Issue