From patchwork Wed Nov 3 23:10:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Blomqvist X-Patchwork-Id: 70087 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id A6776B6EED for ; Thu, 4 Nov 2010 10:11:01 +1100 (EST) Received: (qmail 11310 invoked by alias); 3 Nov 2010 23:10:55 -0000 Received: (qmail 11292 invoked by uid 22791); 3 Nov 2010 23:10:53 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_BG, TW_GF X-Spam-Check-By: sourceware.org Received: from mail-gx0-f175.google.com (HELO mail-gx0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Nov 2010 23:10:47 +0000 Received: by gxk26 with SMTP id 26so959296gxk.20 for ; Wed, 03 Nov 2010 16:10:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.240.200 with SMTP id lb8mr4968621icb.15.1288825845344; Wed, 03 Nov 2010 16:10:45 -0700 (PDT) Received: by 10.231.166.70 with HTTP; Wed, 3 Nov 2010 16:10:45 -0700 (PDT) Date: Thu, 4 Nov 2010 01:10:45 +0200 Message-ID: Subject: [Patch, libfortran, committed] Remove prot from struct unix_stream From: Janne Blomqvist To: Fortran List , GCC Patches Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, some more janitorial work committed as obvious. The prot stuff is leftover junk from the time when libgfortran used mmap(), it is not used anymore for a long time. 2010-11-04 Janne Blomqvist * io/unix.h (struct unix_stream): Remove prot member. * io/unix.c: Remove PROT_READ and PROT_WRITE constants. (fd_to_stream): Remove prot from argument list, don't set prot. (open_external): Don't set prot flag. (input_stream): Remove prot from argument list. (output_stream): Likewise. (error_stream): Likewise. diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index a2903af..cf33aec 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -104,14 +104,6 @@ typedef struct stat gfstat_t; #define PATH_MAX 1024 #endif -#ifndef PROT_READ -#define PROT_READ 1 -#endif - -#ifndef PROT_WRITE -#define PROT_WRITE 2 -#endif - /* These flags aren't defined on all targets (mingw32), so provide them here. */ #ifndef S_IRGRP @@ -919,7 +911,7 @@ open_internal4 (char *base, int length, gfc_offset offset) * around it. */ static stream * -fd_to_stream (int fd, int prot) +fd_to_stream (int fd) { gfstat_t statbuf; unix_stream *s; @@ -931,7 +923,6 @@ fd_to_stream (int fd, int prot) s->buffer_offset = 0; s->physical_offset = 0; s->logical_offset = 0; - s->prot = prot; /* Get the current length of the file. */ @@ -1231,7 +1222,7 @@ regular_file (st_parameter_open *opp, unit_flags *flags) stream * open_external (st_parameter_open *opp, unit_flags *flags) { - int fd, prot; + int fd; if (flags->status == STATUS_SCRATCH) { @@ -1256,25 +1247,7 @@ open_external (st_parameter_open *opp, unit_flags *flags) return NULL; fd = fix_fd (fd); - switch (flags->action) - { - case ACTION_READ: - prot = PROT_READ; - break; - - case ACTION_WRITE: - prot = PROT_WRITE; - break; - - case ACTION_READWRITE: - prot = PROT_READ | PROT_WRITE; - break; - - default: - internal_error (&opp->common, "open_external(): Bad action"); - } - - return fd_to_stream (fd, prot); + return fd_to_stream (fd); } @@ -1284,7 +1257,7 @@ open_external (st_parameter_open *opp, unit_flags *flags) stream * input_stream (void) { - return fd_to_stream (STDIN_FILENO, PROT_READ); + return fd_to_stream (STDIN_FILENO); } @@ -1300,7 +1273,7 @@ output_stream (void) setmode (STDOUT_FILENO, O_BINARY); #endif - s = fd_to_stream (STDOUT_FILENO, PROT_WRITE); + s = fd_to_stream (STDOUT_FILENO); return s; } @@ -1317,7 +1290,7 @@ error_stream (void) setmode (STDERR_FILENO, O_BINARY); #endif - s = fd_to_stream (STDERR_FILENO, PROT_WRITE); + s = fd_to_stream (STDERR_FILENO); return s; } diff --git a/libgfortran/io/unix.h b/libgfortran/io/unix.h index dc433d7..fe671fa 100644 --- a/libgfortran/io/unix.h +++ b/libgfortran/io/unix.h @@ -56,7 +56,6 @@ typedef struct int active; /* Length of valid bytes in the buffer */ - int prot; int ndirty; /* Dirty bytes starting at buffer_offset */ int special_file; /* =1 if the fd refers to a special file */