Issue 104535 - Unnecessary access() system calls in the file selection dialog
Summary: Unnecessary access() system calls in the file selection dialog
Status: CONFIRMED
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: DEV300m48
Hardware: All Unix, all
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks: 92644
  Show dependency tree
 
Reported: 2009-08-27 04:51 UTC by tora3
Modified: 2017-05-20 11:33 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description tora3 2009-08-27 04:51:14 UTC
Steps:
 1. /opt/openoffice.org3/program/soffice &
 2. truss -d -t access,openat -p `pgrep soffice.bin` (on Solaris)
    strace -t -f -e trace=access,open -p `pgrep soffice.bin` (on Linux)
 3. File - Open
 4. Type / t m p in the File name text field of the file selection dialog.

Results (on Solaris):
Thread#  Elapse SystemCall                                      ReturnValue
/92:	 8.2615	access("/", F_OK)				= 0
/92:	 8.2617	access("/", F_OK)				= 0
/92:	 8.2618	openat(AT_FDCWD, "/", O_RDONLY|O_NDELAY|O_LARGEFILE) = 25
/92:	 8.2633	access("/usr/bin", F_OK)			= 0
/92:	 8.2634	access("/usr/bin", F_OK)			= 0
/93:	10.7576	access("/t", F_OK)				Err#2 ENOENT
/93:	10.7577	access("/t", F_OK)				Err#2 ENOENT
/93:	10.7580	access("/", F_OK)				= 0
/93:	10.7582	openat(AT_FDCWD, "/", O_RDONLY|O_NDELAY|O_LARGEFILE) = 25
/93:	10.7596	access("/usr/bin", F_OK)			= 0
/93:	10.7597	access("/usr/bin", F_OK)			= 0
/94:	13.3891	access("/tm", F_OK)				Err#2 ENOENT
/94:	13.3892	access("/tm", F_OK)				Err#2 ENOENT
/94:	13.3895	access("/", F_OK)				= 0
/94:	13.3896	openat(AT_FDCWD, "/", O_RDONLY|O_NDELAY|O_LARGEFILE) = 25
/94:	13.3908	access("/usr/bin", F_OK)			= 0
/94:	13.3908	access("/usr/bin", F_OK)			= 0
/95:	16.5656	access("/tmp", F_OK)				= 0
/95:	16.5658	access("/", F_OK)				= 0
/95:	16.5659	openat(AT_FDCWD, "/", O_RDONLY|O_NDELAY|O_LARGEFILE) = 25
/95:	16.5674	access("/usr/bin", F_OK)			= 0
/95:	16.5675	access("/usr/bin", F_OK)			= 0

Every time as a user types a letter, soffice.bin creates a new thread and the 
thread calls access() system calls.

Thread#  Elapse SystemCall                                      ReturnValue
/92:	 8.2615	access("/", F_OK)				= 0
/93:	10.7576	access("/t", F_OK)				Err#2 ENOENT
/94:	13.3891	access("/tm", F_OK)				Err#2 ENOENT
/95:	16.5656	access("/tmp", F_OK)				= 0

That leads a problem described in the issue 92644.


In contrast, some UNIX commands such as bash and tcsh also be capable of file 
name completion as soffice.bin similarly offers. They, however, do not use 
access() system calls, but just use openat() for opendir() user level function.

$ tcsh
> tty
/dev/pts/54

$ ps -t pts/54
   PID TTY         TIME CMD
14164 pts/54      0:00 tcsh
12910 pts/54      0:00 bash

$ truss -d -t access,openat -p 14164
Base time stamp:  1251342975.1725  [ Thu Aug 27 12:16:15 JST 2009 ]
 4.4109	openat(AT_FDCWD, "/", O_RDONLY|O_NDELAY|O_LARGEFILE) = 3
 7.7308	openat(AT_FDCWD, "/tmp/", O_RDONLY|O_NDELAY|O_LARGEFILE) = 3
10.6669	openat(AT_FDCWD, "/tmp/", O_RDONLY|O_NDELAY|O_LARGEFILE) = 3


soffice.bin could replace some code fragments related to thread creations and 
access() invocations for a file selection dialog with much simpler codes.
Comment 1 hdu@apache.org 2009-08-28 09:14:42 UTC
certainly a good idea
Comment 2 Marcus 2017-05-20 11:33:16 UTC
Reset assigne to the default "issues@openoffice.apache.org".