"Fossies" - the Fresh Open Source Software Archive

Member "shake-1.0/linux.h" (15 Nov 2014, 2831 Bytes) of package /linux/privat/shake-1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "linux.h" see the Fossies "Dox" file reference documentation.

    1 /***************************************************************************/
    2 /*  Copyright (C) 2006-2011 Brice Arnould.                                 */
    3 /*                                                                         */
    4 /*  This file is part of ShaKe.                                            */
    5 /*                                                                         */
    6 /*  ShaKe is free software; you can redistribute it and/or modify          */
    7 /*  it under the terms of the GNU General Public License as published by   */
    8 /*  the Free Software Foundation; either version 3 of the License, or      */
    9 /*  (at your option) any later version.                                    */
   10 /*                                                                         */
   11 /*  This program is distributed in the hope that it will be useful,        */
   12 /*  but WITHOUT ANY WARRANTY; without even the implied warranty of         */
   13 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
   14 /*  GNU General Public License for more details.                           */
   15 /*                                                                         */
   16 /*  You should have received a copy of the GNU General Public License      */
   17 /*  along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   18 /***************************************************************************/
   19 
   20 #ifndef LINUX_H
   21 # define LINUX_H
   22 # define _GNU_SOURCE
   23 # include <getopt.h>        // getopt_long()
   24 # include <alloca.h>        // alloca()
   25 # include <stdbool.h>       // bool
   26 # include <stdio.h>     // getline, asprintf
   27 # include <sys/time.h>      // struct timeval
   28 # include "judge.h"
   29 
   30 # define OS_RESERVED_SIGNAL 16
   31 
   32 /* Called once, perform OS-specific tasks.
   33  */
   34 int os_specific_setup (const char *tempfile);
   35 
   36 
   37 
   38 /* Get a write lock on the file.
   39  * We get a write lock even when a read lock would be enough to detect
   40  * earlier access contention.
   41  */
   42 int readlock_file (int fd, const char *filename);
   43 
   44 /* Release our locks on the file
   45  * Return -1 if we do not own the lock.
   46  */
   47 int unlock_file (int fd);
   48 
   49 /* Promote a read lock to a write lock.
   50  * Return -1 if we no longer owned the lock.
   51  */
   52 int readlock_to_writelock (int fd);
   53 
   54 /* Return true if fd is locked, else false
   55  */
   56 bool is_locked (int fd);
   57 
   58 
   59 
   60 /* Declares the glibc function
   61  */
   62 int futimes (int fd, const struct timeval tv[2]);
   63 
   64 /* Set the shake_ptime field and ctime of the file to the actual date.
   65  */
   66 int set_ptime (int fd);
   67 
   68 /* Get the ptime of the file, -1 if that failed
   69  */
   70 time_t get_ptime (int fd);
   71 
   72 /*  This function is mainly a wrapper around ioctl()s.
   73  *  It updates a->{blocks, crumbc, fragc, start and end}
   74  * with just a bit of undocumented black magic.
   75  *  It can only be called after investigate().
   76  */
   77 int get_testimony (struct accused *a, struct law *l);
   78 
   79 #endif