Skip to contentSkip to conversation

ENOENT as an ioctl return code

DISCUSSION Thomas Hellstrom 3 participants 4 messages Dec 3, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

By concidence I ran across this lkml message

http://marc.info/?l=linux-kernel&m=135628421403144&w=2

with an important part in the middle: (this is not a drm commit)

To make matters worse, commit f0ed2ce840b3 is clearly total and utter CRAP even if it didn't break applications. ENOENT is not a valid error return from an ioctl. Never has been, never will be. ENOENT means "No such file and directory", and is for path operations. ioctl's are done on files that have already been opened, there's no way in hell that ENOENT would ever be valid.

Perhaps we should rethink the use of ENOENT when not finding mode objects?

Thanks,
Thomas

#1 lore raw
Quoted 8 lines · Thomas Hellstrom

Hi,

By concidence I ran across this lkml message

http://marc.info/?l=linux-kernel&m=135628421403144&w=2

with an important part in the middle: (this is not a drm commit)

Quoted 8 lines

To make matters worse, commit f0ed2ce840b3 is clearly total and utter CRAP even if it didn't break applications. ENOENT is not a valid error return from an ioctl. Never has been, never will be. ENOENT means "No such file and directory", and is for path operations. ioctl's are done on files that have already been opened, there's no way in hell that ENOENT would ever be valid.

Perhaps we should rethink the use of ENOENT when not finding mode objects?

Yeah, it's somewhat abuse, otoh if we'd do a dma-buf export telling userspace that "no such file exists" is a pretty precise answer. In a way we _do_ duplicate file objects ... And having this special error code for lookup failures is occasionally rather useful imo.

So honestly I'd prefer we keep on doing our practice. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw
Quoted 16 lines · Daniel Vetter
Quoted 15 lines · Thomas Hellstrom

Hi,

By concidence I ran across this lkml message

http://marc.info/?l=linux-kernel&m=135628421403144&w=2

with an important part in the middle: (this is not a drm commit)

To make matters worse, commit f0ed2ce840b3 is clearly total and utter CRAP even if it didn't break applications. ENOENT is not a valid error return from an ioctl. Never has been, never will be. ENOENT means "No such file and directory", and is for path operations. ioctl's are done on files that have already been opened, there's no way in hell that ENOENT would ever be valid.

Quoted 7 lines
Quoted 1 line

Perhaps we should rethink the use of ENOENT when not finding mode objects?

Yeah, it's somewhat abuse, otoh if we'd do a dma-buf export telling userspace that "no such file exists" is a pretty precise answer. In a way we _do_ duplicate file objects ... And having this special error code for lookup failures is occasionally rather useful imo.

So honestly I'd prefer we keep on doing our practice.

Hmm, yes, I figure this might have originated in the GEM ioctls that was actually trying to mimic file behavior, but then spilled over to the mode objects in the modesetting code...

Just thought I'd raise the issue since I saw that message..

Thanks,
Thomas

Quoted 1 line

-Daniel

#3 lore raw
Quoted 27 lines · Thomas Hellstrom
Quoted 26 lines · Daniel Vetter
Quoted 16 lines · Thomas Hellstrom

Hi,

By concidence I ran across this lkml message

http://marc.info/?l=linux-kernel&m=135628421403144&w=2

with an important part in the middle: (this is not a drm commit)

To make matters worse, commit f0ed2ce840b3 is clearly total and utter CRAP even if it didn't break applications. ENOENT is not a valid error return from an ioctl. Never has been, never will be. ENOENT means "No such file and directory", and is for path operations. ioctl's are done on files that have already been opened, there's no way in hell that ENOENT would ever be valid.

Quoted 2 lines

Perhaps we should rethink the use of ENOENT when not finding mode objects?

Yeah, it's somewhat abuse, otoh if we'd do a dma-buf export telling userspace that "no such file exists" is a pretty precise answer. In a way we _do_ duplicate file objects ... And having this special error code for lookup failures is occasionally rather useful imo.

Quoted 9 lines
Quoted 1 line

So honestly I'd prefer we keep on doing our practice.

Hmm, yes, I figure this might have originated in the GEM ioctls that was actually trying to mimic file behavior,
but then spilled over to the mode objects in the modesetting code...

Just thought I'd raise the issue since I saw that message..

We just need to make sure userspace relies on it, then we can't change it :-P

Linus would enter an infinite loop and possibly explode.

Dave.