Moved ioall.c file to "common"

This commit is contained in:
Rafal Wojtczuk 2011-03-11 11:47:20 +01:00
parent 9a4d53fc3b
commit e19390ca1c
7 changed files with 24 additions and 16 deletions

View File

@ -59,9 +59,3 @@ int read_all(int fd, void *buf, int size)
// fprintf(stderr, "read %d bytes\n", size);
return 1;
}
void set_nonblock(int fd)
{
int fl = fcntl(fd, F_GETFL, 0);
fcntl(fd, F_SETFL, fl | O_NONBLOCK);
}

2
common/ioall.h Normal file
View File

@ -0,0 +1,2 @@
int write_all(int fd, void *buf, int size);
int read_all(int fd, void *buf, int size);

View File

@ -1,13 +1,14 @@
CC=gcc
CFLAGS+=-g -Wall -I../vchan
CFLAGS+=-g -Wall -I../vchan -I../common
XENLIBS=-lvchan -lxenstore -lxenctrl
COMMONIOALL=../common/ioall.o
all: qrexec_daemon qrexec_agent qrexec_client
qrexec_daemon: qrexec_daemon.o unix_server.o ioall.o txrx-vchan.o buffer.o write_stdin.o
$(CC) -g -o qrexec_daemon qrexec_daemon.o unix_server.o ioall.o txrx-vchan.o write_stdin.o buffer.o $(XENLIBS)
qrexec_agent: qrexec_agent.o ioall.o exec.o txrx-vchan.o write_stdin.o buffer.o
$(CC) -g -o qrexec_agent qrexec_agent.o ioall.o exec.o txrx-vchan.o write_stdin.o buffer.o $(XENLIBS)
qrexec_client: qrexec_client.o ioall.o exec.o
$(CC) -g -o qrexec_client qrexec_client.o ioall.o exec.o
qrexec_daemon: qrexec_daemon.o unix_server.o $(COMMONIOALL) txrx-vchan.o buffer.o write_stdin.o
$(CC) -g -o qrexec_daemon qrexec_daemon.o unix_server.o $(COMMONIOALL) txrx-vchan.o write_stdin.o buffer.o $(XENLIBS)
qrexec_agent: qrexec_agent.o exec.o txrx-vchan.o write_stdin.o buffer.o
$(CC) -g -o qrexec_agent qrexec_agent.o exec.o txrx-vchan.o write_stdin.o buffer.o $(XENLIBS)
qrexec_client: qrexec_client.o $(COMMONIOALL) exec.o
$(CC) -g -o qrexec_client qrexec_client.o $(COMMONIOALL) exec.o
clean:
rm -f *.o *~ qrexec_daemon qrexec_agent qrexec_client

View File

@ -23,8 +23,6 @@
void do_fork_exec(char *cmdline, int *pid, int *stdin_fd, int *stdout_fd,
int *stderr_fd);
int write_all(int fd, void *buf, int size);
int read_all(int fd, void *buf, int size);
int peer_server_init(int port);
char *peer_client_init(int dom, int port);
void wait_for_vchan_or_argfd(int max, fd_set * rdset, fd_set * wrset);
@ -36,7 +34,6 @@ void fix_fds(int fdin, int fdout, int fderr);
int get_server_socket(int domid);
int do_accept(int s);
void set_nonblock(int fd);
enum {
WRITE_STDIN_OK = 0x200,

View File

@ -142,6 +142,12 @@ void handle_just_exec(int clid, int len)
fprintf(stderr, "executed (nowait) %s pid %d\n", buf, pid);
}
void set_nonblock(int fd)
{
int fl = fcntl(fd, F_GETFL, 0);
fcntl(fd, F_SETFL, fl | O_NONBLOCK);
}
void handle_exec(int clid, int len)
{
char buf[len];

View File

@ -25,6 +25,7 @@
#include <getopt.h>
#include <stdlib.h>
#include <unistd.h>
#include <ioall.h>
#include "qrexec.h"
#include "buffer.h"
#include "glue.h"

View File

@ -27,6 +27,7 @@
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <ioall.h>
#include "qrexec.h"
#include "buffer.h"
#include "glue.h"
@ -145,6 +146,12 @@ void pass_to_agent(int fd, struct server_header *s_hdr)
write_all_vchan_ext(buf, len);
}
void set_nonblock(int fd)
{
int fl = fcntl(fd, F_GETFL, 0);
fcntl(fd, F_SETFL, fl | O_NONBLOCK);
}
void handle_client_cmdline(int fd)
{
struct client_header hdr;