#include "../include/Sim2OS.h"

namespace environment {
namespace sim2os {

  void * Sim2OS::service_close (void)
  {
    if (have_all_arguments(1) == false)
      {
	std::cerr << "<" << name << "> Usage : int close(int fd);" << std::endl;
	return NULL;
      }
    
    int    fd     = static_cast<int>(reinterpret_cast<int64_t>(arguments[1]));
    void * result = (void *) close(fd);
    error         = errno;
    
    std::cout << "\n\t***** service : close         *****" << std::endl;
    std::cout << "\tfd        : " << (unsigned int) fd     << std::endl;
    std::cout << "\tresult    : " << static_cast<int32_t>(reinterpret_cast<int64_t>(result)) << std::endl;
    std::cout << "\terrno     : " << (unsigned int) error  << std::endl;
    
    return result;
  }

};
};
