Commit 4d605876 authored by David Auer's avatar David Auer
Browse files

TMP: Update client debug helper

parent 046dfc60
Loading
Loading
Loading
Loading
+32 −6
Original line number Diff line number Diff line
#include <fstream>
#include <iostream>
#include <unistd.h>
#include <sys/time.h>
@@ -5,10 +6,35 @@

int
main(int argc, const char* argv[]) {
    rlimit rlimits;
    int rv = getrlimit(RLIMIT_NOFILE, &rlimits);
    std::cout << "hello world! rv=" << rv
              << " RLIMIT_NOFILE{cur: " << rlimits.rlim_cur
              << ", max: " << rlimits.rlim_max << "}" << std::endl
              << std::flush;
    // Debugging MAXFD-Issues (Workaround in main CMakeLists.txt)
    // rlimit rlimits;
    // int rv = getrlimit(RLIMIT_NOFILE, &rlimits);
    // std::cout << "hello world! rv=" << rv
    //           << " RLIMIT_NOFILE{cur: " << rlimits.rlim_cur
    //           << ", max: " << rlimits.rlim_max << "}" << std::endl
    //           << std::flush;

    // Try writing a file to debug client

    // TODO fixed path for now
    std::ofstream outfile("/dev/shm/gkws/mountdir/testwriting.txt");

    outfile << "my text here!" << std::endl;
    outfile.close();

    // Test reading
    std::ifstream infile("/dev/shm/gkws/mountdir/testwriting.txt");

    std::string s;
    infile >> s;
    std::cout << "Read " << s << ".\n";
    infile.close();


    std::ifstream infile2("/dev/shm/gkws/mountdir/asdf");
    s = "<file not found>";

    infile2 >> s;
    std::cout << "Read " << s << ".\n";
    infile2.close();
}
 No newline at end of file