/* * Dump the lock state for a file. */ static void dump_lockstate(char *fname) { struct nfsd_dumplocklist dumplocklist; int cnt, i; dumplocklist.ndllck_size = DUMPSIZE; dumplocklist.ndllck_list = (void *)lp; dumplocklist.ndllck_fname = fname; if (nfssvc(NFSSVC_DUMPLOCKS, &dumplocklist) < 0) errx(1, "Can't dump locks for %s\n", fname); printf("%-11s %-36s %-15s %s\n", "Open/Lock", " Stateid or Lock Range", "Clientaddr", "Owner and ClientID"); /* * Loop through results, printing them out. */ cnt = 0; while (lp[cnt].ndlck_clid.nclid_idlen > 0 && cnt < DUMPSIZE) { if (lp[cnt].ndlck_flags & NFSLCK_OPEN) printf("%-11s %9d %08x %08x %08x ", open_flags(lp[cnt].ndlck_flags), lp[cnt].ndlck_stateid.seqid, lp[cnt].ndlck_stateid.other[0], lp[cnt].ndlck_stateid.other[1], lp[cnt].ndlck_stateid.other[2]); else if (lp[cnt].ndlck_flags & (NFSLCK_DELEGREAD | NFSLCK_DELEGWRITE)) printf("%-11s %9d %08x %08x %08x ", deleg_flags(lp[cnt].ndlck_flags), lp[cnt].ndlck_stateid.seqid, lp[cnt].ndlck_stateid.other[0], lp[cnt].ndlck_stateid.other[1], lp[cnt].ndlck_stateid.other[2]); else printf("%-11s %17jd %17jd ", lock_flags(lp[cnt].ndlck_flags), lp[cnt].ndlck_first, lp[cnt].ndlck_end); if (lp[cnt].ndlck_addrfam == AF_INET) printf("%-15s ", inet_ntoa(lp[cnt].ndlck_cbaddr.sin_addr)); else printf("%-15s ", " "); for (i = 0; i < lp[cnt].ndlck_owner.nclid_idlen; i++) printf("%02x", lp[cnt].ndlck_owner.nclid_id[i]); printf(" "); for (i = 0; i < lp[cnt].ndlck_clid.nclid_idlen; i++) printf("%02x", lp[cnt].ndlck_clid.nclid_id[i]); printf("\n"); cnt++; } }
// ffms_fstream stuff ffms_fstream::ffms_fstream(const char *filename, std::ios_base::openmode mode) #ifdef __MINGW32__ : filebuf(_wopen(widen_path(filename).c_str(), open_flags(mode), 0666), mode) #endif { #if defined(_WIN32) #ifndef __MINGW32__ std::wstring filename_wide = widen_path(filename); if (filename_wide.size()) open(filename_wide.c_str(), mode); else open(filename, mode); #else // Unlike MSVC, mingw's iostream library doesn't have an fstream overload // that takes a wchar_t* filename, so instead we use gcc's nonstandard // fd wrapper std::iostream::rdbuf(&filebuf); #endif //__MINGW32__ #else // _WIN32 open(filename, mode); #endif // _WIN32 }
void open() { out.reset( new std::basic_ofstream<char_type>( name.c_str(), open_flags(settings) ) ); }