Improve error reporting in dc-qcmd.
[doldaconnect.git] / daemon / sysevents.h
CommitLineData
d3372da9 1/*
2 * Dolda Connect - Modular multiuser Direct Connect-style client
302a2600 3 * Copyright (C) 2004 Fredrik Tolf <fredrik@dolda2000.com>
d3372da9 4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19#ifndef _SYSEVENTS_H
20#define _SYSEVENTS_H
21
22#include <sys/types.h>
23#include "auth.h"
24
25#define FD_END -1
26#define FD_PIPE 0
27#define FD_FILE 1
28
29struct timer
30{
31 struct timer *next, *prev;
32 double at;
33 void (*func)(int cancelled, void *data);
34 void *data;
35};
36
37struct child
38{
39 struct child *next, *prev;
40 pid_t pid;
41 void (*callback)(pid_t pid, int status, void *data);
42 void *data;
43 int status;
44 volatile int finished;
45};
46
47void childcallback(pid_t pid, void (*func)(pid_t, int, void *), void *data);
48struct timer *timercallback(double at, void (*func)(int, void *), void *data);
49void canceltimer(struct timer *timer);
50pid_t forksess(uid_t user, struct authhandle *auth, void (*ccbfunc)(pid_t, int, void *), void *data, ...);
51
52#endif