summaryrefslogtreecommitdiff
path: root/nonstd/FILE.h
blob: 263fe1abc1dbc13bc80714c981d800f3fc02f758 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef __NONSTD_FILE_H__
#define __NONSTD_FILE_H__

#include "stdio.h"		/* for fpos_t */
#include "sys/types.h"		/* for pid_t */

#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 199309L
# define flockfile(x)
# define ftrylockfile(x)
# define funlockfile(x)
#endif

struct __FILE {
	fpos_t pos;
	char *buf;
	enum { SUPPLIED, ALLOCED, UNSET } buftype;
	int buffering;
	int bsize;
	int isopen;
	int flags;
	int lastop;

	/* verified necessary */
	int fd;
	int oflag;
	int orientation;
	int eof;
	int err;
	int nlocks;
	int thread;
	pid_t pipe_pid;

	struct {
		char *buf;
		size_t size;
		int allocated;
	} mem;
	
	struct __FILE *prev;
	struct __FILE *next;
};

int getc_unlocked(FILE *);
int putc_unlocked(FILE *, int);

#endif