File access method and device
A file and stream file technology, applied in the computer field, can solve the problem of high modification complexity
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0026] Embodiment 1 of the present invention provides a method for accessing files, which is applied to the Linux operating system, and the operating system executes application trigger threads, such as figure 1 As shown, when the first file is accessed during execution of the thread, the method may include:
[0027] S101. If the handle value at the first position in the handle set of the thread is a preset value, then obtain the handle value at the first position in the global handle set as the handle value of the first file;
[0028] Wherein, the first position is the preset position of the handle value of the first file in the handle set; the first file is any one of the standard input file, standard output file, and standard error file;
[0029] The handle value is the identifier of the file, and the only file can be obtained through the handle value of the file; optionally, the handle value can be represented by a long integer binary number;
[0030] A handle set refers ...
Embodiment 2
[0055] Embodiment 2 of the present invention provides a method for accessing files, which is applied to the Linux operating system, and the operating system executes application trigger threads, such as image 3 As shown, the method may include:
[0056] S301. Initialize the value of each location handle in the thread handle set to a preset value;
[0057] Exemplarily, it is assumed that the handle set of thread 1 is a handle array TASK_STDFD[3]. After the handle array is initialized, the initialization value of the handle value of each position in the array is a preset value, assuming that the preset value is - 1, the handle array after initialization is: TASK_STDFD[3]={-1,-1,-1}.
[0058] When the first file is accessed during the execution of the thread, the following steps are performed:
[0059] S302. Determine whether the handle value at the first position in the handle set of the thread is a preset value;
[0060] If yes, execute S303;
[0061] If not, execute S305....
Embodiment 3
[0115] Embodiment 3 of the present invention provides a device 50 for accessing files applied to the Linux operating system, included in the operating system, such as Figure 5 As shown, the device 50 for accessing files includes:
[0116] The first acquiring unit 501 is configured to acquire the handle value of the first position in the global handle set as the handle value of the first file if the handle value of the first position in the handle set of the thread is a preset value; wherein, the first position is the preset position of the handle value of the first file in the handle set; the first file is any one of the standard input file, standard output file, and standard error file;
[0117] If the handle value of the first position in the handle set of the thread is a non-preset value, then obtain the handle value of the first position in the handle set of the thread as the handle value of the first file;
[0118] The access unit 502 is configured to access the file in...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com