Questions tagged [fcntl]

fcntl refers to a function that provides control over the open file referenced by a file descriptor

fcntl refers to a function that provides control over the open file referenced by a file descriptor.

234 questions
0
votes
2 answers

Not able to close the file open using popen

I'm new to C language and today, i am facing a problem while i am trying to close the "Open Stream" created by using the popen function. 1. Is this problem seeing, because of the poll function that i used in this program? 2. Or because of the…
Sougrakpam
  • 83
  • 1
  • 3
  • 11
-1
votes
1 answer

How to use "fcntl.lockf" in Python?

I found this question but I do not know how to use the suggestion. I have tried with open(fullname) as filein: fcntl.lockf(filein, fcntl.LOCK_EX | fcntl.LOCK_NB) and with open(fullname) as filein: fcntl.lockf(filein.fileno(), fcntl.LOCK_EX…
Alex
  • 41,580
  • 88
  • 260
  • 469
-1
votes
1 answer

read() not working as expected. Returns value 1 on successful read of large block

I am developing a process that, among other things, will copy files. I've run across a problem that the read function does not work as I expected. My research and my prior experience tell me that the (fcntl) read() function is supposed to return…
Dennis
  • 1,071
  • 2
  • 17
  • 38
-1
votes
1 answer

How can I open directory with open() function in C?

I want to open a directory without using . I tried this: #include int fd = open("dir", O_RDONLY, 0); But it returns fd = -1. Why? As I know, the directory is a file too, it just stores the location of children files and…
-1
votes
2 answers

Non-blocking pasv sock and blocking connection (active) socket

On my TCP server I would like to have: non-blocking passive socket to have non-blocking accept(); after accepting connection I would like to perform some authentication like verifying client provided Id and Password. So I have well defined…
Michał Ziobro
  • 10,759
  • 11
  • 88
  • 143
-1
votes
1 answer

Linux: Conflicts using inotify with fcntl

I'm having a strange linking issue after I included inotify in my program to monitor changes to a filesystem. The project includes in many other source files. However, when I include in the source file which is doing the…
Lars
  • 233
  • 2
  • 9
-3
votes
1 answer

Whether fcntl record lock can work in multithreads

I tried fcntl record lock work in multithreads on linux. But it seems fcntl record lock doesn't work? Can fcntl record lock work in multithreads?
yafeng
  • 1
  • 1
-3
votes
1 answer

C: How to append data to a file without using standard I/O libraries

I was wondering if there is a way to append data to a file without using functions from standard I/O libraries (i.e. stdio.h). I though of doing something like this first: #include #include int main() { int fd =…
M.Ahmed
  • 11
  • 4
-4
votes
1 answer

segmentation err in switch case

I wrote a code to implement file locking in c. After resolving a errors and ignoring all the warnings haha, I was able to compile the code but now the thing is, When I try to add content to the file, it is showing segmentation error. code…
1 2 3
15
16