/* -*- mode: c -*- */
/* $Id: pass_fd.c,v 1.2 2004/06/19 22:09:08 cher Exp $ */

/* Copyright (C) 2002,2004 Alexander Chernov <cher@ispras.ru> */

/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include "serve_clnt.h"
#include "protocol.h"
#include "pathutl.h"

#include <reuse/logger.h>
#include <reuse/xalloc.h>
#include <reuse/osdeps.h>

#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>

int
serve_clnt_pass_fd(int sock_fd, int nfd, int *fds)
{
  struct prot_serve_packet *out = 0;
  int out_size = 0;
  int r;

  out_size = sizeof(*out);
  out = alloca(out_size);
  out->id = SRV_CMD_PASS_FD;
  out->magic = PROT_SERVE_PACKET_MAGIC;
  if ((r = serve_clnt_send_packet(sock_fd, out_size, out)) < 0) return r;
  return serve_clnt_do_pass_fd(sock_fd, nfd, fds);
}

/**
 * Local variables:
 *  compile-command: "make -C .."
 *  c-font-lock-extra-types: ("\\sw+_t" "FILE")
 * End:
 */
