Subversion Repositories public

Rev

Rev 67 | Rev 75 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 67 Rev 69
Line 33... Line 33...
33
typedef void (*proc_done_cb)(InotifyWatch*);
33
typedef void (*proc_done_cb)(InotifyWatch*);
34
34
35
/// Child process data
35
/// Child process data
36
typedef struct
36
typedef struct
37
{
37
{
38
  pid_t pid;            ///< PID
-
 
39
  proc_done_cb onDone;  ///< function called after process finishes
38
  proc_done_cb onDone;  ///< function called after process finishes
40
  InotifyWatch* pWatch; ///< related watch
39
  InotifyWatch* pWatch; ///< related watch
41
} ProcData_t;
40
} ProcData_t;
42
41
43
/// fd-to-usertable mapping
42
/// fd-to-usertable mapping
44
typedef std::map<int, UserTable*> FDUT_MAP;
43
typedef std::map<int, UserTable*> FDUT_MAP;
45
44
46
/// Watch-to-tableentry mapping
45
/// Watch-to-tableentry mapping
47
typedef std::map<InotifyWatch*, InCronTabEntry*> IWCE_MAP;
46
typedef std::map<InotifyWatch*, IncronTabEntry*> IWCE_MAP;
48
47
49
/// Child process list
48
/// Child process list
50
typedef std::deque<ProcData_t> PROC_LIST;
49
typedef std::map<pid_t, ProcData_t> PROC_MAP;
51
50
52
/// Event dispatcher class.
51
/// Event dispatcher class.
53
/**
52
/**
54
 * This class processes events and distributes them as needed.
53
 * This class processes events and distributes them as needed.
55
 */
54
 */
Line 211... Line 210...
211
  {
210
  {
212
    struct passwd* pw = getpwnam(user);
211
    struct passwd* pw = getpwnam(user);
213
    if (pw == NULL)
212
    if (pw == NULL)
214
      return false;
213
      return false;
215
     
214
     
216
    return InCronTab::CheckUser(user);
215
    return IncronTab::CheckUser(user);
217
  }
216
  }
218
 
217
 
219
private:
218
private:
220
  Inotify m_in;           ///< inotify object
219
  Inotify m_in;           ///< inotify object
221
  EventDispatcher* m_pEd; ///< event dispatcher
220
  EventDispatcher* m_pEd; ///< event dispatcher
222
  std::string m_user;     ///< user name
221
  std::string m_user;     ///< user name
223
  bool m_fSysTable;       ///< system table yes/no
222
  bool m_fSysTable;       ///< system table yes/no
224
  InCronTab m_tab;        ///< incron table
223
  IncronTab m_tab;        ///< incron table
225
  IWCE_MAP m_map;         ///< watch-to-entry mapping
224
  IWCE_MAP m_map;         ///< watch-to-entry mapping
226
225
227
  static PROC_LIST s_procList;  ///< child process list
226
  static PROC_MAP s_procMap;  ///< child process mapping
228
 
227
 
229
  /// Finds an entry for a watch.
228
  /// Finds an entry for a watch.
230
  /**
229
  /**
231
   * \param[in] pWatch inotify watch
230
   * \param[in] pWatch inotify watch
232
   * \return pointer to the appropriate entry; NULL if no such entry exists
231
   * \return pointer to the appropriate entry; NULL if no such entry exists
233
   */
232
   */
234
  InCronTabEntry* FindEntry(InotifyWatch* pWatch);
233
  IncronTabEntry* FindEntry(InotifyWatch* pWatch);
235
 
234
 
236
  /// Prepares arguments for creating a child process.
235
  /// Prepares arguments for creating a child process.
237
  /**
236
  /**
238
   * \param[in] rCmd command string
237
   * \param[in] rCmd command string
239
   * \param[out] argc argument count
238
   * \param[out] argc argument count