�������Linux System Programming����������File Descriptor����������Java�ĵ��о����Ƕ��Dz�̫�������linux����ͺ����������ˡ�
FileDescriptor
һ�����ļ�ͨ��Ψһ���������������ã����������Ǵ��ļ���Ԫ���ݵ��ļ�������ӳ�䡣��Linux�ں��У������������Ϊ�ļ���������FileDescriptor�����ļ���������һ��������ʾ��C�����е�����Ϊint������дΪfd��
�ļ����������û��ռ䣨������ں˿ռ���ԣ�Ҳ��������Ӧ�ó�����Dz㣩�й����������û��������ļ�������ֱ�ӷ����ļ���
ͬһ���ļ��ܱ���ͬ������ͬ�Ľ��̶�δ�ÿһ�����ļ���ʵ����Ҳ����java�е�File�����ɣ�������һ��Ψһ���ļ���������ͬһ�����������Ա��������ʹ�á���ͬ�Ľ�����ͬʱ��һ���ļ����ж�д�����Դ��ڲ��������⡣
fd��η����ļ�
�ں�Ϊÿһ������ά��һ�����ļ����б�����Ϊ�ļ�����File Table����������fd������Ϊ���ļ�����Ϣ������һ��ָ���ļ���Inode�����ָ�룬�����Ԫ���ݣ��統ǰ�ļ���ְ����ȡģʽ����(Inode�����ļ���������ַ)
�Ľ���Ҳ��������Map�ṹ��key��fd��value���ļ�����Ϣ������������ַ����ȡģʽ����
�ӽ���Ĭ�ϻ��һ�ݸ�����FIle Table�Ŀ������� ����һ�����̵�FileTable����Ӱ����һ�����̣�����ӽ��̹ر����ļ� ����Ӱ�츸���̵�File Table��������fd�������������ļ���
fd��C���Ե�int��ʾ�Ǹ���������0��ʼ���� ֱ��Ĭ������1024�����չ���ÿ�������������������ļ������������ǽ�����ʽ�Ĺر����ǣ� 0 �����루stdin����1�������stdout����2������stderr����
Linux��fd���ļ���API
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int open(const char *pathname, int flags);
int open(const char *pathname, int flags, mode_t mode);
int creat(const char *pathname, mode_t mode);
int openat(int dirfd, const char *pathname, int flags);
int openat(int dirfd, const char *pathname, int flags, mode_t mode);
�ܽ�
fd�IJ���ʵ����ϵͳ�ں�API��εģ�java�ı�APIû��ֱ����صIJ�����������֪������ֱ��ͨ��fd���ļ��ģ�
���̹���һ������Map���ļ�����key��fd��value���ļ���������ַ�ȵ���Ϣ��
����ͨ��fd���ļ���
�ӽ���copy�����̵��ļ�����
�������ø��µ�ַ��//m.ajphoenix.com/linux/30993.html