vfs: check userland buffers before reading them.
[haiku.git] / src / apps / expander / ExpanderThread.h
blob05abb822951eb8691333a17fe6a3b23f8988651a
1 /*
2 * Copyright 2004-2010, Jérôme Duval. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 * Original code from ZipOMatic by jonas.sundstrom@kirilla.com
5 */
6 #ifndef _EXPANDER_THREAD_H
7 #define _EXPANDER_THREAD_H
10 #include <Message.h>
11 #include <Volume.h>
12 #include <String.h>
13 #include <OS.h>
14 #include <FindDirectory.h>
16 #include "GenericThread.h"
17 #include <stdio.h>
18 #include <stdlib.h>
21 extern const char* ExpanderThreadName;
24 class ExpanderThread : public GenericThread {
25 public:
26 ExpanderThread(BMessage* refs_message,
27 BMessenger* messenger);
28 ~ExpanderThread();
30 status_t SuspendExternalExpander();
31 status_t ResumeExternalExpander();
32 status_t InterruptExternalExpander();
33 status_t WaitOnExternalExpander();
35 void PushInput(BString text);
37 private:
38 virtual status_t ThreadStartup();
39 virtual status_t ExecuteUnit();
40 virtual status_t ThreadShutdown();
42 virtual void ThreadStartupFailed(status_t a_status);
43 virtual void ExecuteUnitFailed(status_t a_status);
44 virtual void ThreadShutdownFailed(status_t a_status);
46 status_t ProcessRefs(BMessage* message);
48 thread_id PipeCommand(int argc, const char** argv,
49 int& in, int& out, int& err,
50 const char** envp = (const char**)environ);
52 BMessenger* fWindowMessenger;
54 thread_id fThreadId;
55 int fStdIn;
56 int fStdOut;
57 int fStdErr;
58 FILE* fExpanderOutput;
59 FILE* fExpanderError;
60 char fExpanderOutputBuffer[LINE_MAX];
64 #endif // _EXPANDER_THREAD_H