1. Pipe (pipeline creation) related functions mkfifo, popen, read, write, fork
Header file # include <unistd. h> &
Define the int pipe function (INT filedes [2]);
Function Description pipe () creates an MPS queue and returns the file description from the filedes array. Filedes [0] is the read end in the pipeline, and filedes [1] is the write end of the pipeline.
If the returned value is successful, zero is returned. Otherwise,-1 is returned. The error cause is stored in errno. & D 'a (G: '(T $ y9 J
ErrorCodeThe emfile process has used up the largest number of file descriptions.
AThe enfile system does not have a file description word available.
The filedes array address of the efault parameter is invalid.
Example/* the parent process uses a pipeline to send the string "Hello! /N "is sent to the sub-process and displayed */
# Include <unistd. h> E
Main ();
{
Int filedes [2];
Char buffer [80]; 1
Pipe (filedes );! R * @ + g/m "g1 t
If (Fork ()> 0 ){
/* Parent process * // G9 H * F-E: D3 D7 C
Char s [] = "Hello! /N ";
Write (filedes [1], S, sizeof (s ));
}
Else {8 Z1 q) W "_ * j: H9 n
/* Sub-process */6 S2 y0 f * @ % m
Read (filedes [0], buffer, 80);, B (A; o % F9 o h/y9 I0 o # W
Printf ("% s", buffer); $ n-I/V7 W ~, ^ * ^
}
}
2.
I. Compilation
1. download the latest Samba soft code package from www.samba.org and decompress it;
2. Set environment variables:
Export ld_libary_path =/usr/local/ARM/3.0/lib/
Export cppflags =-I/usr/local/ARM/3.0/include
Export ldflags =-L/usr/local/ARM/3.0/lib/
Export cc =/usr/local/ARM/3.0/bin/ARM-Linux-gcc
Export cflags = "-March = armv4-mtune = arm9tdmi-mshort-load-bytes"
3. Run configure
./Configure -- Host = i686 -- target = arm-Linux
4. Add the following in the include/config. h file:
# Define sizeof_int 4
# Define sizeof_long 4
# Define sizeof_short 2
# Define have_gettimeofday_tz 1
# Define use_seteuid 1
# Define have_iface_ifconf 1
5. Make
II. Application
1. Create the following directory in the file system to be burned to flash:
/Usr/local/samba
/Usr/local/samba/bin
/Usr/local/samba/var
/Usr/local/samba/private
/Usr/local/samba/lib
Note: The default configuration is used during compilation,ProgramFiles are generated in the preceding directory at runtime.
At the same time, the compiling file system should use the same C library as the compiling Samba.
2. Copy the content in the bin/subdirectory of the compiled Samba source code directory to/usr/local/samba/bin.
Download a simple smb. conf file from the Internet and put it in/usr/local/samba/lib after modification.
Smb. conf is the configuration file run by the Samba daemon nmbd and smbd.
Verification, shared users, and Shared printing.
3. Use smbpasswd-a username to add a samba user and generate the samba Password File smbpasswd.
The specific location is also specified in smb. conf.
4. Run the Samba daemon
Run: nmbd-D, smbd-D, smbd provides SMB/CIFS server, and nmbd provides NetBIOS name server.
You can also add it in RC. Local to automatically load the samba service after the system starts.
5. After starting the samba service, we can use the IP address and the generated
Samba user identity to browse the shared directory of the server.
I used cross-compilation. However, export ld_libary_path =/usr/local/ARM/3.0/lib/
Export cppflags =-I/usr/local/ARM/3.0/include
Export ldflags =-L/usr/local/ARM/3.0/lib/
Export cc =/usr/local/ARM/3.0/bin/ARM-Linux-gcc
Export cflags = "-March = armv4-mtune = arm9tdmi-mshort-load-bytes"
Except for CC items, isn't anything else necessary?