mknod(pItem->handler,(S_IRWXU|S_IRWXG|S_IRWXO|S_IFCHR),MKDEV(pItem->nMajor,pItem->nMinor)) is failing with errno 2. Here handler is ~/seq. However I'm running the program with super user. Any Help would be appreciated. Thanks, Sunil
SunilKrSingh
Posts
-
system call mknod() failing with errno 2 on ubuntu -
Initializing base class dataThanks It cleared my confusion.
-
Initializing base class dataThanks for your help. Here in my scenario char * ptr; is private in base class. So the Derived copy constructor statement will fail Derived(const Derived & sec):Base(sec.ptr) We will not be allowed to access the base class data using "sec.ptr". So if my base class data is private, what should I do to initialize the base class data. Thanks, Sunil
-
Initializing base class dataclass Base { char * ptr; public: Base(){} Base(char * str) { ptr = new char[strlen(str)]; strcpy(ptr,str); } }; class Derived : public Base { char * ptr_s; public: Derived(char * str1,char * str2):Base(str2) { ptr_s = new char[strlen(str1)]; strcpy(ptr_s,str1); } Derived(const Derived & sec)//:Base(sec.ptr) { this->ptr_s = new char[strlen(sec.ptr_s)]; strcpy(this->ptr_s,sec.ptr_s); } }; int _tmain(int argc, _TCHAR* argv[]) { Derived Obj1("sunil","singh"); Derived Obj2 = Obj1; return 0; } Obj1 is a derived class object where base class char pointer is initialized with "singh" and derived class char pointer is initilized with "sunil". I want to create Obj2 out of Obj1. Separate memory should be created for Obj2 char pointer (base part and derived part as well) and that should be initialized with the strings contained in Obj1. Here the problem is: Derived class part can be initialized with copy constructor. How to initialize the base class char poniter of Obj2 with the base class part of Obj1. char pointers in both the classes are private. I tried using initializer list but could not succeed. Is there some proper way to do this? Thanks for any help or suggestion in advance.
-
While going from Paused to Stopped, the Service Hangs at StoppingI got the root cause of the issue. Pausing the service is causing the service thread to be suspended with the statement SuspendThread(threadHandle); So an attempt to stop the service from a paused state with SERVICE_STOP_PENDING was failing with error Error 1053: The service did not respond to the start or control request in a timely fashion. I had to resume the service thread before the stopping the service. Thanks, Sunil
-
While going from Paused to Stopped, the Service Hangs at StoppingWhile going from Paused to Stopped the Service Status Hangs at Stopping, eventually timing out and receiving an error message. Error 1053: The service did not respond to the start or control request in a timely fashion. Following code is causing the service to go into not responding state when going from paused to Stopped state. Can anyone plz help me in finding out whats wrong with the code? When I use SERVICE_CONTROL_STOP instead of SERVICE_STOP_PENDING in the method SendStatusToSCM, it resolves the issue. Is this correct way? VOID Handler (DWORD controlCode) { DWORD currentState = 0; BOOL success; switch(controlCode) { // Stop the service case SERVICE_CONTROL_STOP: { success = SendStatusToSCM(SERVICE_STOP_PENDING, NO_ERROR, 0, 1, 5000); } break; // Pause the service case SERVICE_CONTROL_PAUSE: if (runningService && !pauseService) { // Tell the SCM what's happening success = SendStatusToSCM( SERVICE_PAUSE_PENDING, NO_ERROR, 0, 1, 1000); pauseService = TRUE; SuspendThread(threadHandle); currentState = SERVICE_PAUSED; } break; } BOOL SendStatusToSCM (DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwServiceSpecificExitCode, DWORD dwCheckPoint, DWORD dwWaitHint) { BOOL success; SERVICE_STATUS serviceStatus; // Fill in all of the SERVICE_STATUS fields serviceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; serviceStatus.dwCurrentState = dwCurrentState; // If in the process of doing something, then accept // no control events, else accept anything if (dwCurrentState == SERVICE_START_PENDING) serviceStatus.dwControlsAccepted = 0; else serviceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_PAUSE_CONTINUE | SERVICE_ACCEPT_SHUTDOWN; // if a specific exit code is defined, set up // the win32 exit code properly if (dwServiceSpecificExitCode == 0) serviceStatus.dwWin32ExitCode = dwWin32ExitCode; else serviceStatus.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR; serviceStatus.dwServiceSpecificExitCode = dwServiceSpecificExitCode; serviceStatus.dwCheckPoint = dwCheckPoint; serviceStatus.dwWaitHint = dwWaitHint; // Pass the status record to the SCM success = SetServiceStatus (serviceStatusHandle, &serviceStatus); return success; }