Skip to content
Snippets Groups Projects
Forked from wine / wine
173935 commits behind the upstream repository.
  • Alexandre Julliard's avatar
    43c190e7
    Server reorganization: · 43c190e7
    Alexandre Julliard authored
    - moved request handlers to the specific C files
    - moved handle management to handle.c
    - moved server private includes to server/ instead of include/server/
    43c190e7
    History
    Server reorganization:
    Alexandre Julliard authored
    - moved request handlers to the specific C files
    - moved handle management to handle.c
    - moved server private includes to server/ instead of include/server/
file.c 17.04 KiB
/*
 * Server-side file management
 *
 * Copyright (C) 1998 Alexandre Julliard
 */

#include <assert.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/errno.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <utime.h>

#include "winerror.h"
#include "winbase.h"

#include "handle.h"
#include "thread.h"

struct file
{
    struct object  obj;             /* object header */
    struct file   *next;            /* next file in hashing list */
    char          *name;            /* file name */
    int            fd;              /* Unix file descriptor */
    unsigned int   access;          /* file access (GENERIC_READ/WRITE) */
    unsigned int   flags;           /* flags (FILE_FLAG_*) */
    unsigned int   sharing;         /* file sharing mode */
};

#define NAME_HASH_SIZE 37

static struct file *file_hash[NAME_HASH_SIZE];

static void file_dump( struct object *obj, int verbose );
static int file_add_queue( struct object *obj, struct wait_queue_entry *entry );
static void file_remove_queue( struct object *obj, struct wait_queue_entry *entry );
static int file_signaled( struct object *obj, struct thread *thread );
static int file_get_read_fd( struct object *obj );
static int file_get_write_fd( struct object *obj );
static int file_flush( struct object *obj );
static int file_get_info( struct object *obj, struct get_file_info_reply *reply );
static void file_destroy( struct object *obj );

static const struct object_ops file_ops =
{
    file_dump,
    file_add_queue,
    file_remove_queue,
    file_signaled,
    no_satisfied,
    file_get_read_fd,
    file_get_write_fd,
    file_flush,
    file_get_info,
    file_destroy
};

static const struct select_ops select_ops =
{
    default_select_event,
    NULL   /* we never set a timeout on a file */
};