|
|
1.1 ! root 1: ! 2: ! 3: link() COHERENT System Call link() ! 4: ! 5: ! 6: ! 7: ! 8: Create a link ! 9: ! 10: lliinnkk(_o_l_d, _n_e_w) ! 11: cchhaarr *_o_l_d, *_n_e_w; ! 12: ! 13: A link to a file is another name for the file. All attributes of ! 14: the file appear identical among all links. ! 15: ! 16: link creates a link called new to an existing file named old. ! 17: ! 18: For administrative reasons, it is an error for users other than ! 19: the superuser to create a link to a directory. Such links can ! 20: make the file system no longer tree structured unless carefully ! 21: controlled, posing problems for commands such as find. ! 22: ! 23: ***** Example ***** ! 24: ! 25: This example, called lock.c, demonstrates how link can be used to ! 26: perform intertask locking. With this technique, a program can ! 27: start a process in the background and stop any other user from ! 28: starting the identical process. ! 29: ! 30: ! 31: main() ! 32: { ! 33: if(link("lock.c", "lockfile") == -1) { ! 34: printf("Cannot link\n"); ! 35: exit(1); ! 36: } ! 37: ! 38: ! 39: ! 40: sleep(50); /* do nothing for 50 seconds */ ! 41: unlink("lockfile"); ! 42: printf("done\n"); ! 43: exit(0); ! 44: } ! 45: ! 46: ! 47: ***** See Also ***** ! 48: ! 49: COHERENT system calls, find, ln, unlink() ! 50: ! 51: ***** Diagnostics ***** ! 52: ! 53: link returns zero when successful. It returns -1 on errors, ! 54: e.g., old does not exist, new already exists, attempt to link ! 55: across file systems, or no permission to create new in the target ! 56: directory. ! 57: ! 58: ***** Notes ***** ! 59: ! 60: Because each mounted file system is a self-contained entity, ! 61: links between different mounted file systems fail. ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66: ! 67: ! 68: ! 69: link() COHERENT System Call link() ! 70: ! 71: ! 72: ! 73: ! 74: ! 75: ! 76: ! 77: ! 78: ! 79: ! 80: ! 81: ! 82: ! 83: ! 84: ! 85: ! 86: ! 87: ! 88: ! 89: ! 90: ! 91: ! 92: ! 93: ! 94: ! 95: ! 96: ! 97: ! 98: ! 99: ! 100: ! 101: ! 102: ! 103: ! 104: ! 105: ! 106: ! 107: ! 108: ! 109: ! 110: ! 111: ! 112: ! 113: ! 114: ! 115: ! 116: ! 117: ! 118: ! 119: ! 120: ! 121: ! 122: ! 123: ! 124: ! 125: ! 126: ! 127: ! 128: ! 129: ! 130: COHERENT Lexicon Page 2 ! 131: ! 132:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.