blob: b43806ff8f6b09190c8224ad8e5096d0ea258eed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#include "pch.hpp"
#include <Ice/ObjectAdapter.h>
#include <dirent.h>
#include <errno.h>
#include <map>
#include <sys/stat.h>
#include <sys/types.h>
#include "daemonDirectory.h"
DirectoryServer::DirectoryServer(DIR * d) :
od(d)
{
}
DirectoryServer::~DirectoryServer()
{
}
void
DirectoryServer::close(const Ice::Current & ice)
{
errno = 0;
if (::closedir(od) != 0) {
throw NetFS::SystemError(errno);
}
ice.adapter->remove(ice.id);
}
NetFS::NameList
DirectoryServer::readdir(const Ice::Current&)
{
errno = 0;
NetFS::NameList list;
while (dirent * d = ::readdir(od)) {
if (errno) {
throw NetFS::SystemError(errno);
}
list.push_back(d->d_name);
}
return list;
}
|