#ifndef SERVICE_CLOSE_H
#define SERVICE_CLOSE_H

#include "../sim2os.h"

namespace hierarchy_memory {
  namespace sim2os {

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ service_close ]~~~~~
    void *
    Sim2os ::
    service_close ()
    {
      if (have_all_arguments(1) == false)
	{
	  cerr << "<" << NAME << "> Usage : int close(int fd);" << endl;
	  return NULL;
	}
  
      int         fd       = (int)          arguments[1];
      void *      result   = (void *)       close(fd);
      error                = errno;

      cout << "\n\t***** service : close         *****" << endl;
      cout << "\tfd        : " << (unsigned int) fd     << endl;
      cout << "\tresult    : " << (unsigned int) result << endl;
      cout << "\terrno     : " << (unsigned int) error  << endl;

      return      result;
    }

  };};
#endif //!SERVICE_CLOSE_H
