The function directory-files returns the . and .. entries as well. While in a sense it is true, that only this way the function returns all existing entries, I have yet to see a use for including these. On the other hand, every time a use directory-files I also write something like

(unless (string-match-p "^\\.\\.?$" ... 

or for better efficiency

(unless (or (string= "." entry)
            (string= ".." entry))
   ..)

Particularly in interactive use (M-:) the extra code is undesirable.

Is there some predefined function that returns only actual subentries of a directory efficiently?

Edit
Report