mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-12 22:17:11 -04:00
Create a stat program
This commit is contained in:
parent
4193ba0ffa
commit
170f681f27
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,4 +13,5 @@ programs/cpuid/cpuid
|
|||||||
programs/args/args
|
programs/args/args
|
||||||
programs/shutdown/shutdown
|
programs/shutdown/shutdown
|
||||||
programs/reboot/reboot
|
programs/reboot/reboot
|
||||||
|
programs/stat/stat
|
||||||
programs/dist/
|
programs/dist/
|
@ -41,7 +41,10 @@ shutdown: force_look tlib/libtlib.a
|
|||||||
args: force_look tlib/libtlib.a
|
args: force_look tlib/libtlib.a
|
||||||
cd args; $(MAKE) args
|
cd args; $(MAKE) args
|
||||||
|
|
||||||
dist: one hello long loop longone longtwo keyboard tsh cpuid shutdown reboot args
|
stat: force_look tlib/libtlib.a
|
||||||
|
cd stat; $(MAKE) stat
|
||||||
|
|
||||||
|
dist: one hello long loop longone longtwo keyboard tsh cpuid shutdown reboot args stat
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
cp one/a.out dist/one
|
cp one/a.out dist/one
|
||||||
cp hello/a.out dist/hello
|
cp hello/a.out dist/hello
|
||||||
@ -55,6 +58,7 @@ dist: one hello long loop longone longtwo keyboard tsh cpuid shutdown reboot arg
|
|||||||
cp reboot/reboot dist/
|
cp reboot/reboot dist/
|
||||||
cp shutdown/shutdown dist/
|
cp shutdown/shutdown dist/
|
||||||
cp args/args dist/
|
cp args/args dist/
|
||||||
|
cp stat/stat dist/
|
||||||
strip dist/*
|
strip dist/*
|
||||||
|
|
||||||
force_look:
|
force_look:
|
||||||
@ -73,4 +77,5 @@ clean:
|
|||||||
cd reboot; $(MAKE) clean
|
cd reboot; $(MAKE) clean
|
||||||
cd shutdown; $(MAKE) clean
|
cd shutdown; $(MAKE) clean
|
||||||
cd args; $(MAKE) clean
|
cd args; $(MAKE) clean
|
||||||
|
cd stat; $(MAKE) clean
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
|
15
programs/stat/Makefile
Normal file
15
programs/stat/Makefile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
.PHONY: default clean
|
||||||
|
|
||||||
|
default: stat
|
||||||
|
|
||||||
|
include ../../cpp.mk
|
||||||
|
|
||||||
|
%.cpp.o: src/%.cpp
|
||||||
|
$(CC) -c $< -o $@ $(PROGRAM_FLAGS)
|
||||||
|
|
||||||
|
stat: main.cpp.o
|
||||||
|
$(CC) -o stat main.cpp.o $(PROGRAM_LINK_FLAGS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.cpp.o
|
||||||
|
rm -rf stat
|
BIN
programs/stat/reboot
Executable file
BIN
programs/stat/reboot
Executable file
Binary file not shown.
23
programs/stat/src/main.cpp
Normal file
23
programs/stat/src/main.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
//=======================================================================
|
||||||
|
// Copyright Baptiste Wicht 2013-2014.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
#include <file.hpp>
|
||||||
|
#include <system.hpp>
|
||||||
|
#include <errors.hpp>
|
||||||
|
#include <print.hpp>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
auto fd = open("/stat");
|
||||||
|
|
||||||
|
if(fd.valid()){
|
||||||
|
printf("fd: %u\n", *fd);
|
||||||
|
} else {
|
||||||
|
printf("stat: error: %s\n", std::error_message(fd.error()));
|
||||||
|
}
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
@ -5,8 +5,8 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
#ifndef USER_SYSTEM_HPP
|
#ifndef USER_FILE_HPP
|
||||||
#define USER_SYSTEM_HPP
|
#define USER_FILE_HPP
|
||||||
|
|
||||||
#include <types.hpp>
|
#include <types.hpp>
|
||||||
#include <expected.hpp>
|
#include <expected.hpp>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user