mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:02:43 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
	
		
			487 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
	
		
			487 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Peter Elliott <pelliott@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <AK/Assertions.h>
 | |
| #include <fcntl.h>
 | |
| #include <stdio.h>
 | |
| #include <sys/file.h>
 | |
| 
 | |
| extern "C" {
 | |
| 
 | |
| int flock(int fd, int operation)
 | |
| {
 | |
|     struct flock lock {
 | |
|         short(operation & 0b11), SEEK_SET, 0, 0, 0
 | |
|     };
 | |
|     if (operation & LOCK_NB) {
 | |
|         return fcntl(fd, F_SETLK, &lock);
 | |
|     }
 | |
| 
 | |
|     // FIXME: Implement F_SETLKW in fcntl.
 | |
|     VERIFY_NOT_REACHED();
 | |
| }
 | |
| }
 | 
