1/* 2 * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 30/* 31 * POSIX stdio FILE locking functions. These assume that the locking 32 * is only required at FILE structure level, not at file descriptor 33 * level too. 34 * 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/lib/libc/stdio/_flock_stub.c 288006 2015-09-20 03:55:03Z rodrigc $"); |
39 40#include "namespace.h" 41#include <stdio.h> 42#include <stdlib.h> 43#include <string.h> 44#include <pthread.h> 45#include "un-namespace.h" 46 47#include "local.h" 48 49 50/* 51 * Weak symbols for externally visible functions in this file: 52 */ 53__weak_reference(_flockfile, flockfile); 54__weak_reference(_flockfile_debug_stub, _flockfile_debug); 55__weak_reference(_ftrylockfile, ftrylockfile); 56__weak_reference(_funlockfile, funlockfile); 57 |
58void _flockfile_debug_stub(FILE *fp, char *fname, int lineno); 59int _ftrylockfile(FILE *fp); 60 |
61void 62_flockfile(FILE *fp) 63{ 64 pthread_t curthread = _pthread_self(); 65 66 if (fp->_fl_owner == curthread) 67 fp->_fl_count++; 68 else { --- 71 unchanged lines hidden --- |