Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

File access method and device

A file and stream file technology, applied in the computer field, can solve the problem of high modification complexity

Active Publication Date: 2016-07-27
MAIPU COMM TECH CO LTD
View PDF6 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] However, the modification of the application requires a large adjustment of the logic of the application, and the modification complexity is high.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • File access method and device
  • File access method and device
  • File access method and device

Examples

Experimental program
Comparison scheme
Effect test

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...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

Embodiments of the invention provide a file access method and device, relates to the technical field of computation, and aims at realizing the standard input, output and error files of Linux system-adapted vxWorks systems, and reducing the modification complexity of migrated applications in the vxWorks systems. The method comprises the following steps: obtaining a handle value of a first position in a global handle set of a thread as a handle value of a first file if the handle value of the first position of the handle set of the thread is a preset value, wherein the first position is a position, in the handle set, of the handle value of the preset first file, and the first file is any one of a standard input file, a standard output file and a standard error file; obtaining the handle value of the first position in the handle set of the thread as the handle value of the first file if the handle value of the first position in the handle set of the thread is not the preset value; accessing a file indicated by the handle value of the first file. The method and device provided by the invention are used for file access.

Description

technical field [0001] The invention relates to the field of computers, in particular to a method and device for accessing files. Background technique [0002] With the development of data communication technology, the original vxWorks real-time operating system has been unable to meet the new requirements in terms of hardware support, cost and new functions. Equipment manufacturers gradually try to migrate the vxWorks real-time operating system to Linux system. [0003] There are multiple applications in the vxWorks system, and each application can correspond to multiple tasks. When executing each task, you can access independent standard input, output, and error files, and you can also read and write access to the system's global standard input, output, and error files. ; In the Linux system, there are also multiple applications, each application can correspond to multiple processes or threads, access independent standard input, output, and error files when executing a pro...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F17/30G06F9/48
Inventor 林茂杨恬
Owner MAIPU COMM TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products