~ubuntu-branches/ubuntu/utopic/nss-pam-ldapd/utopic-proposed

« back to all changes in this revision

Viewing changes to .pc/01-use-poll-instead-of-select.patch/common/tio.h

  • Committer: Package Import Robot
  • Author(s): Arthur de Jong
  • Date: 2012-10-14 23:00:00 UTC
  • Revision ID: package-import@ubuntu.com-20121014230000-tn63bv35wlebv45a
Tags: 0.8.10-3
* fix a problem in sed logic for commenting out disabled options
  (closes: #689296)
* support "EXTERNAL" SASL mechanism in debconf configuration (LP: #1063923)
  (the debconf template has been postponed to avoid having to update all
  translations for a relatively minor change)
* 01-use-poll-instead-of-select.patch: use poll() instead of select()
  for checking file descriptor activity to also correctly work if more
  than FD_SETSIZE files are already open (closes: #690319)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   tio.h - timed io functions
 
3
   This file is part of the nss-pam-ldapd library.
 
4
 
 
5
   Copyright (C) 2007, 2008, 2010, 2012 Arthur de Jong
 
6
 
 
7
   This library is free software; you can redistribute it and/or
 
8
   modify it under the terms of the GNU Lesser General Public
 
9
   License as published by the Free Software Foundation; either
 
10
   version 2.1 of the License, or (at your option) any later version.
 
11
 
 
12
   This library is distributed in the hope that it will be useful,
 
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
   Lesser General Public License for more details.
 
16
 
 
17
   You should have received a copy of the GNU Lesser General Public
 
18
   License along with this library; if not, write to the Free Software
 
19
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
20
   02110-1301 USA
 
21
*/
 
22
 
 
23
/*
 
24
 
 
25
   TODO: Add some documentation here.
 
26
 
 
27
   the SIGPIPE signal should be ignored (is ignored in this code)
 
28
 
 
29
   This library is not thread safe. You cannot share TFILE objects between
 
30
   threads and expect to be able to read and write from them in different
 
31
   threads. All the state is in the TFILE object so calls to this library on
 
32
   different objects can be done in parallel.
 
33
 
 
34
*/
 
35
 
 
36
#ifndef COMMON__TIO_H
 
37
#define COMMON__TIO_H
 
38
 
 
39
#include <sys/time.h>
 
40
#include <sys/types.h>
 
41
 
 
42
#include "compat/attrs.h"
 
43
 
 
44
/* This is a generic file handle used for reading and writing
 
45
   (something like FILE from stdio.h). */
 
46
typedef struct tio_fileinfo TFILE;
 
47
 
 
48
/* Open a new TFILE based on the file descriptor. The timeout is set for any
 
49
   operation. The timeout value is copied so may be dereferenced after the
 
50
   call. */
 
51
TFILE *tio_fdopen(int fd,struct timeval *readtimeout,struct timeval *writetimeout,
 
52
                  size_t initreadsize,size_t maxreadsize,
 
53
                  size_t initwritesize,size_t maxwritesize)
 
54
  LIKE_MALLOC MUST_USE;
 
55
 
 
56
/* Read the specified number of bytes from the stream. */
 
57
int tio_read(TFILE *fp,void *buf,size_t count);
 
58
 
 
59
/* Read and discard the specified number of bytes from the stream. */
 
60
int tio_skip(TFILE *fp,size_t count);
 
61
 
 
62
/* Read all available data from the stream and empty the read buffer. */
 
63
int tio_skipall(TFILE *fp);
 
64
 
 
65
/* Write the specified buffer to the stream. */
 
66
int tio_write(TFILE *fp,const void *buf,size_t count);
 
67
 
 
68
/* Write out all buffered data to the stream. */
 
69
int tio_flush(TFILE *fp);
 
70
 
 
71
/* Flush the streams and closes the underlying file descriptor. */
 
72
int tio_close(TFILE *fp);
 
73
 
 
74
/* Store the current position in the stream so that we can jump back to it
 
75
   with the tio_reset() function. */
 
76
void tio_mark(TFILE *fp);
 
77
 
 
78
/* Rewinds the stream to the point set by tio_mark(). Note that this only
 
79
   resets the read stream and not the write stream. This function returns
 
80
   whether the reset was successful (this function may fail if the buffers
 
81
   were full). */
 
82
int tio_reset(TFILE *fp);
 
83
 
 
84
#endif /* COMMON__TIO_H */